Skip to content

Commit

Permalink
iterate instead of collect in profile script
Browse files Browse the repository at this point in the history
  • Loading branch information
pfitzseb committed Nov 17, 2021
1 parent 4f91b83 commit 0ca2041
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions test/profile.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Tokenize

nt = @timed @eval(collect(Tokenize.tokenize("foo + bar")))
nt = @timed @eval(collect(Tokenize.tokenize("foo + bar", Tokens.RawToken)))
println("First run took $(nt.time) seconds with $(nt.bytes/1e6) MB allocated")

srcdir = joinpath(Sys.BINDIR, Base.DATAROOTDIR, "..")
Expand All @@ -17,7 +17,7 @@ end
let time_taken = 0.0, allocated = 0.0
for file in allfiles
content = IOBuffer(read(file, String))
nt = @timed collect(Tokenize.tokenize(content, Tokens.RawToken))
nt = @timed for t in Tokenize.tokenize(content, Tokens.RawToken) end
time_taken += nt.time
allocated += nt.bytes
end
Expand All @@ -27,7 +27,7 @@ end
let time_taken = 0.0, allocated = 0.0
for file in allfiles
content = IOBuffer(read(file, String))
nt = @timed collect(Tokenize.tokenize(content, Tokens.RawToken))
nt = @timed for t in Tokenize.tokenize(content, Tokens.RawToken) end
time_taken += nt.time
allocated += nt.bytes
end
Expand Down

0 comments on commit 0ca2041

Please sign in to comment.