wendou-chen/dsh-render-perf ↗★ 0

@dsh-external/dsh-render-perf

运行时注入公式渲染缓存与视口外渲染跳过 用于提升公式渲染性能。适合公式密集型任务,免重启热加载且零侵入。

套件
@dsh-external/dsh-render-perf
相容性
待驗證
版本
0.1.0
授權
MIT
最近更新
2026年9月16日

安裝

此插件尚未提供可驗證的 bundle,或相容性檢查未通過。請先閱讀倉庫說明。 閱讀完整 README ↗

📦 安装与使用指南

方式一:使用 DSH 超级注入器(推荐 · 免重启热加载)

若您的 DSH 已经装载了 dsh-super-injector,可直接在终端或 Agent 中一键免重启热注入:


### 方式一:使用 DSH 超级注入器(推荐 · 免重启热加载)

若您的 DSH 已经装载了 `dsh-super-injector`,可直接在终端或 Agent 中一键免重启热注入:

```powershell

### 方式二:手动配置 Profile 装配(冷启动方式)

1. 在 `~/.dsh/profiles/web/package.json`(或 `desktop` Profile)的 `dependencies` 中添加软链接:

   ```json
   {
     "dependencies": {
       "@dsh-external/dsh-render-perf": "link:D:/dsh-render-perf"
     },
     "dsh": {
       "bundles": [
         "@dsh-external/dsh-render-perf"
       ]
     }
   }
  1. 在对应 Profile 的 node_modules/ 下建立软链接(Windows Junction):

    cmd /c mklink /J "C:\Users\\.dsh\profiles\web\node_modules\@dsh-external\dsh-render-perf" "D:\dsh-render-perf"
    
  2. 启动或重启 DSH 服务即可生效。

⚙️ 配置项说明

字段类型默认说明
enabledbooleantrue总开关,关闭时插件不注册任何路由与样式
distDirstring''手动指定 dsh-web-frontend/dist 目录;留空自动探测(进程入口推导 / 模块解析 / 常见全局路径)
mode'element' | 'html'element补丁形态,见下

关于 html 模式(实测负优化,默认不启用)

html 模式把每个公式的子树交给 dangerouslySetInnerHTML,理论上省掉上百个 React 元素对象。实测反而更慢:

模式热切回主线程长任务
element(默认)455 ~ 601 ms
html699 ~ 774 ms

原因:数百次独立 innerHTML 赋值各自的解析与样式失效开销,超过了 React 批量建 DOM 的成本。该模式保留在代码中供不同 DSH 版本对比验证,默认不启用。