Skip to content

Instantly share code, notes, and snippets.

@lehins lehins/safe-decimal.md
Last active Jan 24, 2019

Embed
What would you like to do?
Performance of safe-decimal backed by Int64 and Word64

Addition

Name 1 10 100 1000 10000 100000 1000000
Int 6.712 ns 11.81 ns 0.066 μs 0.606 μs 11.19 μs 0.112 ms 1.118 ms
Double 13.95 ns 29.11 ns 0.247 μs 2.272 μs 22.35 μs 0.224 ms 2.233 ms
Integer 46.33 ns 251.5 ns 1.296 μs 12.71 μs 126.4 μs 1.309 ms 19.36 ms
DecimalI64 9.085 ns 19.06 ns 123.7 ns 1.133 μs 12.20 μs 116.2 μs 1.165 ms
DecimalW64 8.505 ns 21.45 ns 133.5 ns 1.221 μs 11.25 μs 118.4 μs 1.167 ms
Rational 178.2 ns 1486 ns 14.29 μs 142.5 μs 1429 μs 14.29 ms 142.2 ms
Scientific 250.5 ns 1709 ns 16.42 μs 163.6 μs 1633 μs 16.30 ms 165.3 ms

Subtraction

Name 1 10 100 1000 10000 100000 1000000
Int 14.00 ns 29.08 ns 0.138 μs 0.713 μs 5.599 μs 0.057 ms 0.571 ms
Double 7.554 ns 28.47 ns 0.256 μs 2.277 μs 22.37 μs 0.223 ms 2.241 ms
Integer 47.35 ns 322.8 ns 2.873 μs 27.22 μs 272.2 μs 2.733 ms 27.42 ms
DecimalI64 17.01 ns 28.25 ns 0.130 μs 0.870 μs 8.696 μs 0.085 ms 0.887 ms
DecimalW64 16.91 ns 28.67 ns 0.133 μs 0.876 μs 8.710 μs 0.084 ms 0.888 ms
Rational 183.6 ns 1519 ns 14.93 μs 144.8 μs 1448 μs 14.52 ms 147.2 ms
Scientific 220.2 ns 1449 ns 13.79 μs 137.9 μs 1394 μs 13.80 ms 138.2 ms
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.