diag(gallery): v3.26.132 取图分支与耗时探针
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 33s
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 33s
This commit is contained in:
1 parent
e59011b591
commit
0204a7bac9
8 files changed
+41
-8
No files matched your search
@@ -16,6 +16,13 @@
|
||||
> 3. 核验正式地址版本 → 之后才移动 `stable` / `stable-verified-<日期>` 标签、更新本 CHANGELOG、写 GitHub Release(`gh release create`)。
|
||||
> 测试发现问题 → 改 → 再 `deploy:test`,正式环境不受影响。回滚点 `git reset --hard stable`。
|
||||
|
||||
## v3.26.132(2026-11-30)图库取图计时探针
|
||||
|
||||
131 之后第二次打开仍要等。加计时把「走的是哪条分支、每张多久」量出来:
|
||||
objectURL / dataURL / settle 各多少次、平均与最慢耗时、前 3 个慢样本(名字+ms)。
|
||||
|
||||
- 诊断页新增一行「图库取图:…」;`thumbFor` 外层包了计时(只统计,不改逻辑)。
|
||||
|
||||
## v3.26.131(2026-11-30)图库缩略图改 objectURL(修「能加载但很慢」)
|
||||
|
||||
宫格每张缩略图原来都走 `galleryThumb()`:读盘 → base64 → 返回 dataURL。
|
||||
|
||||
@@ -5013,6 +5013,7 @@ const tbCenterSeed = (type, refs) => {
|
||||
}
|
||||
} catch (e2) { pi.err = String((e2 && e2.message) || e2) }
|
||||
out.plugins = pi
|
||||
out.gallery = (wGallerySync && typeof wGallerySync.thumbStats === 'function') ? wGallerySync.thumbStats() : null
|
||||
} catch (e) { /* ignore */ }
|
||||
return out
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "image-workbench-web",
|
||||
"private": true,
|
||||
"version": "3.26.131",
|
||||
"version": "3.26.132",
|
||||
"description": "Browser-based node canvas image workbench",
|
||||
"scripts": {
|
||||
"build": "node scripts/build.js && node scripts/copy-plugins.js",
|
||||
|
||||
Generated
+1
-1
@@ -2014,7 +2014,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "image-workbench"
|
||||
version = "3.26.131"
|
||||
version = "3.26.132"
|
||||
dependencies = [
|
||||
"arboard",
|
||||
"base64 0.22.1",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "image-workbench"
|
||||
version = "3.26.131"
|
||||
version = "3.26.132"
|
||||
description = "无限画布 · 生图工作台桌面版"
|
||||
authors = ["malongan"]
|
||||
license = ""
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"$schema": "../node_modules/@tauri-apps/cli/config.schema.json",
|
||||
"productName": "image-workbench",
|
||||
"version": "3.26.131",
|
||||
"version": "3.26.132",
|
||||
"identifier": "com.malongan.imageworkbench",
|
||||
"build": {
|
||||
"frontendDist": "../dist",
|
||||
|
||||
+28
-4
@@ -178,7 +178,31 @@
|
||||
}
|
||||
if (settleSlots.n < 3) { run() } else { settleSlots.wait.push(run) }
|
||||
})
|
||||
// v3.26.132:取图计时。只统计不参与逻辑,用来回答「慢在哪条分支」。
|
||||
const tst = { calls: 0, thumbUrl: 0, dataThumb: 0, settle: 0, fail: 0, totalMs: 0, maxMs: 0, slow: [] }
|
||||
function thumbStats () {
|
||||
return {
|
||||
calls: tst.calls, thumbUrl: tst.thumbUrl, dataThumb: tst.dataThumb, settle: tst.settle, fail: tst.fail,
|
||||
avgMs: tst.calls ? Math.round(tst.totalMs / tst.calls) : 0,
|
||||
maxMs: tst.maxMs,
|
||||
slow: tst.slow.slice(0, 3),
|
||||
}
|
||||
}
|
||||
|
||||
async function thumbFor (name, extra) {
|
||||
const t0 = (typeof performance !== 'undefined' && performance.now) ? performance.now() : Date.now()
|
||||
let hit = ''
|
||||
try {
|
||||
hit = await thumbForInner(name, extra)
|
||||
} catch (err) { tst.fail++; throw err }
|
||||
const ms = ((typeof performance !== 'undefined' && performance.now) ? performance.now() : Date.now()) - t0
|
||||
tst.calls++; tst.totalMs += ms
|
||||
if (ms > tst.maxMs) tst.maxMs = Math.round(ms)
|
||||
if (ms > 400 && tst.slow.length < 3) tst.slow.push(String(name).slice(0, 28) + ' ' + Math.round(ms) + 'ms')
|
||||
if (!hit) tst.fail++
|
||||
return hit
|
||||
}
|
||||
async function thumbForInner (name, extra) {
|
||||
const e = extra || {}
|
||||
const f = (Array.isArray(e.outputs) ? e.outputs : []).find((x) => x && x.name === name)
|
||||
if (!f) return ''
|
||||
@@ -200,18 +224,18 @@
|
||||
// 位图也就跟着留着。320 缩略图本身是 ~20KB 的 data URL,内核可随时丢弃,直接给 <img> 最省。
|
||||
// v3.26.131:优先要 **objectURL**(首帧可用、重复打开零成本);拿不到再退回 dataURL。
|
||||
if (f.thumbHash && typeof e.galleryThumbUrl === 'function') {
|
||||
try { const v = await e.galleryThumbUrl(f.thumbHash); if (v) return v } catch (err) { /* 继续 */ }
|
||||
try { const v = await e.galleryThumbUrl(f.thumbHash); if (v) { tst.thumbUrl++; return v } } catch (err) { /* 继续 */ }
|
||||
}
|
||||
if (f.thumbHash && typeof e.galleryThumb === 'function') {
|
||||
try { const v = await e.galleryThumb(f.thumbHash); if (v && !HUGE_DATA(v)) return v } catch (err) { /* 继续本地副本 */ }
|
||||
try { const v = await e.galleryThumb(f.thumbHash); if (v && !HUGE_DATA(v)) { tst.dataThumb++; return v } } catch (err) { /* 继续本地副本 */ }
|
||||
}
|
||||
if (f.data) return withSlot(() => settle(f.data))
|
||||
if (f.data) { tst.settle++; return withSlot(() => settle(f.data)) }
|
||||
const local = await withSlot(() => localCopySrcOf(f))
|
||||
if (local) return withSlot(() => settle(local))
|
||||
return withSlot(() => settle(f.url || ''))
|
||||
}
|
||||
|
||||
return { archiveEntryNow, wasArchived, notifyChanged, localCopySrcOf, prepareInsert, gridSpots, nodeImageOf, thumbFor }
|
||||
return { archiveEntryNow, wasArchived, notifyChanged, localCopySrcOf, prepareInsert, gridSpots, nodeImageOf, thumbFor, thumbStats }
|
||||
}
|
||||
|
||||
let attached = null
|
||||
|
||||
@@ -150,6 +150,7 @@
|
||||
const t = d.thumbs || null
|
||||
return el('div', null,
|
||||
(d.plugins ? el('div', { className: 'iwb-diag-extra', title: '加载器实际读取的插件目录与版本表' }, '插件源:' + (d.plugins.dir || '未知') + ' · 索引 ' + d.plugins.n + ' 条 · 目录 ' + d.plugins.dirs + (d.plugins.err ? (' · 错误:' + d.plugins.err) : '') + (d.plugins.list ? (' ' + d.plugins.list) : '')) : null),
|
||||
(d.gallery ? el('div', { className: 'iwb-diag-extra', title: '图库取图分支与耗时' }, '图库取图:' + d.gallery.calls + ' 次 · objectURL ' + d.gallery.thumbUrl + ' / dataURL ' + d.gallery.dataThumb + ' / settle ' + d.gallery.settle + ' · 平均 ' + d.gallery.avgMs + 'ms · 最慢 ' + d.gallery.maxMs + 'ms · 失败 ' + d.gallery.fail + (d.gallery.slow.length ? (' 慢:' + d.gallery.slow.join(' ; ')) : '')) : null),
|
||||
el('div', { className: 'iwb-section-sub' }, '图片管线'),
|
||||
el('div', { className: 'iwb-diag-extra' }, '原生解码:进行中 ' + (k.active || 0) + ' · 峰值 ' + (k.peak || 0) + ' · 累计 ' + (k.total || 0)
|
||||
+ (t ? (' | 缩略图磁盘 ' + t.n + ' 个 / ' + t.mb + 'MB(512:' + t.n512 + ' · 256:' + t.n256 + ' · 旧768:' + t.n768 + ')') : '')),
|
||||
|
||||
Reference in new issue
Block a user