Skip to content

Instantly share code, notes, and snippets.

View tanmaykm's full-sized avatar

Tanmay Mohapatra tanmaykm

  • Bangalore, India
View GitHub Profile
@tanmaykm
tanmaykm / mk_fs.sh
Last active August 29, 2015 14:06
mount loopbacks
for i in $(seq 0 128)
do
echo "creating 10M disk file $i"
dd if=/dev/zero of=disk${i}.fs bs=1024 count=10000
echo "map disk file to device $i"
sudo losetup /dev/loop$i disk${i}.fs
echo "make ext3 filesystem on disk $i"
sudo mkfs -t ext3 -m 1 -v /dev/loop${i}
import tornado.ioloop
import tornado.web
import tornado.escape
import tornado.options
import tornado.httputil
import jinja2
import pyjade.compiler
import coffeescript
import markdown
@tanmaykm
tanmaykm / ufwconfig.sh
Created July 21, 2014 10:11
ufw configuration
sudo ufw status
sudo ufw default deny
sudo ufw logging on
sudo ufw allow 80
sudo ufw allow 22
sudo ufw allow 443
sudo ufw deny out 1:19/tcp
sudo ufw deny out 1:19/udp
@tanmaykm
tanmaykm / after.txt
Created July 1, 2014 09:26
sparse performance tweaks
julia,sparse_getindex_small1,0.395908,0.457661,0.426886,0.022381
julia,sparse_getindex_small2,0.615266,0.654263,0.626535,0.015713
julia,sparse_getindex_small3,0.559614,0.651333,0.595795,0.038266
julia,sparse_getindex_medium1,0.827190,0.965644,0.903645,0.069032
julia,sparse_getindex_medium2,1.243199,1.427433,1.311878,0.073207
julia,sparse_getindex_medium3,1.028508,1.150351,1.091350,0.054557
julia,sparse_getindex_small4,0.130786,0.146640,0.140012,0.007553
julia,sparse_getindex_small5,0.272342,0.345194,0.318204,0.027182
julia,sparse_getindex_small6,2.136647,2.384309,2.234169,0.100068
julia,sparse_getindex_small7,0.179861,0.194767,0.183848,0.006195
@tanmaykm
tanmaykm / getindex_general.jl
Created July 1, 2014 08:49
alternate getindex_general implementation
function getindex_general{Tv,Ti}(A::SparseMatrixCSC{Tv,Ti}, I::AbstractVector, J::AbstractVector)
(m, n) = size(A)
nI = length(I)
nJ = length(J)
colptrA = A.colptr
rowvalA = A.rowval
nzvalA = A.nzval
spI = sortperm(I)
@tanmaykm
tanmaykm / sparse_perf_branch.txt
Created June 14, 2014 04:49
sparse perf compare. PR 7029
julia,sparse_getindex_small1,0.783772,0.903772,0.821649,0.047532
julia,sparse_getindex_small2,0.952574,1.060763,0.995431,0.042001
julia,sparse_getindex_small3,0.932325,1.140048,0.976547,0.091522
julia,sparse_getindex_medium1,1.716383,1.795325,1.742315,0.031646
julia,sparse_getindex_medium2,2.699346,2.863980,2.757332,0.066081
julia,sparse_getindex_medium3,2.353140,2.871318,2.485537,0.217639
julia,sparse_getindex_small4,0.302687,0.322831,0.309290,0.008328
julia,sparse_getindex_small5,0.715107,0.729241,0.721724,0.005082
julia,sparse_getindex_small6,6.449989,7.551028,6.941409,0.536979
julia,sparse_getindex_small7,0.338962,0.363312,0.353507,0.009135
@tanmaykm
tanmaykm / rangesearch.jl
Created June 9, 2014 10:53
Range search compare : PR7162
using Base.Sort.Forward
using Base.Order.DirectOrdering
using Base.SparseMatrix.rangesearch
const N = 10^8
function rs1(rowvalA)
res = 0
@time for i in 1:N
res += rangesearch(rowvalA, i)
@tanmaykm
tanmaykm / compare.jl
Last active August 29, 2015 14:02
Base.SparseMatrix.binarysearch vs Base.Sort.searchsorted
using Base.Sort
using Base.Order
using Base.SparseMatrix.binarysearch
const N = 10^6
function f1(rowvalA)
res = 0
@time for i in 1:N
res += binarysearch(rowvalA, i, 1, N)
t = m = 0
for i in 1:5
S = sparse(rand(10^2, 10^2))
(_,ti,mi) = @timed for I in 1:size(S,1), J in 1:size(S,2)
S[I,J] = I
end
t += ti; m += mi
end
for i in 1:5
S = speye(10^2, 10^2)
@tanmaykm
tanmaykm / results
Last active August 29, 2015 14:02
sort performance
elapsed time: 0.103189028 seconds (0 bytes allocated)
elapsed time: 0.000888531 seconds (0 bytes allocated)
elapsed time: 0.001684563 seconds (0 bytes allocated)
elapsed time: 0.103114518 seconds (0 bytes allocated)
elapsed time: 0.001014195 seconds (0 bytes allocated)
elapsed time: 0.001589316 seconds (0 bytes allocated)
elapsed time: 0.103195119 seconds (0 bytes allocated)
elapsed time: 0.000961692 seconds (0 bytes allocated)
elapsed time: 0.001577562 seconds (0 bytes allocated)