Created
July 8, 2021 15:07
-
-
Save dylanahsmith/33d4ea9e93351f8750c0614a83aa0248 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gist title |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ go build main.go | |
$ go test -bench . | |
goos: darwin | |
goarch: amd64 | |
pkg: tmp/v8go/spawnv8bench | |
cpu: Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz | |
BenchmarkNewIsolate-12 574 2011384 ns/op | |
BenchmarkSpawn-12 241 4901969 ns/op |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
func main() { | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main_test | |
import ( | |
"testing" | |
"os/exec" | |
"rogchap.com/v8go" | |
) | |
func BenchmarkNewIsolate(b *testing.B) { | |
for bIdx := 0; bIdx < b.N; bIdx++ { | |
iso, err := v8go.NewIsolate() | |
if err != nil { panic(err) } | |
iso.Dispose() | |
} | |
} | |
func BenchmarkSpawn(b *testing.B) { | |
for i := 0; i < b.N; i++ { | |
cmd := exec.Command("./main") | |
err := cmd.Run() | |
if err != nil { | |
panic(err) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment