I just tested the run times of FLOWobj with so-far's implementation of libtopotoolbox of the single flow algorithm. The new implementation still lags behind MATLAB's image processing toolbox, but we are on a good way. The option 'mex', true, uses a self-written steepest gradient and topological sorting which actually does a quite good job.
DEM = GRIDobj('srtm_bigtujunga30m_utm11.tif');
fun = @() FLOWobj(DEM,'single','uselibtt',true,'mex',false);
timeit(fun)
% Returns: 0.5012 seconds
fun = @() FLOWobj(DEM,'single','uselibtt',true,'mex',true);
timeit(fun)
% Returns: 0.3272 seconds
fun = @() FLOWobj(DEM,'single','uselibtt',false,'mex',false);
timeit(fun)
% Returns: 0.3423 seconds
fun = @() FLOWobj(DEM,'single','uselibtt',false,'mex',true);
timeit(fun)
% Returns: 0.2069 seconds
Why is MATLAB so fast? Looking at imreconstruct, the function behind sink filling, uses IPP, Intel's Integrated Performance Primitives (link) which is probably hard to beat.
I just tested the run times of FLOWobj with so-far's implementation of libtopotoolbox of the single flow algorithm. The new implementation still lags behind MATLAB's image processing toolbox, but we are on a good way. The option 'mex', true, uses a self-written steepest gradient and topological sorting which actually does a quite good job.
Why is MATLAB so fast? Looking at
imreconstruct, the function behind sink filling, uses IPP, Intel's Integrated Performance Primitives (link) which is probably hard to beat.