Header menu logo ananoid

Performance: Select Highlights

While ananoid is more concerned with correctness and ergonomics, it nevertheless trie to maintain good performance. To that end, the repository includes a project which benchmarks several different aspects of the library, via the excellent Benchmark.NET library. As with all performance assessments, the results should be taken with a grain of salt, and are not necessarily indicative of every possible situation wherein ananoid might be used. Consumers should always profile their own use cases, and not rely solely on the results presented here. That being said, what follows are some important highlights.

Highlight: Ananoid vs NanoidNet vs Guid

Perhaps the most intersting results are those comparing ananoid to the popular NanoidNet library (and to the built-in Guid type, as a baseline). Each candidate is invoked numerous times, using its respective default settings, to track the general throughput, memory usage, and other relevant metrics.

Method

Mean

Error

StdDev

Ratio

RatioSD

Gen0

Allocated

Alloc Ratio

Guid

63.66 ns

0.478 ns

0.424 ns

1.00

0.01

0.0102

96 B

1.00

NanoidNet

125.05 ns

2.032 ns

1.586 ns

1.96

0.03

0.0212

200 B

2.08

Ananoid

86.77 ns

0.361 ns

0.320 ns

1.36

0.01

0.0136

128 B

1.33

Highlight: Structs vs Functions

Ananoid is designed to have both a low-level API, working in terms of primitives. And a high-level API, wherein everything is driven by bespoke types. It is important to note how the high-level API improves correctness with only minimal performance overhead, as shown in the following comparison of the two approaches.

Method

Mean

Error

StdDev

Ratio

Gen0

Allocated

Alloc Ratio

Function

89.31 ns

0.504 ns

0.447 ns

1.00

0.0136

128 B

1.00

Struct

87.22 ns

0.461 ns

0.409 ns

0.98

0.0136

128 B

1.00

Interpreting Statistics

The above tables include a number of different metrics, which make use of the following terms:

System Setup

The benchmarks were run under the following specifications:

Further Reading

Copyright

The library is available under the Mozilla Public License, Version 2.0. For more information see the project's License file.

Type something to start searching.