mirror of
https://github.com/rwinkhart/convertroman.git
synced 2026-08-28 04:46:32 -04:00
Update benchmark for vinculum support
This commit is contained in:
@@ -11,14 +11,18 @@ If you need any additional functionality or further documentation, please see th
|
||||
|
||||
### Benchmark Results
|
||||
|
||||
Note that the benchmark results of this fork are slower than upstream due to the added vinculum notation support.
|
||||
This benchmark tests the highest supported integer (3,999,999) while upstream tests with 3,999.
|
||||
|
||||
```sh
|
||||
goos: linux
|
||||
goarch: amd64
|
||||
pkg: github.com/rwinkhart/convertroman
|
||||
cpu: AMD Ryzen 9 3900X 12-Core Processor
|
||||
BenchmarkFromInt-24 61993154 20.82 ns/op 0 B/op 0 allocs/op
|
||||
BenchmarkFromInt-24 5372720 237.0 ns/op 24 B/op 1 allocs/op
|
||||
BenchmarkFromIntCapital-24 2117424 570.9 ns/op 64 B/op 3 allocs/op
|
||||
PASS
|
||||
ok github.com/rwinkhart/convertroman 1.827s
|
||||
ok github.com/rwinkhart/convertroman 4.098s
|
||||
```
|
||||
|
||||
### Example
|
||||
|
||||
@@ -45,6 +45,13 @@ func TestFromInt(t *testing.T) {
|
||||
func BenchmarkFromInt(b *testing.B) {
|
||||
b.ReportAllocs()
|
||||
for i := 0; i < b.N; i++ {
|
||||
_ = FromInt(3999)
|
||||
_ = FromInt(3999999)
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkFromIntCapital(b *testing.B) {
|
||||
b.ReportAllocs()
|
||||
for i := 0; i < b.N; i++ {
|
||||
_ = FromIntCapital(3999999)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user