Update benchmark for vinculum support

This commit is contained in:
2024-10-27 00:20:25 -04:00
parent 3e38327aa4
commit 6148897d85
2 changed files with 14 additions and 3 deletions
+6 -2
View File
@@ -11,14 +11,18 @@ If you need any additional functionality or further documentation, please see th
### Benchmark Results ### 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 ```sh
goos: linux goos: linux
goarch: amd64 goarch: amd64
pkg: github.com/rwinkhart/convertroman pkg: github.com/rwinkhart/convertroman
cpu: AMD Ryzen 9 3900X 12-Core Processor 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 PASS
ok github.com/rwinkhart/convertroman 1.827s ok github.com/rwinkhart/convertroman 4.098s
``` ```
### Example ### Example
+8 -1
View File
@@ -45,6 +45,13 @@ func TestFromInt(t *testing.T) {
func BenchmarkFromInt(b *testing.B) { func BenchmarkFromInt(b *testing.B) {
b.ReportAllocs() b.ReportAllocs()
for i := 0; i < b.N; i++ { 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)
} }
} }