Nat.drop A.k.a. Nat.- is used a ton in loops and basic math, it deserves its own instruction. Same with truncate.
We also use Refs a lot in cloud, so anything we can do to speed those up is worth it.
old -> new
Take these timings with a grain of salt, some of the improvements are just because a native DropN instruction speeds up repeat which is used in most of the suites
fib1
536.65µs -> 402.953µs
fib2
2.520067ms -> 2.374009ms
fib3
2.843686ms -> 2.767275ms
Decode Nat
411ns -> 375ns
Generate 100 random numbers
245.586µs -> 236.064µs
List.foldLeft
2.217613ms -> 2.195012ms
Count to 1 million
208.6292ms -> 163.9028ms
Json parsing (per document)
255.672µs -> 255.755µs
Count to N (per element)
272ns -> 239ns
Count to 1000
277.643µs -> 243.931µs
Mutate a Ref 1000 times
476.484µs -> 386.742µs
CAS an IO.ref 1000 times
664.23µs -> 525.431µs
List.range (per element)
373ns -> 386ns
List.range 0 1000
396.78µs -> 396.256µs
Set.fromList (range 0 1000)
2.054391ms -> 2.13431ms
Map.fromList (range 0 1000)
1.413585ms -> 1.439508ms
NatMap.fromList (range 0 1000)
6.032778ms -> 5.781756ms
Map.lookup (1k element map)
3.257µs -> 3.503µs
Map.insert (1k element map)
8.233µs -> 8.833µs
List.at (1k element list)
370ns -> 331ns
Text.split /
32.541µs -> 32.432µs
Overview
Nat.drop
A.k.a.Nat.-
is used a ton in loops and basic math, it deserves its own instruction. Same with truncate.We also use
Ref
s a lot in cloud, so anything we can do to speed those up is worth it.old -> new
Take these timings with a grain of salt, some of the improvements are just because a native DropN instruction speeds up
repeat
which is used in most of the suites