Repository navigation
Fix Date.now after 2038 on Windows, current GC memory, and speed up Array<Int>.join (#413, #414, #415) - #440
Merged
Merged
Conversation
The Windows path cast the seconds since 1970 to long, which is 32 bits on Windows, x64 included, so after January 2038 Date.now() went back to 1902 (libhxcpp #413). They stay an __int64 until they become a double. DateNowAfter2038 force-includes a GetSystemTime that reports 2040 into the MSVC build; elsewhere it checks the real clock.
GetFreeBlock added a block's free rows to the current rows in use only on its slow path, under the lock. The usual path, taking a block from the free list without it, added nothing, so Gc.memInfo64(MEM_INFO_CURRENT) left out most of what was allocated until the next collection: retaining 2 MB of arrays showed 90 KB more (libhxcpp #414). That path counts the block too, and the count is atomic, as threads take blocks at once.
Joining a typed array made a String for each element, an allocation for every value of more than one digit, and then joined those (libhxcpp the result once and writes them in, as String(int) does. Joining 8,192 integers 200 times takes 41 ms instead of 53 ms, what writing them with std::to_chars takes. IntArrayJoin compares the result with the elements' own strings for several separators, wide ones included, which keep the general path.
dimensionscape
force-pushed
the
fix/date-gcstats-intjoin
branch
from
November 13, 2026 06:09
9431a3e to
f101695
Compare
# Conflicts: # Changes.md
28 of 34 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three runtime fixes for 6.0.0, each with a regression test. They were first written on the
cppia-bugs-1106branch and are picked from there onto current main.Date.now()on Windows passed the seconds since 1970 through along, which is 32 bits there on x64 too, so after January 2038 it went back to 1902. They stay 64 bits until they become a double.DateNowAfter2038force-includes aGetSystemTimethat reports 2040 into the MSVC build, and checks the real clock elsewhere. Fixes Keep Date.now Unix seconds out of 32-bit long on Windows #413.Gc.memInfo64(Gc.MEM_INFO_CURRENT)counted a block's rows only when the block came from the locked slow path. The usual path, a block taken from the free list without the lock, added nothing until the next collection, so retaining 2 MB of arrays showed about 90 KB more. That path counts the block too, and the count is atomic. Fixes Account for reused small blocks in current GC memory statistics #414.Array<Int>made a String for each element and then joined those. With a byte-string separator the digits now go straight into one allocation, asString(int)writes them. A UTF-16 separator keeps the general path. Fixes Avoid per-element temporary string allocation in integer-array joins #415.Measured here (MSVC x64, Haxe 4.3.7, best of 7 rounds of 200 joins of 8,192 integers with
","): 33 to 38 ms on main, 20 ms with this change.IntArrayJoinchecks the result against each element's own string for several separators, wide ones included.DateNowAfter2038andGcCurrentMemoryfail on main and pass with these commits. All three pass here with Haxe 4.3.7.