-
Notifications
You must be signed in to change notification settings - Fork 154
Clean up external object references when they are garbage collected, … #88
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
Conversation
…rather than when the context is destroyed.
|
I wish I could give you a more detailed analysis but I'm occupied with another project until at least the end of October 😞 All I can say for now after integrating your change into our fork and then into our project, is that a crucial benchmark test where we execute a script that operates on a large object tree (i.e. many nested objects)[*] more than doubles in execution time (~2.2x). The only change is this one commit. On top of that three of our tests fail when executed in conjunction with said benchmark test, but pass if executed on their own or only with other "pure" engine tests. I didn't have the time to run our whole test suite to see if other tests break, but something is fishy there. Again, sorry for the vague analysis 😞 [*] The script has a lot of back and forth between C# and JavaScript and the object tree is rooted in one global object that gets passed to the context and is set to |
|
Hi Sebastian, thanks for the feedback. I guess that the performance problems relate to the increased complexity in (This pull request has two benefits:
Another cost of this change might be that we no longer cache |
|
The new commit didn't improve the execution time unfortunately (still ~520ms) and we still get random test failures.
For us it's a new instance every time we execute but it's always the same type. To elaborate a bit further how our basic setup looks like: Creating a new
As a test I set the lifetime of our contexts to infinity but that made the execution time even worse (~690ms) and I saw an increase in memory consumption of the test. Though to be fair, the memory measurement isn't exactly accurate and we only use it to make sure nothing explodes from the get go. |
|
Then I guess that the performance problem relates to me getting rid of the I could propose a different fix for my problems (leaking memory) that would just provide a I guess we'll just do something like you do, and recycle our JavascriptContext occasionally. |
…rather than when the context is destroyed.