Closed Enet4 closed 6 years ago
The current code in git is correct for julia-0.7; this PR would revert it back for julia-0.6. It was a call to hex
in the python code perf.py that inadvertantly got swept up in a global hex -> string replace meant for Julia, not the other way around.
function parseintperf07(t) # what's currently in git, works on julia-0.7
local n, m
for i=1:t
n = rand(UInt32)
s = string(n, base = 16)
m = UInt32(parse(Int64, s, base = 16))
@assert m == n
end
return n
end
function parseintperf06(t) # the proposed PR, works on 0.6, shows deprecation on 0.7
local n, m
for i=1:t
n = rand(UInt32)
s = hex(n)
m = UInt32(parse(Int64, s, 16 ))
@assert m == n
end
return n
end
julia-0.7-beta2.45
julia> parseintperf07(1000)
0x4a89aabf
julia> parseintperf06(1000)
┌ Warning: `hex(n)` is deprecated, use `string(n, base=16)` instead.
│ caller = parseintperf06(::Int64) at parseintperf.jl:16
└ @ Main ~/scratch/julia/parseintperf.jl:16
┌ Warning: `parse(T::Type{<:Integer}, s, base)` is deprecated, use `parse(T, s, base=base)` instead.
│ caller = parseintperf06(::Int64) at parseintperf.jl:17
└ @ Main ~/scratch/julia/parseintperf.jl:17
0x599d7969
julia> versioninfo()
Julia Version 0.7.0-beta2.45
Commit 91c2da8acb (2018-07-19 07:13 UTC)
Platform Info:
OS: Linux (x86_64-suse-linux)
CPU: Intel(R) Core(TM) i5-6300U CPU @ 2.40GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-6.0.0 (ORCJIT, skylake)
It would probably be worthwhile to make the microbenchmarks were 0.6/0.7 compatible. There are a few differences in
using
mean
and std
moving to Statistics package hex
and string
I think that might be it. I haven't used Compat.jl
yet, but it can't be too complicated. There are no performance hits with compatibility, right?
Compat is pretty straightforward: basically, write code for 0.7 and sprinkle @compat
calls where necessary to make it work on 0.6. No performance issues in general. I would also be surprised about much in the microbenchmarks being different between the versions.
Fixes #21