oxinabox / MagneticReadHead.jl

A cassette-based debugger | The Other Debugger
MIT License
50 stars 6 forks source link

Metaissue: Gotta go fast #27

Closed oxinabox closed 5 years ago

oxinabox commented 5 years ago

Creating this issue to track things relating to going faster.

oxinabox commented 5 years ago

One thing is to switch to cheaper faster less allocating dictionaries for storing variables. See https://github.com/JuliaCollections/OrderedCollections.jl/pull/19

oxinabox commented 5 years ago

Next thing to do, is rework the way breakpoint rule checking works, such that we do not have to call methodof during overdub to decide if we should recurse. Profilng suggests like a ton of the time is being spent there. And it should not be too hard to get rid of that. We can call methodof when setting the breakpoint, but then when deciding if a function+set of args matches, we can just check the list of rules directly against the function and argument types.

oxinabox commented 5 years ago

Maybe we should just stop trying to decide if should instrument. I just tested disabling the check and it is 5x faster. (Disabling the check is a trivial way to avoid the methodof call during overdub)

Original

julia> @btime @iron_debug summer(ones(40))
  18.991 ms (53095 allocations: 2.46 MiB)
40.0

Without checking if should instrument

julia> @btime @iron_debug summer(ones(40))
  3.954 ms (20975 allocations: 876.36 KiB)
40.0
oxinabox commented 5 years ago

I think best would be to strip out this functionality entirely. Then come back to it later with a clean slate, to do it in a way that is fast

oxinabox commented 5 years ago

Ok, I think this is done once

48 is merged.

Significantly faster than Debugger.jl now.

julia> @btime @iron_debug summer($(rand(40)))
  848.750 μs (1433 allocations: 53.23 KiB)
21.860920790624196

julia> @btime @iron_debug summer($(rand(4000)))
  84.938 ms (381315 allocations: 8.75 MiB)
2022.3311980622573

julia> using Debugger
[ Info: Recompiling stale cache file /Users/oxinabox/.julia/compiled/v1.1/Debugger/UDHul.ji for Debugger [3
1a5f54b-26ea-5ae9-a837-f05ce5417438]

julia> @btime @run summer($(rand(40)))
  2.964 ms (22688 allocations: 870.17 KiB)
22.538783720536955

julia> @btime @run summer($(rand(4000)))
  105.515 ms (799985 allocations: 24.55 MiB)
2005.3957224658916
oxinabox commented 5 years ago

@KristofferC @TimHoly do you have any thoughts towards a benchmark suite for debuggers?

It might help know more re: https://github.com/JuliaDebug/JuliaInterpreter.jl/pull/204 than the single pair of tests

timholy commented 5 years ago

Agreed. I haven't given it serious thought, though.