perf(gallery): v3.26.133 宫格不再读原图(改原生 320 tier),修 150 次/11 秒
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 1m1s
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 1m1s
This commit is contained in:
1 parent
0204a7bac9
commit
2e86b433c3
8 files changed
+53
-9
No files matched your search
@@ -16,6 +16,16 @@
|
||||
> 3. 核验正式地址版本 → 之后才移动 `stable` / `stable-verified-<日期>` 标签、更新本 CHANGELOG、写 GitHub Release(`gh release create`)。
|
||||
> 测试发现问题 → 改 → 再 `deploy:test`,正式环境不受影响。回滚点 `git reset --hard stable`。
|
||||
|
||||
## v3.26.133(2026-11-30)图库宫格不再读原图(149 次 11 秒的根因)
|
||||
|
||||
132 的探针:图库取图 150 次,objectURL/dataURL/settle 全是 0,平均 11116ms、最慢 25344ms、失败 83。
|
||||
说明全部走了没计数的兜底分支 —— `localCopySrcOf()`:**逐张读 4K 原图再转 base64**。
|
||||
|
||||
- 新增 `galleryThumbOfEntry(f, max)`(宿主):有 thumbHash 走 objectURL;没有就按 assets 登记的相对路径,
|
||||
在**原生侧**生成 320 tier(文件名按条目名做稳定 hash,落盘复用)。
|
||||
- `thumbFor` 的宫格兜底改为调用它,**彻底删掉读原图那条路**;最后只剩远程 URL 兜底。
|
||||
- 失败计数不再算「排队等 slot 时的空转」。
|
||||
|
||||
## v3.26.132(2026-11-30)图库取图计时探针
|
||||
|
||||
131 之后第二次打开仍要等。加计时把「走的是哪条分支、每张多久」量出来:
|
||||
|
||||
@@ -7772,7 +7772,7 @@ const tbCenterSeed = (type, refs) => {
|
||||
list: (o) => window.IWBPluginGallery.query(outputs, o),
|
||||
// v3.26.61:缩略图取源顺序(清单 data → images/thumbs → 本地原图 → 远程)在 gallery-sync 里,
|
||||
// 原因是「生图后图库不显示」有一半出在这里 —— 新图 data 还没 hydrate 就只剩远程 url 可退。
|
||||
thumb: (name) => (wGallerySync ? wGallerySync.thumbFor(name, { outputs, displayThumbOf: wDisplayThumbOf, galleryThumb: (h) => { const F = (typeof window !== 'undefined') ? window.IWBStorageFile : null; return (F && typeof F.galleryThumb === 'function') ? F.galleryThumb(h) : Promise.resolve('') }, galleryThumbUrl: (h) => { const F = (typeof window !== 'undefined') ? window.IWBStorageFile : null; return (F && typeof F.galleryThumbUrl === 'function') ? F.galleryThumbUrl(h) : Promise.resolve('') } }) : ''),
|
||||
thumb: (name) => (wGallerySync ? wGallerySync.thumbFor(name, { outputs, displayThumbOf: wDisplayThumbOf, galleryThumb: (h) => { const F = (typeof window !== 'undefined') ? window.IWBStorageFile : null; return (F && typeof F.galleryThumb === 'function') ? F.galleryThumb(h) : Promise.resolve('') }, galleryThumbUrl: (h) => { const F = (typeof window !== 'undefined') ? window.IWBStorageFile : null; return (F && typeof F.galleryThumbUrl === 'function') ? F.galleryThumbUrl(h) : Promise.resolve('') }, galleryThumbOf: (f, max) => { const F = (typeof window !== 'undefined') ? window.IWBStorageFile : null; return (F && typeof F.galleryThumbOfEntry === 'function') ? F.galleryThumbOfEntry(f, max) : Promise.resolve('') } }) : ''),
|
||||
preview: (name) => setPreview({ list: outputs.map((x) => ({ __gallery: true, name: x.name, origIdb: x.origIdb, idb: x.idb, url: x.url, thumb: x.data || null })), idx: Math.max(0, outputs.findIndex((x) => x.name === name)) }),
|
||||
download: async (names) => {
|
||||
const failed = []
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "image-workbench-web",
|
||||
"private": true,
|
||||
"version": "3.26.132",
|
||||
"version": "3.26.133",
|
||||
"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.132"
|
||||
version = "3.26.133"
|
||||
dependencies = [
|
||||
"arboard",
|
||||
"base64 0.22.1",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "image-workbench"
|
||||
version = "3.26.132"
|
||||
version = "3.26.133"
|
||||
description = "无限画布 · 生图工作台桌面版"
|
||||
authors = ["malongan"]
|
||||
license = ""
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"$schema": "../node_modules/@tauri-apps/cli/config.schema.json",
|
||||
"productName": "image-workbench",
|
||||
"version": "3.26.132",
|
||||
"version": "3.26.133",
|
||||
"identifier": "com.malongan.imageworkbench",
|
||||
"build": {
|
||||
"frontendDist": "../dist",
|
||||
|
||||
+15
-3
@@ -230,9 +230,21 @@
|
||||
try { const v = await e.galleryThumb(f.thumbHash); if (v && !HUGE_DATA(v)) { tst.dataThumb++; return v } } catch (err) { /* 继续本地副本 */ }
|
||||
}
|
||||
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 || ''))
|
||||
// v3.26.133:宫格兜底**绝不读原图**。原来这里走 localCopySrcOf(读 4K 原图 → base64),
|
||||
// 实测 150 次调用平均 11 秒、失败 83 —— 「第二次打开还要等」就是它。
|
||||
// 现在交给宿主:按 assets 登记的路径在原生侧生成 320 tier(按名字稳定 hash、落盘复用)。
|
||||
if (typeof e.galleryThumbOf === 'function') {
|
||||
try {
|
||||
const v = await e.galleryThumbOf(f, 320)
|
||||
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)) { tst.dataThumb++; return v } } catch (err) { /* 继续 */ }
|
||||
}
|
||||
if (f.url && typeof f.url === 'string' && /^https?:/i.test(f.url)) return f.url
|
||||
tst.fail++
|
||||
return ''
|
||||
}
|
||||
|
||||
return { archiveEntryNow, wasArchived, notifyChanged, localCopySrcOf, prepareInsert, gridSpots, nodeImageOf, thumbFor, thumbStats }
|
||||
|
||||
+23
-1
@@ -1071,6 +1071,28 @@
|
||||
thumbMapCache = map
|
||||
return map
|
||||
}
|
||||
// v3.26.133:图库条目的**唯一**取图口径。
|
||||
// 宫格要的只是 320 的小图,绝不该读 4K 原图(实测 150 次调用平均 11 秒、失败 83)。
|
||||
// ① 有 thumbHash 且盘上有对应 jpg → objectURL
|
||||
// ② 否则按 assets 登记的相对路径,在**原生侧**生成 320 tier(按名字做稳定 hash,落在 thumbs/)
|
||||
async function galleryThumbOfEntry (f, max) {
|
||||
try {
|
||||
if (!enabled() || !dir || !f) return ''
|
||||
const m = Math.max(64, Number(max) || 320)
|
||||
if (f.thumbHash) {
|
||||
const u = await galleryThumbUrl(f.thumbHash)
|
||||
if (u) return u
|
||||
}
|
||||
const key = String(f.origIdb || f.idb || '')
|
||||
const a = key ? assets[key] : null
|
||||
if (!a || !a.f) return ''
|
||||
const abs = await join(dir, a.f)
|
||||
const h16 = await sha16(new TextEncoder().encode('gal:' + String(f.name || a.f)))
|
||||
const r = await makeDisplayThumbFromPath(h16, abs, m)
|
||||
return (r && r.url) || ''
|
||||
} catch (e) { return '' }
|
||||
}
|
||||
|
||||
// v3.26.131:宫格缩略图改发 **objectURL**(同一张只读一次盘、只建一次 URL)。
|
||||
// 原来每张都 base64 成 dataURL(20~40KB 字符串),164 张 ⇒ 每次开面板 3~6MB 字符串 + 164 次 IPC,
|
||||
// 这就是「能加载但很慢」的来源。objectURL 首帧即用,重复打开直接命中。
|
||||
@@ -1564,7 +1586,7 @@
|
||||
enabled, ready: init, flush,
|
||||
// 供其它模块把诊断写进 _boot.log(v3.26.109)
|
||||
logLine: (m) => blog(m),
|
||||
runtime, pickDir, switchTo, migrateTo, deleteImageBytes, deleteGalleryBytesFor, galleryAudit, gcImages, rotateTrash, galleryThumb, galleryThumbUrl, readDisplayThumb, readDisplayThumbUrl, makeDisplayThumb, makeDisplayThumbFromPath, resizeDataUrl, decodeStats, thumbStats, writeDisplayThumb, writeDisplayThumbBlob, pruneThumbs, cleanupLegacy, maintain,
|
||||
runtime, pickDir, switchTo, migrateTo, deleteImageBytes, deleteGalleryBytesFor, galleryAudit, gcImages, rotateTrash, galleryThumb, galleryThumbUrl, galleryThumbOfEntry, readDisplayThumb, readDisplayThumbUrl, makeDisplayThumb, makeDisplayThumbFromPath, resizeDataUrl, decodeStats, thumbStats, writeDisplayThumb, writeDisplayThumbBlob, pruneThumbs, cleanupLegacy, maintain,
|
||||
plugins: { manifest: pluginManifest, read: pluginRead, write: pluginWrite, remove: pluginRemove, dir: pluginDir, listLocal: pluginListLocal, listDirs: pluginListDirs, readFile: pluginReadFile, writeFile: pluginWriteFile, writeBinary: pluginWriteBinary, mkdir: pluginMkdir, removeDir: pluginRemoveDir, renameDir: pluginRenameDir, existsDir: pluginExistsDir },
|
||||
pluginData: { read: pluginDataRead, write: pluginDataWrite, remove: pluginDataRemove, list: pluginDataList },
|
||||
pluginFiles: { put: pluginFilePut, get: pluginFileGet, list: pluginFileList, remove: pluginFileRemove, stat: pluginFileStat, dir: pluginFilesDir, readBytes: pluginFileReadBytes, listAll: pluginFilesListAll },
|
||||
|
||||
Reference in new issue
Block a user