Skip to content

Commit deacb09

Browse files
remove @timer
1 parent 5805181 commit deacb09

File tree

2 files changed

+7
-35
lines changed

2 files changed

+7
-35
lines changed

src/rewriters.jl

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ rewriters.
3030
3131
"""
3232
module Rewriters
33-
using SymbolicUtils: @timer
3433
using TermInterface
3534

3635
import SymbolicUtils: iscall, operation, arguments, sorted_arguments, metadata, node_count, _promote_symtype
@@ -69,7 +68,7 @@ Chain(rws) = Chain(rws, false)
6968

7069
function (rw::Chain)(x)
7170
for f in rw.rws
72-
y = @timer cached_repr(f) f(x)
71+
y = f(x)
7372
if rw.stop_on_match && !isnothing(y) && !isequal(y, x)
7473
return y
7574
end
@@ -91,7 +90,7 @@ instrument(c::RestartedChain, f) = RestartedChain(map(x->instrument(x,f), c.rws)
9190

9291
function (rw::RestartedChain)(x)
9392
for f in rw.rws
94-
y = @timer cached_repr(f) f(x)
93+
y = f(x)
9594
if y !== nothing
9695
return Chain(rw.rws)(y)
9796
end
@@ -103,7 +102,7 @@ end
103102
quote
104103
Base.@nexprs $N i->begin
105104
let f = rw.rws[i]
106-
y = @timer cached_repr(repr(f)) f(x)
105+
y = f(x)
107106
if y !== nothing
108107
return Chain(rw.rws)(y)
109108
end
@@ -122,11 +121,11 @@ instrument(x::Fixpoint, f) = Fixpoint(instrument(x.rw, f))
122121

123122
function (rw::Fixpoint)(x)
124123
f = rw.rw
125-
y = @timer cached_repr(f) f(x)
124+
y = f(x)
126125
while x !== y && !isequal(x, y)
127126
y === nothing && return x
128127
x = y
129-
y = @timer cached_repr(f) f(x)
128+
y = f(x)
130129
end
131130
return x
132131
end
@@ -150,15 +149,15 @@ instrument(x::FixpointNoCycle, f) = Fixpoint(instrument(x.rw, f))
150149
function (rw::FixpointNoCycle)(x)
151150
f = rw.rw
152151
push!(rw.hist, hash(x))
153-
y = @timer cached_repr(f) f(x)
152+
y = f(x)
154153
while x !== y && hash(x) rw.hist
155154
if y === nothing
156155
empty!(rw.hist)
157156
return x
158157
end
159158
push!(rw.hist, y)
160159
x = y
161-
y = @timer cached_repr(f) f(x)
160+
y = f(x)
162161
end
163162
empty!(rw.hist)
164163
return x

src/utils.jl

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,3 @@
1-
const TIMER_OUTPUTS = true
2-
const being_timed = Ref{Bool}(false)
3-
4-
if TIMER_OUTPUTS
5-
using TimerOutputs
6-
7-
macro timer(name, expr)
8-
:(if being_timed[]
9-
@timeit $(esc(name)) $(esc(expr))
10-
else
11-
$(esc(expr))
12-
end)
13-
end
14-
15-
macro iftimer(expr)
16-
esc(expr)
17-
end
18-
19-
else
20-
macro timer(name, expr)
21-
esc(expr)
22-
end
23-
24-
macro iftimer(expr)
25-
end
26-
end
27-
281
using Base: ImmutableDict
292

303

0 commit comments

Comments
 (0)