Skip to content

The method time(::PrettyChairmarks.PrettyBenchmark) does not exist but is used in the show function #5

@ajinkya-k

Description

@ajinkya-k

Hello!

When working on #4 I kept running into the following error:

ERROR: MethodError: no method matching time(::PrettyChairmarks.PrettyBenchmark)
The function `time` exists, but no method is defined for this combination of argument types.

Closest candidates are:
  time()
   @ Base libc.jl:285
  time(::Base.Libc.TmStruct)
   @ Base libc.jl:278

This is triggered when the show is called on a PrettyBenchmark object. Here's a minimal working example:

julia> bb = @bs rand(1000)
Chairmarks.Benchmark: 1 sample with 1 evaluation.
 Single result which took 875.000 ns (0.00% GC) to evaluate,
 with a memory estimate of 7.94 KiB, over 3 allocations.

julia> show(bb)
ERROR: MethodError: no method matching time(::PrettyChairmarks.PrettyBenchmark)
The function `time` exists, but no method is defined for this combination of argument types.

Closest candidates are:
  time()
   @ Base libc.jl:285
  time(::Base.Libc.TmStruct)
   @ Base libc.jl:278

Stacktrace:
 [1] summary(io::Base.TTY, t::PrettyChairmarks.PrettyBenchmark)
   @ PrettyChairmarks ~/projects/julia_repos/PrettyChairmarks.jl/src/PrettyChairmarks.jl:102
 [2] _show(io::Base.TTY, t::PrettyChairmarks.PrettyBenchmark)
   @ PrettyChairmarks ~/projects/julia_repos/PrettyChairmarks.jl/src/PrettyChairmarks.jl:106
 [3] show(io::Base.TTY, t::PrettyChairmarks.PrettyBenchmark)
   @ PrettyChairmarks ~/projects/julia_repos/PrettyChairmarks.jl/src/PrettyChairmarks.jl:111
 [4] show(x::PrettyChairmarks.PrettyBenchmark)
   @ Base ./show.jl:479
 [5] top-level scope
   @ ~/projects/julia_repos/testngdir/testchairmarks.jl:12

julia> bb = @bs rand(1000)
Chairmarks.Benchmark: 16358 samples with 3 evaluations.
 Range (min  max):  541.667 ns  128.500 μs  ┊ GC (min  max): 0.00%  98.10%
 Time  (median):     736.333 ns               ┊ GC (median):    0.00%
 Time  (mean ± σ):     1.020 μs ±   4.317 μs  ┊ GC (mean ± σ):  0.28% ±  5.20%

  ▇  ▁▆  █▁                                                      
  █▅▂███▅██▆▅▄▃▃▃▂▂▂▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ ▂
  542 ns           Histogram: frequency by time         2.47 μs <

 Memory estimate: 7.94 KiB, allocs estimate: 3.

julia> show(bb)
ERROR: MethodError: no method matching time(::PrettyChairmarks.PrettyBenchmark)
The function `time` exists, but no method is defined for this combination of argument types.

Closest candidates are:
  time()
   @ Base libc.jl:285
  time(::Base.Libc.TmStruct)
   @ Base libc.jl:278

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions