Skip to content

Commit fa42d5b

Browse files
committed
update manual with new Benchmark type pretty printing
1 parent 65f70f2 commit fa42d5b

File tree

1 file changed

+18
-24
lines changed

1 file changed

+18
-24
lines changed

doc/manual.md

Lines changed: 18 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ julia> x = rand(100000);
264264
# For each sample, bind a variable `y` to a fresh copy of `x`. As you
265265
# can see, `y` is accessible within the scope of the core expression.
266266
julia> b = @benchmarkable sort!(y) setup=(y = copy($x))
267-
BenchmarkTools.Benchmark{symbol("##benchmark#7556")}(BenchmarkTools.Parameters(5.0,1000,1,true,false,0.05,0.05))
267+
Benchmark(evals=1, seconds=5.0, samples=10000)
268268

269269
julia> run(b)
270270
BenchmarkTools.Trial:
@@ -544,45 +544,39 @@ suite = BenchmarkGroup()
544544
# for this case is BenchmarkGroup(tags::Vector). These tags are useful for
545545
# filtering benchmarks by topic, which we'll cover in a later section.
546546
suite["utf8"] = BenchmarkGroup(["string", "unicode"])
547-
suite["trigonometry"] = BenchmarkGroup(["math", "triangles"])
547+
suite["trig"] = BenchmarkGroup(["math", "triangles"])
548548

549549
# Add some benchmarks to the "utf8" group
550-
teststr = UTF8String(join(rand(MersenneTwister(1), 'a':'d', 10^4)))
550+
teststr = join(rand(MersenneTwister(1), 'a':'d', 10^4))
551551
suite["utf8"]["replace"] = @benchmarkable replace($teststr, "a", "b")
552552
suite["utf8"]["join"] = @benchmarkable join($teststr, $teststr)
553553

554554
# Add some benchmarks to the "trigonometry" group
555555
for f in (sin, cos, tan)
556556
for x in (0.0, pi)
557-
suite["trigonometry"][string(f), x] = @benchmarkable $(f)($x)
557+
suite["trig"][string(f), x] = @benchmarkable $(f)($x)
558558
end
559559
end
560560
```
561561

562562
Let's look at our newly defined suite in the REPL:
563563

564564
```julia
565-
julia> suite
566-
BenchmarkTools.BenchmarkGroup:
565+
julia> showall(suite)
566+
2-element BenchmarkTools.BenchmarkGroup:
567567
tags: []
568-
"utf8" => BenchmarkGroup(["string", "unicode"])
569-
"trigonometry" => BenchmarkGroup(["math", "triangles"])
570-
571-
julia> suite["utf8"]
572-
BenchmarkTools.BenchmarkGroup:
573-
tags: ["string", "unicode"]
574-
"join" => BenchmarkTools.Benchmark{symbol("##benchmark#7184")}(...)
575-
"replace" => BenchmarkTools.Benchmark{symbol("##benchmark#7165")}(...)
576-
577-
julia> suite["trigonometry"]
578-
BenchmarkTools.BenchmarkGroup:
579-
tags: ["math", "triangles"]
580-
("tan"= 3.1415926535897...) => BenchmarkTools.Benchmark{symbol("##benchmark#7233")}(...)
581-
("cos",0.0) => BenchmarkTools.Benchmark{symbol("##benchmark#7218")}(...)
582-
("cos"= 3.1415926535897...) => BenchmarkTools.Benchmark{symbol("##benchmark#7223")}(...)
583-
("sin"= 3.1415926535897...) => BenchmarkTools.Benchmark{symbol("##benchmark#7209")}(...)
584-
("sin",0.0) => BenchmarkTools.Benchmark{symbol("##benchmark#7201")}(...)
585-
("tan",0.0) => BenchmarkTools.Benchmark{symbol("##benchmark#7228")}(...)
568+
"utf8" => 2-element BenchmarkTools.BenchmarkGroup:
569+
tags: ["string", "unicode"]
570+
"join" => Benchmark(evals=1, seconds=5.0, samples=10000)
571+
"replace" => Benchmark(evals=1, seconds=5.0, samples=10000)
572+
"trig" => 6-element BenchmarkTools.BenchmarkGroup:
573+
tags: ["math", "triangles"]
574+
("cos", 0.0) => Benchmark(evals=1, seconds=5.0, samples=10000)
575+
("sin", π = 3.1415926535897...) => Benchmark(evals=1, seconds=5.0, samples=10000)
576+
("tan", π = 3.1415926535897...) => Benchmark(evals=1, seconds=5.0, samples=10000)
577+
("cos", π = 3.1415926535897...) => Benchmark(evals=1, seconds=5.0, samples=10000)
578+
("sin", 0.0) => Benchmark(evals=1, seconds=5.0, samples=10000)
579+
("tan", 0.0) => Benchmark(evals=1, seconds=5.0, samples=10000)
586580
```
587581

588582
As you might imagine, `BenchmarkGroup` supports a subset of Julia's `Associative` interface. A full list of

0 commit comments

Comments
 (0)