Skip to content

Commit

Permalink
fix benchmark (#89)
Browse files Browse the repository at this point in the history
  • Loading branch information
tprifti authored Dec 6, 2023
1 parent b6373b0 commit ce25461
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions _bench/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"fmt"
"log"
"log/slog"
"os"
"runtime"
Expand All @@ -13,7 +14,10 @@ import (

func makeRemoteEngine(addr string) *actor.Engine {
r := remote.New(remote.Config{ListenAddr: addr})
e := actor.NewEngine(actor.EngineOptRemote(r))
e, err := actor.NewEngine(actor.EngineOptRemote(r))
if err != nil {
log.Fatal(err)
}
return e
}

Expand All @@ -37,7 +41,10 @@ func benchmarkRemote() {
}

func benchmarkLocal() {
e := actor.NewEngine()
e, err := actor.NewEngine()
if err != nil {
log.Fatal(err)
}
pid := e.SpawnFunc(func(c *actor.Context) {}, "bench", actor.WithInboxSize(1024*8), actor.WithMaxRestarts(0))
its := []int{
1_000_000,
Expand All @@ -58,6 +65,10 @@ func main() {
slog.Error("GOMAXPROCS must be greater than 1")
os.Exit(1)
}
lh := slog.New(slog.NewTextHandler(os.Stdout, &slog.HandlerOptions{
Level: slog.LevelError,
}))
slog.SetDefault(lh)
benchmarkLocal()
benchmarkRemote()
}

0 comments on commit ce25461

Please sign in to comment.