You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To slow this script down by 30%, remove mutable in front of struct Bypass
mutable struct Bypass{T} content::T end
Base.print(io::IO, x::Bypass) = print(io, x.content)
struct Reprint content::Function end
Base.print(io::IO, t::Reprint) = t.content(io)
function printable()
parts = (Bypass("<span>"), "data", Bypass("</span"))
Reprint() do io::IO
for x in parts
print(io, x)
end
end
end
harness() = begin
io = IOBuffer()
ob = printable()
print(io, ob)
end
using BenchmarkTools
println(@benchmark harness())
Julia Version 1.5.3
Commit 788b2c77c1 (2020-11-09 13:37 UTC)
Platform Info:
OS: Linux (x86_64-pc-linux-gnu)
CPU: Intel(R) Celeron(R) CPU J3455 @ 1.50GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-9.0.1 (ORCJIT, goldmont)