Library: drop @native from once-per-window/frame giants, fewer slow lookups in text helpers
- Begin/End/NewFrame/UpdateMouseInputs back to interpreted: ~520 KB of native code (Begin alone 369 KB, +30% of the bundle's native code) for ~5 us/frame; native code is a game-wide budget in Roblox - GetCurrentWindow(): read g.CurrentWindow once (the key sits in a hash slot >= 256 of the ~300-field context, which Luau's inline cache can't predict, so every read is a slow lookup) - FindRenderedTextEnd(): strings use string.find/string.len directly (no ImMemchr() call, no `#` on a string) - CalcTextSize(): calls CalcTextSizeXY() directly (one wrapper level less); TextEx(): string.len() for strings Draw data unchanged.
This commit is contained in:
1 parent
ca571ee788
commit
54b4fe2b5f
2 files changed
+17
-14
No files matched your search
+1
-1
@@ -99,7 +99,7 @@ function ImGui.TextEx(text, text_end, flags)
|
||||
|
||||
-- Calculate length
|
||||
if text_end == nil then
|
||||
text_end = #text + 1
|
||||
text_end = (type(text) == "string" and string.len(text) or #text) + 1 -- [Luau] `#` on a string isn't a native fast path
|
||||
end
|
||||
|
||||
local dc = window.DC
|
||||
|
||||
Reference in new issue
Block a user