Skip to content

Commit

Permalink
Increase the elapsed time boundary even further, make the performance…
Browse files Browse the repository at this point in the history
… test more robust
  • Loading branch information
Peter Gagarinov committed Apr 19, 2021
1 parent 41ef220 commit 712c4a0
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions test/16_recode.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,18 @@ end
const = isequal

function test_recode_performance(orig_vec, cat2merge_vec)
# the optimized version should take from 20 milliseconds (physical CPU) up to 340 milliseconds
# the optimized version should take from 20 milliseconds (physical CPU) up to 600 milliseconds
# (GitHub actions) while unoptimized version takes > 1 sec
# thus setting MAX_RECODE_TIME_IN_SEC to 0.55 seconds seems robust enough
MAX_RECODE_TIME_IN_SEC = 0.55
recode(orig_vec, cat2merge_vec => "None");
time_elapsed = @elapsed recode(orig_vec, cat2merge_vec => "None");
# thus setting MAX_RECODE_TIME_IN_SEC to 0.7 seconds seems robust enough
MAX_RECODE_TIME_IN_SEC = 0.7
MAX_ATTEMPTS = 4
time_elapsed = Inf
for i_attempt in 1:MAX_ATTEMPTS
cur_time_elapsed = @elapsed recode(orig_vec, cat2merge_vec => "None");
if cur_time_elapsed < time_elapsed
time_elapsed = cur_time_elapsed
end
end
@test time_elapsed <= MAX_RECODE_TIME_IN_SEC;
end

Expand Down

0 comments on commit 712c4a0

Please sign in to comment.