Problem 926. Unique: Speed Enhancement for uint(8,16,32)

Solution 2082056

Submitted on 6 Jan 2020 by William
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Pass

2   Pass
x8=randi(255,1000000,5,'uint8'); x16=randi(2^16,1000000,4,'uint16'); x32=randi(2^32,3000000,1,'uint32'); for i=1:5 % Warmup Calls to get valid timing x8w=unique_fast(x8); end ta=clock; %tic x8u=unique_fast(x8); %toc %tic x16u=unique_fast(x16); %toc %tic x32u=unique_fast(x32); %toc t1=etime(clock,ta)*1000; assert(isequal(x8u,unique(x8))) assert(isequal(x16u,unique(x16))) assert(isequal(x32u,unique(x32))) t2=min(2000,t1); % unique scores 2000 msec feval(@assignin,'caller','score',floor(t2));