-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ensure_time: use UTC directly, drop regex for timezone to speedup; ad…
…d benchmark (#55)
- Loading branch information
Showing
2 changed files
with
35 additions
and
11 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package ds_test | ||
|
||
import ( | ||
"embed" | ||
"os" | ||
"os/exec" | ||
"testing" | ||
) | ||
|
||
//go:embed time.lua | ||
var timeLua embed.FS | ||
|
||
func Benchmark_lua_ensure_time(b *testing.B) { | ||
f, _ := os.CreateTemp("/tmp", "") | ||
bytes, _ := timeLua.ReadFile("time.lua") | ||
f.Write(bytes) | ||
// write from embed.FS to file | ||
for i := 0; i < b.N; i++ { | ||
cmd := exec.Command("lua", f.Name()) | ||
//cmd.Stdout = os.Stdout | ||
//cmd.Stderr = os.Stdout | ||
err := cmd.Run() | ||
if err != nil { | ||
b.Fatal(err) | ||
} | ||
} | ||
} |