I’ve been unable to get a @nexprs
based solution to be any faster, and it seems a bit silly to pull in a dependency for something like this. Any suggestions?
@@ -30,7 +30,8 @@
for _=1:5
r, i, t = calc_sum(r, i, cr, ci)
end
- all(>(4.0), t) && return 0x00
+ @nexprs 8 k-> t[k] > 4.0 || continue
+ return 0x00
end
else
for _=1:50
Actually, I’m not seeing any difference on my computer from using Baselet.all
either:
--- mandelbrot.julia-7.jl 2020-03-03 15:35:30.625960909 -0500
+++ mandelbrot.julia-7.2.jl 2020-04-17 09:51:39.914201367 -0400
@@ -8,7 +8,7 @@
tweaked for performance by maltezfaria and Adam Beckmeyer
=#
-using Base.Cartesian
+using Base.Cartesian, Baselet
# 0b01111111, 0b10111111, 0b11011111, 0b11101111, etc.
const masks = (0x7f, 0xbf, 0xdf, 0xef, 0xf7, 0xfb, 0xfd, 0xfe)
@@ -30,7 +30,7 @@
for _=1:5
r, i, t = calc_sum(r, i, cr, ci)
end
- all(>(4.0), t) && return 0x00
+ Baselet.all(>(4.0), t) && return 0x00
end
else
for _=1:50
Any thoughts on why you’re seeing a better result? Maybe an AVX2 instruction is being used on your CPU?
julia> using BenchmarkTools
julia> module M7 include("mandelbrot.julia-7.jl") end
Main.M7
julia> module M72 include("mandelbrot.julia-7.2.jl") end
Main.M72
julia> @benchmark M7.mandelbrot($devnull, $16000)
BenchmarkTools.Trial:
memory estimate: 42.73 MiB
allocs estimate: 96031
--------------
minimum time: 1.213 s (0.06% GC)
median time: 1.216 s (0.08% GC)
mean time: 1.218 s (0.34% GC)
maximum time: 1.229 s (1.29% GC)
--------------
samples: 5
evals/sample: 1
julia> @benchmark M72.mandelbrot($devnull, $16000)
BenchmarkTools.Trial:
memory estimate: 42.73 MiB
allocs estimate: 96031
--------------
minimum time: 1.242 s (0.06% GC)
median time: 1.246 s (0.08% GC)
mean time: 1.248 s (0.35% GC)
maximum time: 1.259 s (1.30% GC)
--------------
samples: 5
evals/sample: 1
(@v1) pkg> st
Status `~/.julia/environments/v1/Project.toml`
[9718e550] Baselet v0.1.0
[6e4b80f9] BenchmarkTools v0.5.0
julia> versioninfo()
Julia Version 1.4.1
Commit 381693d3df* (2020-04-14 17:20 UTC)
Platform Info:
OS: Linux (x86_64-unknown-linux-gnu)
CPU: Intel(R) Core(TM) i5-3470 CPU @ 3.20GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-8.0.1 (ORCJIT, ivybridge)
Environment:
JULIA_NUM_THREADS = 4