Skip to content

Instantly share code, notes, and snippets.

@mauro3
mauro3 / julia_0.2.1
Last active August 29, 2015 14:02
sparse perf.jl
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
# 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
@mauro3
mauro3 / new_timings
Created June 5, 2014 10:54
Sparse getindex performance
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)