This file contains 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
NEW | |
m = vs[3]; ===================================== | |
Integer indexing: elapsed time: 0.004826669 seconds (96088 bytes allocated) | |
#### indexing with ranges | |
Whole column-wise indexing: elapsed time: 0.001638723 seconds (6527288 bytes allocated) | |
Column-wise indexing with a range of rows: elapsed time: 0.003093329 seconds (123832 bytes allocated) | |
Whole row-wise indexing: elapsed time: 6.059387827 seconds (32650872 bytes allocated) |
This file contains 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
# Binary and linear search are about equally fast for a haystack of | |
# size ~38 (Array{I<:Integer}). For Array{Float64} it's about size ~15. | |
# For arrays of pointers binsearch probably is always faster. | |
# | |
# For Array(Int} | |
# For n=1 to 9, linear search takes about 50% of binary search | |
# | |
# For n=10 to 20, linear search takes about 75% of binary search | |
# | |
# Now, this chap finds that in C linear search is faster up to array size ~ 64 |
This file contains 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
julia,sparse_getindex_small1,0.451012,0.483519,0.461447,0.012916 | |
julia,sparse_getindex_small2,0.686494,0.718988,0.700459,0.016626 | |
julia,sparse_getindex_medium1,0.783230,0.841894,0.803835,0.022526 | |
julia,sparse_getindex_medium2,1.246590,1.276114,1.262807,0.011405 | |
julia,sparse_getindex_small3,1.742440,9.295122,4.759420,3.807503 | |
julia,sparse_getindex_small4,1.607372,8.230405,2.954001,2.949752 | |
julia,sparse_getindex_small5,1.829975,1.870861,1.846175,0.018316 | |
julia,sparse_getindex_small6,0.632674,0.673803,0.642136,0.017769 | |
julia,sparse_getindex_small7,0.594250,0.604567,0.597951,0.004128 | |
julia,sparse_getindex_small8,0.596583,0.607086,0.598952,0.004554 |
This file contains 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
using Base.Order | |
using Base.SparseMatrix.binarysearch | |
const N = 10^2 | |
const NN = N*10^2 | |
const rowvalA = sort(randperm(NN)[1:N]) | |
const iss = randperm(NN) # disordered needle | |
const iso = [1:NN] # ordered needles | |
function h1(rowvalA, iss) |
This file contains 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
sparse_getindex_small1,Small sparse matrix with 10 entries/column, indexing with integers,0.448931,0.468407,0.454377,0.007985 | |
sparse_getindex_small2,Small sparse matrix with 100 entries/column, indexing with integers,0.651765,0.696139,0.668417,0.016734 | |
sparse_getindex_medium1,Medium sparse matrix with 10 entries/column, indexing with integers,0.795296,0.856736,0.811085,0.025680 | |
sparse_getindex_medium2,Medium sparse matrix with 100 entries/column, indexing with integers,1.253497,1.260646,1.256850,0.003009 | |
sparse_getindex_small3,Sparse matrix with 10 entries/column, indexing rows with a range,1.731063,9.425001,4.829933,3.849493 | |
sparse_getindex_small4,Sparse matrix with 10 entries/column, indexing rows with a ordered array,1.619907,8.389759,2.987851,3.019779 | |
sparse_getindex_small5,Sparse matrix with 10 entries/column, indexing rows with a disordered array,1.837361,1.860880,1.850504,0.009153 | |
sparse_getindex_small6,Sparse matrix with 10 entries/column, indexing rows with a range,0.616219,0.638256,0.621277,0.009504 |
This file contains 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
# This performance regression seems to be fixed now. Maybe one of the many commits of @vtjnash? | |
# | |
# sandbox/performance_regressions>> julia sg.jl # 664cab522c0 | |
# elapsed time: 0.268316893 seconds (14911976 bytes allocated) | |
# elapsed time: 0.267490744 seconds (14837704 bytes allocated) | |
# elapsed time: 0.275272316 seconds (14793688 bytes allocated, 3.10% gc time) | |
# sandbox/performance_regressions>> juliamf sg.jl # around 66cfa99913 | |
# elapsed time: 0.413370651 seconds (14868712 bytes allocated) | |
# elapsed time: 0.41186328 seconds (14828776 bytes allocated) | |
# elapsed time: 0.427139988 seconds (14916648 bytes allocated, 1.98% gc time) |
This file contains 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
n = 200 | |
reps = 10^4 | |
orderedinds = [1:n] | |
disorderedinds = orderedinds[randperm(n)] | |
function frows() | |
acc = 0 | |
inds = disorderedinds | |
for i in rand(1:n, reps) | |
acc += sortperm(inds)[1] |
This file contains 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
module LoremIpsum | |
doc""" | |
LoremIpsum: dolor sit amet, consectetur adipisicing elit, sed do eiusmod | |
tempor incididunt ut labore et dolore magna aliqua. | |
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi | |
ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit | |
in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur | |
sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt | |
mollit anim id est laborum. |
This file contains 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
# How to document functions vs methods? | |
function plot(x::Vector, y::Vector) | |
doc""" | |
Line-plot of x vs y. | |
""" | |
... | |
end | |
function plot(a::Matrix) |
This file contains 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
g6Rib2R5hqhkZXRhY2hlZMOpaGFzaF90eXBlCqNrZXnEIwEg4nED35D0YZDTJsyP7FhhmPVJNpmBvyVfqvBryngYSNUKp3BheWxvYWTFAud7ImJvZHkiOnsia2V5Ijp7ImVsZGVzdF9raWQiOiIwMTIwZTI3MTAzZGY5MGY0NjE5MGQzMjZjYzhmZWM1ODYxOThmNTQ5MzY5OTgxYm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