-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Optimize @, fixes #25063 #25064
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
base: devel
Are you sure you want to change the base?
Optimize @, fixes #25063 #25064
Conversation
toml_serialization failure unrelated, and I can't reproduce it locally, and can't tell what's the problem. @arnetheduck maybe you could have a look? |
#25066 |
Rest of failures unrelated too, I think |
I hate this shit. Just make the compiler emit copyMem for for loops instead of patching every single copy loop ever written. |
ugh please no.. this is actually entirely solvable in library code - the problem is mainly that too much happens in the compiler already that is of poor quality and hard to address, and taking this shortcut means that you no longer can build custom data structures that benefit from the same optimizations. The right way here which would be extensible is to have primitives in the language and library that can be reused and remove many of the compiler magics (like see also https://github.com/status-im/nim-stew/blob/35f935d0997724d3c61f57ab9fd0992e6f114f7f/stew/assign2.nim - ie this little snippet gets rid of most of bad performance in nim codegen - the biggest problem with it is that the compiler sneaks in calls to the compiler-generated The ideal scenario would be that assignment becomes pluggable the way assign2 works, and then we can implement library functions that call This is also why we want |
Library code is a lot easier to reason about than compiler code. If anything, I'd prefer to reduce the number of compiler magics/builtins, by moving them out to lib. @Araq if you're concerned with this copying pattern recurring too much, we could just introduce a lib function to reuse it (e.g. |
the other big slowdown factor is that nim inserts range changes even for cases where this is not needed - ie There are plenty of these little nuggets that could be solved easily if we moved implementations out from the compiler and into the library, as they are much more easy to reason about there. |
Range check elimination is also a complex compiler analysis, you don't get simplicity out of moving these things to libraries (how would that even work anyway for range checks elimination). |
Maybe something like |
of course you do: you just disable it explicitly in your |
No description provided.