-
Notifications
You must be signed in to change notification settings - Fork 3
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
Remove nif #10
Remove nif #10
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's interesting. Is this because of JIT or some other changes in the beam?
Lots of optimisations in binary matching, as well as type-based optimisations that allow the JIT to generate much better code. This algorithm is so so simple that the cost of calling a NIF makes a difference against the run of the actual NIF too 😄 |
According to benchee, for this commit: Operating System: macOS CPU Information: Apple M3 Pro Number of Available Cores: 12 Available memory: 36 GB Elixir 1.17.0-rc.0 Erlang 27.0 JIT enabled: true Benchmark suite executing with the following configuration: warmup: 2 s time: 5 s memory time: 5 s reduction time: 0 ns parallel: 1 inputs: uuid Estimated total run time: 24 s Benchmarking new with input uuid ... Benchmarking old with input uuid ... Calculating statistics... Formatting results... Name ips average deviation median 99th % new 3.96 M 252.38 ns ±6313.75% 250 ns 375 ns old 1.46 M 684.58 ns ±2412.42% 625 ns 875 ns Comparison: new 3.96 M old 1.46 M - 2.71x slower +432.20 ns Memory usage statistics: Name Memory usage new 0.148 KB old 3.54 KB - 23.84x memory usage +3.39 KB According to this and the previous commit, that is, these optimisations against master with nifs: Name ips average deviation median 99th % new 4.04 M 0.25 μs ±4922.09% 0.21 μs 0.38 μs old 0.60 M 1.66 μs ±514.31% 1.63 μs 2.08 μs Comparison: new 4.04 M old 0.60 M - 6.69x slower +1.41 μs Memory usage statistics: Name Memory usage new 152 B old 408 B - 2.68x memory usage +256 B
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #10 +/- ##
==========================================
+ Coverage 84.09% 85.10% +1.01%
==========================================
Files 1 1
Lines 88 94 +6
==========================================
+ Hits 74 80 +6
Misses 14 14 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good job
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's run tests on amd64 before merging it.
Results in a x86 Linux machine are satisfactory: OTP 26
And OTP 27:
|
🙂
For the record, it is also faster in OTP26:
On a RaspberryPi equivalent: