This commit introduces a comprehensive performance audit of the Enchantrix codebase, culminating in the creation of the `AUDIT-PERFORMANCE.md` report. The audit includes: - An analysis of the `trix` CLI's memory usage and single-threaded nature. - An evaluation of the project's build and deploy performance. - The addition of benchmarks for the `trix`, `crypt`, and `enchantrix` packages to establish a performance baseline. In addition, this commit addresses feedback from the code review by: - Removing binary artifacts (`.prof`, `.test`) from the commit. - Updating the `.gitignore` file to prevent these artifacts from being committed in the future. Co-authored-by: Snider <631881+Snider@users.noreply.github.com>
29 lines
432 B
Go
29 lines
432 B
Go
package crypt
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
var service = NewService()
|
|
|
|
func BenchmarkHash(b *testing.B) {
|
|
payload := "hello, world"
|
|
b.ReportAllocs()
|
|
b.ResetTimer()
|
|
|
|
for i := 0; i < b.N; i++ {
|
|
service.Hash(SHA256, payload)
|
|
}
|
|
}
|
|
|
|
func BenchmarkGenerateRSAKeyPair(b *testing.B) {
|
|
b.ReportAllocs()
|
|
b.ResetTimer()
|
|
|
|
for i := 0; i < b.N; i++ {
|
|
_, _, err := service.GenerateRSAKeyPair(2048)
|
|
if err != nil {
|
|
b.Fatal(err)
|
|
}
|
|
}
|
|
}
|