From 0655c6fdd65bb5492b5f7ba7530a4c74a8544709 Mon Sep 17 00:00:00 2001 From: omartelo Date: Sat, 17 Oct 2026 19:46:08 -0300 Subject: [PATCH] fix(native): bump godemirror to v0.7.1 for shared fonts and CJK fallback godemirror's DiffView, one per file card in the Review and in a pull request's Files, built a glyph rasterizer of its own that read the font files again, and asked fontconfig for a fallback once per distinct character the family lacks, two subprocesses inside the frame. v0.7.1 reads font files once per process and tries the fallbacks already loaded first: 50 DiffViews hold about 1 MB of heap where they held 61 MB. Found in a heap profile of a real window (LICH_NATIVE_PPROF): opening one pull request's Files added 70 MB in os.ReadFile under godemirror's glyphs.New. --- CHANGELOG.md | 5 +++++ native/go.mod | 2 +- native/go.sum | 2 ++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f79883db..623e5063 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - **What's new follows a language you switch to.** In the native window, the release notes stayed in the language they were first read in after you changed the interface language, under group names in the new one. +- **Diffs no longer stall on CJK text or pile up memory per file.** In the + native window, a Review or a pull request's Files with Chinese, Japanese or + Korean text could freeze for seconds as each new character was looked up, + and every file's diff kept its own copy of the fonts, so a large pull + request held hundreds of megabytes. ## [0.70.0] - 2026-10-17 diff --git a/native/go.mod b/native/go.mod index 1f77a618..a3add5d6 100644 --- a/native/go.mod +++ b/native/go.mod @@ -9,7 +9,7 @@ require ( github.com/creack/pty v1.1.24 github.com/go-text/typesetting v0.3.5 github.com/godbus/dbus/v5 v5.2.2 - github.com/lichdotdev/godemirror v0.7.0 + github.com/lichdotdev/godemirror v0.7.1 golang.org/x/exp/shiny v0.0.0-20261009195045-ca0d7ba23607 golang.org/x/image v0.47.0 golang.org/x/sys v0.49.0 diff --git a/native/go.sum b/native/go.sum index 5a6d1c88..49253ab2 100644 --- a/native/go.sum +++ b/native/go.sum @@ -29,6 +29,8 @@ github.com/lichdotdev/gio v0.0.0-20261015151446-c609b88c89a0 h1:0WfWaBTv58oF2piq github.com/lichdotdev/gio v0.0.0-20261015151446-c609b88c89a0/go.mod h1:x8MAOooc/v4UUaB5o6BS/FpYdxnzh3LBvZlTBmYpnlQ= github.com/lichdotdev/godemirror v0.7.0 h1:bTJh1WOzuoTgtMFvzSPyo/44upkTXAc0dwRTzeWyE/c= github.com/lichdotdev/godemirror v0.7.0/go.mod h1:xCdFPbos7+4/bCymJIx7FnL4EpsuMpebRCbGM5Un4fg= +github.com/lichdotdev/godemirror v0.7.1 h1:Y8KXCDhR7SleP8qOdZ6EwbHJ2Vk7I4Fq+wFcVY6Lso0= +github.com/lichdotdev/godemirror v0.7.1/go.mod h1:xCdFPbos7+4/bCymJIx7FnL4EpsuMpebRCbGM5Un4fg= github.com/yuin/goldmark v1.4.13 h1:fVcFKWvrslecOb/tg+Cc05dkeYx540o0FuFt3nUVDoE= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= golang.org/x/exp v0.0.0-20250408133849-7e4ce0ab07d0 h1:R84qjqJb5nVJMxqWYb3np9L5ZsaDtB+a39EqjV0JSUM=