ntable = 1e5; ny = 4e6; disp('bechmark lookup') printf('table: %d sorted random numbers\n',ntable) table = sort(rand(1,ntable),'descend'); printf('y: %d random numbers\n',ny) y = rand(1,ny); __handle = @lookup; # function preload disp('y unsorted') tic; idx = lookup(table,y); toc y = sort(y) + 2e-5*rand(size(y)) - 1e-5; disp('y: nearly sorted (with fluctuations)') tic; idx = lookup(table,y); toc y = sort(vec(y)); disp('y: totally sorted') tic; idx = lookup(table,y); toc