Skip to content

Commit

Permalink
Faster matlab parseintperf
Browse files Browse the repository at this point in the history
sprintf/sscanf are much faster dec2hex/hex2dec which have lots of input checking.
  • Loading branch information
grinsted authored and bjarthur committed Oct 27, 2015
1 parent 114f109 commit c6300f9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions test/perf/micro/perf.m
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ function timeit(name, func, varargin)
function n = parseintperf(t)
for i = 1:t
n = randi([0,2^32-1],1,'uint32');
s = dec2hex(n);
m = hex2dec(s);
s = sprintf('%08X',n);
m = sscanf(s,'%X');
assert(m == n);
end
end
Expand Down

0 comments on commit c6300f9

Please sign in to comment.