-
Notifications
You must be signed in to change notification settings - Fork 130
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
Optimization: add prototype poly inline cache #244
Comments
Thanks for the heads up. Is openwebf/quickjs@079b090 the commit with the memory leak fix, or are there more? |
@bnoordhuis oh, that only has its memory leak bug fix. maybe you should see feat/proto-ic branch. |
@bnoordhuis or openwebf/webf pr: openwebf/webf#341, i recommend that. |
Thanks! I'll try to go over it sometime this week. |
Thanks for the heads up! |
I remember fixing a bunch of memory leaks (JSFunctionDef* was one) when porting the |
@littledivy yes, inclued those bugs fixes. you can set DUMP_LEAK and run test262 to check. |
@bnoordhuis @saghul @littledivy Sync up the progress: For a complex landing page: For a chat room page: Additionally, I conducted a simple test comparing Hemres and the current QuickJS implementation, and the results are as follows: Looking forward to your merge and benchmark. 😄 |
@ammarahm-ed Not conflicting, the replacement of mimalloc is necessary, and it does bring a significant improvement. However, the enhancement from the prototype poly inline cache builds on the foundation of both self poly inline cache and mimalloc replacement, providing an additional improvement of approximately 5-10%. 😄 For projects like webf, with a long inheritance chain in the DOM API, the addition of prototype poly inline cache, on top of self poly inline cache and mimalloc replacement, reduces the overall overhead of DOM API calls. This improvement contributes to the enhanced performance of the first screen. |
@ErosZy That's super amazing! Btw do you guys plan to use this fork instead in future. I do think it would be great for the community if we put all the workforce in the same place and work on a single quickjs fork. Fabrice Bellard has been backporting patches from this fork too into the main one. |
@ammarahm-ed We primarily make modifications in our own repository because our project has its own specific goals. However, we make an effort to synchronize these changes with this repository as much as possible. |
@ammarahm-ed Thank you for your reminder, we build without mimalloc and benchmark again:
|
@ErosZy That's great, do you mind running the benchmark with Hermes too for comparison? I would be surprised if QuickJS is faster than Hermes without mimalloc. |
@ammarahm-ed Yep, but i don't record the benchmark result, In my impression, the difference between the two is not significant(maybe Hermes faster 15-20%), even if Hermes has been optimized to the maximum. If you have time, you can give it a try. 😁 (However, maximum optimization may also sacrifice startup time, and this needs to be considered comprehensively.) |
I think so. Quick visual inspection of the code doesn't show obvious memory leaks (I remember pointing out one or two during the first review round), the (A|M|UB)San buildbots are happy, and so is |
@bnoordhuis any reproducible cases? |
Not sure what you mean. The ones I commented on during review? |
@bnoordhuis I understand that you actually found some memory leaks that cannot be detected even after setting DUMP_LEAK=1, right? If there are such examples, I can see if they can be reproduced and resolved. |
Ah, I think you misunderstand me. There were some memory leaks in the pull request that @littledivy opened. I pointed them out and he fixed them before the PR was merged. That is to say, the quickjs-ng master branch never had those memory leaks. |
@bnoordhuis 😄 I see |
@ammarahm-ed From the results, it appears to be at the level of Hermes' -O0, with around a 35% difference compared to -O optimization. And an interesting phenomenon is that for a 134kb JavaScript code file, QuickJS takes 15ms to parse the code to executable, while Hermes takes 30ms (-O0) and 60ms (-O) respectively. However, this benchmark is relatively simple and can only provide some partial reference.
|
@ErosZy that's great for the amount of people working on QuickJS and such a small size. I am sure there's still room for more performance but still very happy. Mimalloc helps a lot though to get that extra perf. |
@ammarahm-ed Yes! We already have improvement plans regarding the GC, but the implementation is expected to take quite some time. At the same time, there is still plenty of room for bytecode optimization in QuickJS. We can learn relevant backend optimizations from Hermes' LLVH. |
@ErosZy I like the sound of that! But even now i am super happy with the performance. Btw @bnoordhuis was also working on quickjit, a fork with jit for quickjs by using tinycc. QuickJS is a true gem, lots of potential. |
@ErosZy ,Hello, I haven't see any progression on octane when running on x64 linux platform while using ic without mimalloc, do you have the same problem? |
@buddyliao what do you mean? Are you saying that you didn't get any output while running the latest version of quickjs-ng/quickjs on x64 Linux system for the octane benchmark? |
Hey @ErosZy Can you provide the Trying to run a similar benchmark on my machine and I am getting very different results. |
Super cool to see someone experimenting with JITing QJS. TinyCC only supports x86 and is not maintained anymore. I think https://asmjit.com/ would be a great alternative, have you looked into it @bnoordhuis? |
I'm familiar with it but emitting machine code isn't the hard part of an optimizing compiler, code and data analysis is.
It is, just not by Fabrice anymore: https://repo.or.cz/w/tinycc.git |
Forgive my ignorance. It even supports arm now https://github.com/TinyCC/tinycc Fantastic! |
Closing since there is no longer anything actionable here. |
Hi all,
It's openwebf team here. We noticed quickjs-ng/quickjs merge Self Poly Inline Cache from openwebf/quickjs(#116). Previously, there was a memory leak in the Prototype Poly Inline Cache of openwebf/quickjs. However, we fixed this issue yesterday. Currently, both test262 and openwebf's unit and integration tests haven't encountered any related problems.
Based on the benchmark results, significant improvements have been observed in property access operations for heavy objects. The results are as follows:
But we are short-staffed (busy with work 😄), and I noticed there are quite many changes in quickjs-ng/quickjs. Submitting a pull request (PR) might take much time for us. If needed, feel free to merge this feature on your own, or wait a bit until we have time to submit the PR ourselves.
The text was updated successfully, but these errors were encountered: