-
Notifications
You must be signed in to change notification settings - Fork 677
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
Add realloc function to jmem #2998
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@LaszloLango, the pull request was opened by mmatyas, but the patch was supplied by me. I don't really know where do you get the assumption that it didn't have any gain back then, but it doesn't matter. There are several builtins that are bottlenecked by ecma_concat_strings: String.replace, Array.join, JSON.stringify just to name a few. These produce exponentially worse runtimes with larger inputs, due to how ecma_concat_strings copies the string data. Coincidentally, these are also the builtins methods that are not very well tested by sunspider, or at least by the few tests we were running at the time, so these issues don't show up, but they are there. If we take a look at the v8 benchmarks, we see the same trend, among other things, but I'd rather not get into the details. Going a bit further, there are engine internals that could be improved, for example ecma_collections, and regexp bytecode reallocation. There are also plans for optimizing Arrays. Overall, I believe this to be sufficient to justify this change. |
@dbatyai thanks for clarifying this for me. I don't know when I will have time to review it in details, but I don't want to block this PR. If any reviewer gives a second approval then it could be merged. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
This patch extends jmem functionality by adding a realloc function. This opens up other paths of optimization which can result in smaller peak memory usage and faster execution times, due to not having to duplicate memory when we need to extend blocks. JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai [email protected]
This patch extends jmem functionality by adding a realloc function.
This opens up other paths of optimization which can result in smaller
peak memory usage and faster execution times, due to not having to
duplicate memory when we need to extend blocks.