Closed JoeKays closed 3 years ago
My bad, wrong repository :(
Can someone move this?
I'll reply here anyway: The performance problem of nimCopy is known and will dispappear once the JS codegen understands that it too can benefit from --gc:orc
... PRs are most welcome, I can guide you through Nim's internals. Maybe join our Discord channel.
Thank you for the quick reply! I'll try to fix it and create a PR. In the meantime I will leave this open...
Closing, this was a mistake, the performance issue has nothing to do with the return value.
Hi,
I'm just took nim for a spin for the first time and noticed that the way it handles return values in generated javascript seems to cause a massive performance hit (at least inside nimCopy proc).
For this test I created a vector class:
and overloaded the + operator (nim fixes js's lack, that's so awesome!):
When I run a naive performance test like this:
I have ~10-100x higher runtime than necessary. By simple changing the generated nimCopy function's return handling I achieve near plain-js performance: Instead of doing:
simply returning everywhere without the extra variable is way more performant:
Now I wonder if this is a problem with the generated js return in general or only in nimCopy proc?
Joe