-
Notifications
You must be signed in to change notification settings - Fork 10.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Avoid creating intermediate strings in Util.makeCssRgb(). #5033
Conversation
On one example (the Wuppertal map) this avoids the creation of over 230,000 intermediate strings.
Nice find! Is there a measurable performance difference for that map PDF? |
I tried my spoortkart map pdf:
have a link to the wuppertal map? |
slightly less faster than my dutch map.
|
Good to know. Is there also a difference in memory usage? I can imagine that preventing a lot of strings from being created saves a lot of memory. |
I was unable to detect a peak memory usage improvement because the measurements for this file are really noisy. But it can only be helping. Short strings like these typically take about 16 bytes on 32-bit and 32 bytes on 64-bit, so if we avoid creating 230,000 of them the cumulative reduction in allocations will be something 3.7 or 7.4 MiB. And it results in less stress on the GC, which is always good. |
/botio test |
From: Bot.io (Windows)ReceivedCommand cmd_test from @Snuffleupagus received. Current queue size: 0 Live output at: http://107.22.172.223:8877/a174375fdd12654/output.txt |
From: Bot.io (Linux)ReceivedCommand cmd_test from @Snuffleupagus received. Current queue size: 0 Live output at: http://107.21.233.14:8877/68285979744f50f/output.txt |
From: Bot.io (Linux)SuccessFull output at http://107.21.233.14:8877/68285979744f50f/output.txt Total script time: 36.97 mins
|
The Windows bot also passed the tests, but no message has been posted. Weird. |
Avoid creating intermediate strings in Util.makeCssRgb().
Thank you for the patch! |
On one example (the Wuppertal map) this avoids the creation of over
230,000 intermediate strings.