Created
June 7, 2013 00:43
-
-
Save straypacket/5726280 to your computer and use it in GitHub Desktop.
Short Julia benchmark
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Run with PATH=/Applications/Julia.app/Contents/Resources/julia/bin:/usr/bin:/bin:/usr/sbin:/sbin FONTCONFIG_PATH=/Applications/Julia.app/Contents/Resources/julia/etc/fonts PKG_CONFIG_PATH=/Applications/Julia.app/Contents/Resources/julia/lib/pkgconfig GIT_EXEC_PATH=/Applications/Julia.app/Contents/Resources/julia/libexec/git-core GIT_TEMPLATE_DIR=/Applications/Julia.app/Contents/Resources/julia/share/git-core /Applications/Julia.app/Contents/Resources/julia/bin/julia -p 2 | |
# Typically n > 2000000000 | |
@everywhere function pbench(n) | |
it = time() | |
nheads = @parallel (+) for i=1:n | |
int(randbool()) | |
end | |
ft = time()-it | |
end | |
function lbench(n) | |
it = time() | |
for i=1:n | |
int(randbool()) | |
end | |
ft = time()-it | |
end | |
#julia> lbench(2000000000) | |
#7.217364072799683 | |
# | |
#julia> pbench(2000000000) | |
#3.7432498931884766 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment