The Wayback Machine - https://web.archive.org/web/20250929135811/https://github.com/nim-lang/Nim/pull/14417
Skip to content

Conversation

mratsim
Copy link
Collaborator

@mratsim mratsim commented May 21, 2020

none shows up as a bottleneck in benchmark :/

I'm not going to turn this into another blog post like #9514 but this takes 45s to raytrace in C++ and the Nim code is almost equivalent besides choosing to use Option return values.

For example the none function in the benchmark below

image

Ideally this is a small enough change to be backported in 1.2.2 because we do use Option in Nimbus.

Furthermore the values are quite huge to wrap/unwrap (256-bit hash) so inline should help significantly.

@Araq
Copy link
Member

Araq commented May 21, 2020

I prefer explict {.inline.} on the procs you need to be inline. Also, lent annotations might help.

@mratsim
Copy link
Collaborator Author

mratsim commented May 21, 2020

lent doesn't seem to work at compile-time.

The tests have a lot of

../../lib/pure/options.nim(171, 3) Error: limited VM support for 'addr'
@Araq Araq merged commit f71f8b0 into nim-lang:devel May 21, 2020
narimiran pushed a commit that referenced this pull request Jun 1, 2020
* The whole options module should be inline

* Use inline per proc and tag `lent` where appropriate

* Remove lent annotation (failing at compiletime)

(cherry picked from commit f71f8b0)
EchoPouet pushed a commit to EchoPouet/Nim that referenced this pull request Jun 13, 2020
…1.2]

* The whole options module should be inline

* Use inline per proc and tag `lent` where appropriate

* Remove lent annotation (failing at compiletime)
@arnetheduck
Copy link
Contributor

@mratsim did you try to simply add -flto to the compiler flags?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants