nickel icon indicating copy to clipboard operation
nickel copied to clipboard

[Performance] Use primop for the most basic contracts

Open yannham opened this issue 1 year ago • 2 comments

This is an experimentation that uses primops instead of the most basic contracts (number, booleans, strings and dyn) to see if that makes a difference, performance-wise, rather than have them defined in Nickel. Although they aren't very costly, they should be called a lot, which thus could make a difference.

yannham avatar Aug 05 '24 13:08 yannham

It seems to show a consistent 2.5% perf improvement on the private bench, both small and big (~4sec eval and ~20sec eval). While it's not nothing, I don't know if it's worth the ad-hoc implementation right now, given that there should be much more meaningful gain by either reducing the memory footprint of Term or by having a first step toward a bytecode VM (let's say, a flattened AST).

yannham avatar Aug 05 '24 14:08 yannham

🐰Bencher

ReportMon, August 5, 2024 at 14:04:29 UTC
Projectnickel
Branch2021/merge
Testbedubuntu-latest

⚠️ WARNING: The following Measure does not have a Threshold. Without a Threshold, no Alerts will ever be generated!

  • Latency (latency)

Click here to create a new Threshold
For more information, see the Threshold documentation.
To only post results if a Threshold exists, set the --ci-only-thresholds CLI flag.

Click to view all benchmark results
BenchmarkLatencyLatency Results
nanoseconds (ns)
fibonacci 10➖ (view plot)498,560.00
pidigits 100➖ (view plot)3,206,800.00
product 30➖ (view plot)793,380.00
scalar 10➖ (view plot)1,475,400.00
sum 30➖ (view plot)792,550.00

Bencher - Continuous Benchmarking
View Public Perf Page
Docs | Repo | Chat | Help

github-actions[bot] avatar Aug 05 '24 14:08 github-actions[bot]

Given the limited improvement, I'm closing this experiment.

yannham avatar Sep 09 '24 11:09 yannham