Skip to content

Commit

Permalink
tweaks & benchmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
rachel-bousfield committed Dec 19, 2023
1 parent ffe7dab commit 8cffdd9
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 49 deletions.
2 changes: 1 addition & 1 deletion arbitrator/prover/test-cases/dynamic.wat
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

;; WAVM Module hash
(data (i32.const 0x0)
"\08\f6\70\9a\1b\e8\6f\84\85\f0\ff\fd\8d\f2\ef\77\74\dc\f5\a5\d7\d0\cb\a1\6b\a3\59\98\09\04\c7\5f") ;; user
"\66\bd\f4\8a\70\5a\41\12\25\3f\77\1c\e0\66\8d\43\74\57\8d\f8\2e\17\dc\7e\8b\6c\98\49\9c\02\55\6d") ;; user

(func $start (local $user i32) (local $internals i32)
;; link in user.wat
Expand Down
60 changes: 18 additions & 42 deletions arbitrator/tools/module_roots/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 1 addition & 4 deletions arbutil/unsafe.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@ func SliceToPointer[T any](slice []T) *T {

// does a defensive copy due to Go's lake of immutable types
func PointerToSlice[T any](pointer *T, length int) []T {
output := make([]T, length)
source := unsafe.Slice(pointer, length)
copy(output, source)
return output
return CopySlice(unsafe.Slice(pointer, length))
}

func CopySlice[T any](slice []T) []T {
Expand Down
5 changes: 4 additions & 1 deletion system_tests/benchmarks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func TestBenchmarkGas(t *testing.T) {
receipt := lambda()
passed := time.Since(now)
ratio := float64(passed.Nanoseconds()) / float64(receipt.GasUsedForL2())
fmt.Printf("Bench %-10v %v %.2f\n", name, formatTime(passed), ratio)
fmt.Printf("Bench %-10v %v %.2f ns/gas\n", name, formatTime(passed), ratio)
}
bench("ecrecover", func() *types.Receipt {
return ensure(programTest.FillBlockRecover(&auth))
Expand All @@ -55,6 +55,9 @@ func TestBenchmarkGas(t *testing.T) {
bench("keccak", func() *types.Receipt {
return ensure(programTest.FillBlockHash(&auth))
})
bench("add", func() *types.Receipt {
return ensure(programTest.FillBlockAdd(&auth))
})
bench("quick step", func() *types.Receipt {
return ensure(programTest.FillBlockQuickStep(&auth))
})
Expand Down

0 comments on commit 8cffdd9

Please sign in to comment.