Skip to content

Free, open-source 3D sculpting for Linux, macOS and Windows: dense meshes, remeshing, painting, built-in AI (image/text to 3D), Send to Unreal, game-ready LODs, Gaussian splats and OpenUSD.

i18n_coverage: line numbers counted on from the last token, not from the file's start each time (quadratic: 7 s locally, ~15 s on the PC against the 20 s budget; now 1.3 s, same output)

islandmedc7b5df338a67
diff --git a/tools/i18n/coverage.py b/tools/i18n/coverage.py
index 97935fc6..d333efba 100644
--- a/tools/i18n/coverage.py
+++ b/tools/i18n/coverage.py
@@ -132,9 +132,11 @@ def unescape(s):
def tokens(text):
"""(kind, value, line): kind is 'str' (adjacent literals and ICON_LC_* macros joined), 'id' or 'p'."""
out = []
+ line, at = 1, 0 # counted on from the last token (from the file's start each time was quadratic: 15 s on the PC)
for m in TOKEN.finditer(text):
t = m.group(0)
- line = text.count("\n", 0, m.start()) + 1
+ line += text.count("\n", at, m.start())
+ at = m.start()
if t.startswith("//") or t.startswith("/*"):
continue
if m.group(2) is not None or m.group(3) is not None: