aboutsummaryrefslogtreecommitdiff
path: root/cmd/hlang/nguh
diff options
context:
space:
mode:
authorXe <me@christine.website>2023-01-01 13:11:43 -0500
committerXe <me@christine.website>2023-01-01 13:11:43 -0500
commit88ab7e70b442a45a67e4a9f4f1ee79b0aa622273 (patch)
tree0d821d3dcce14d37ed78679301ff735b35665714 /cmd/hlang/nguh
parent2ab0ff014798d89b1bb6e6e26adc664443fa495c (diff)
downloadx-88ab7e70b442a45a67e4a9f4f1ee79b0aa622273.tar.xz
x-88ab7e70b442a45a67e4a9f4f1ee79b0aa622273.zip
switch to wazero
Signed-off-by: Xe <me@christine.website>
Diffstat (limited to 'cmd/hlang/nguh')
-rw-r--r--cmd/hlang/nguh/compile_test.go19
1 files changed, 15 insertions, 4 deletions
diff --git a/cmd/hlang/nguh/compile_test.go b/cmd/hlang/nguh/compile_test.go
index 2b130f9..698fb7b 100644
--- a/cmd/hlang/nguh/compile_test.go
+++ b/cmd/hlang/nguh/compile_test.go
@@ -1,8 +1,6 @@
package nguh
import (
- "encoding/json"
- "os"
"testing"
"github.com/eaburns/peggy/peg"
@@ -11,10 +9,23 @@ import (
func TestCompile(t *testing.T) {
inp := &peg.Node{Text: "h"}
- result, err := Compile(inp)
+ _, err := Compile(inp)
if err != nil {
t.Fatal(err)
}
+}
+
+func BenchmarkCompile(b *testing.B) {
+ inp := &peg.Node{Kids: []*peg.Node{
+ {Text: "h"},
+ {Text: "h"},
+ {Text: "h"},
+ },
+ }
- json.NewEncoder(os.Stdout).Encode(result)
+ for i := 0; i < b.N; i++ {
+ if _, err := Compile(inp); err != nil {
+ b.Fatal(err)
+ }
+ }
}