Skip to content

Commit

Permalink
fix() rename benchmarks to gas estimation
Browse files Browse the repository at this point in the history
  • Loading branch information
immortal-tofu committed Jan 17, 2024
1 parent 2966b7b commit 920e027
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 21 deletions.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ build: build-tfhe-rs-capi
test: build-tfhe-rs-capi
cd fhevm && go test -v .

.PHONY: benchmarks
benchmarks: build-tfhe-rs-capi
cd fhevm && go test -count=1 -v . -run Benchmarks
.PHONY: gasEstimation
gasEstimation: build-tfhe-rs-capi
cd fhevm && go test -count=1 -v . -run GasEstimation

.PHONY: build-tfhe-rs-capi
build-tfhe-rs-capi:
Expand Down
36 changes: 18 additions & 18 deletions fhevm/benchmarks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,36 +38,36 @@ func runTest(t *testing.T, name string, fn operation, bits string, fheUintType F
convertInGas(t, name+bits, elapsed)
}

func benchTests(t *testing.T, name string, fn operation) {
func estimateTests(t *testing.T, name string, fn operation) {
runTest(t, name, fn, "8", FheUint8)
runTest(t, name, fn, "16", FheUint16)
runTest(t, name, fn, "32", FheUint32)
}

func TestBenchmarks(t *testing.T) {
benchTests(t, "not", func(fheUintType FheUintType) { FheNot(t, fheUintType, false) })
func TestGasEstimation(t *testing.T) {
estimateTests(t, "not", func(fheUintType FheUintType) { FheNot(t, fheUintType, false) })

benchTests(t, "and", func(fheUintType FheUintType) { FheBitAnd(t, fheUintType, false) })
estimateTests(t, "and", func(fheUintType FheUintType) { FheBitAnd(t, fheUintType, false) })

benchTests(t, "eq", func(fheUintType FheUintType) { FheEq(t, fheUintType, false) })
benchTests(t, "ScalarEq", func(fheUintType FheUintType) { FheEq(t, fheUintType, true) })
estimateTests(t, "eq", func(fheUintType FheUintType) { FheEq(t, fheUintType, false) })
estimateTests(t, "ScalarEq", func(fheUintType FheUintType) { FheEq(t, fheUintType, true) })

benchTests(t, "shr", func(fheUintType FheUintType) { FheShr(t, fheUintType, false) })
benchTests(t, "ScalarShr", func(fheUintType FheUintType) { FheShr(t, fheUintType, true) })
estimateTests(t, "shr", func(fheUintType FheUintType) { FheShr(t, fheUintType, false) })
estimateTests(t, "ScalarShr", func(fheUintType FheUintType) { FheShr(t, fheUintType, true) })

benchTests(t, "min", func(fheUintType FheUintType) { FheMin(t, fheUintType, false) })
benchTests(t, "ScalarMin", func(fheUintType FheUintType) { FheMin(t, fheUintType, true) })
estimateTests(t, "min", func(fheUintType FheUintType) { FheMin(t, fheUintType, false) })
estimateTests(t, "ScalarMin", func(fheUintType FheUintType) { FheMin(t, fheUintType, true) })

benchTests(t, "add", func(fheUintType FheUintType) { FheAdd(t, fheUintType, false) })
benchTests(t, "ScalarAdd", func(fheUintType FheUintType) { FheAdd(t, fheUintType, true) })
estimateTests(t, "add", func(fheUintType FheUintType) { FheAdd(t, fheUintType, false) })
estimateTests(t, "ScalarAdd", func(fheUintType FheUintType) { FheAdd(t, fheUintType, true) })

benchTests(t, "sub", func(fheUintType FheUintType) { FheSub(t, fheUintType, false) })
benchTests(t, "ScalarSub", func(fheUintType FheUintType) { FheSub(t, fheUintType, true) })
estimateTests(t, "sub", func(fheUintType FheUintType) { FheSub(t, fheUintType, false) })
estimateTests(t, "ScalarSub", func(fheUintType FheUintType) { FheSub(t, fheUintType, true) })

benchTests(t, "mul", func(fheUintType FheUintType) { FheMul(t, fheUintType, false) })
benchTests(t, "ScalarMul", func(fheUintType FheUintType) { FheMul(t, fheUintType, true) })
estimateTests(t, "mul", func(fheUintType FheUintType) { FheMul(t, fheUintType, false) })
estimateTests(t, "ScalarMul", func(fheUintType FheUintType) { FheMul(t, fheUintType, true) })

benchTests(t, "ScalarDiv", func(fheUintType FheUintType) { FheDiv(t, fheUintType, true) })
estimateTests(t, "ScalarDiv", func(fheUintType FheUintType) { FheDiv(t, fheUintType, true) })

benchTests(t, "IfThenElse", func(fheUintType FheUintType) { FheIfThenElse(t, fheUintType, 1) })
estimateTests(t, "IfThenElse", func(fheUintType FheUintType) { FheIfThenElse(t, fheUintType, 1) })
}

0 comments on commit 920e027

Please sign in to comment.