Mercurial > repos > public > sbplib_julia
comparison benchmark/benchmarks.jl @ 1171:87bc91def1ff tooling/benchmarks
Start setting things up
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Tue, 24 Jan 2023 21:57:24 +0100 |
parents | |
children | 34446df5733f |
comparison
equal
deleted
inserted
replaced
1170:6f14a88be123 | 1171:87bc91def1ff |
---|---|
1 using BenchmarkTools | |
2 using Random | |
3 | |
4 const SUITE = BenchmarkGroup() | |
5 | |
6 SUITE["utf8"] = BenchmarkGroup(["string", "unicode"]) | |
7 teststr = String(join(rand(MersenneTwister(1), 'a':'d', 10^4))) | |
8 SUITE["utf8"]["replace"] = @benchmarkable replace($teststr, "a" => "b") | |
9 SUITE["utf8"]["join"] = @benchmarkable join($teststr, $teststr) | |
10 SUITE["utf8"]["plots"] = BenchmarkGroup() | |
11 | |
12 SUITE["trigonometry"] = BenchmarkGroup(["math", "triangles"]) | |
13 SUITE["trigonometry"]["circular"] = BenchmarkGroup() | |
14 for f in (sin, cos, tan) | |
15 for x in (0.0, pi) | |
16 SUITE["trigonometry"]["circular"][string(f), x] = @benchmarkable ($f)($x) | |
17 end | |
18 end | |
19 | |
20 SUITE["trigonometry"]["hyperbolic"] = BenchmarkGroup() | |
21 for f in (sin, cos, tan) | |
22 for x in (0.0, pi) | |
23 SUITE["trigonometry"]["hyperbolic"][string(f), x] = @benchmarkable ($f)($x) | |
24 end | |
25 end | |
26 | |
27 SUITE | |
28 | |
29 | |
30 # TODO: Make it easy to run and display results (useful to look at them in a webbrowser? Could serve them using julia) | |
31 # TODO: Make it easy to compare different commits. (A simple script?) | |
32 # TODO: Do we need machanisms to save the results from runs? | |
33 # TBD: How well does BenchmarkTools work for comparisons, do we need make special considerations? | |
34 # TBD: When and how do we want to look at % of peak performance? Is this going to be done using the benchmark suite? | |
35 | |
36 | |
37 # Should set HGPLAIN before script use. Example: `HGPLAIN= hg st` |