Skip to content

Commit

Permalink
[YDB#685][#341] Use CPU time instead of elapsed time for timing/gtm91…
Browse files Browse the repository at this point in the history
…15 and r130/ydb485 tests

This commit addresses test failures in the performance comparison section of the timing/gtm9115 and r130/ydb485 tests by switching them to use 2 seconds of CPU time instead of 2 seconds of elapsed time. It also treats anything above 90% of the previous implementation as a pass for the 14 digit %HO comparison because the new implementation, which is usually slightly above 100% of the previous implementation's performance, came in at 94.72% once in internal testing out of 100 runs using CPU time.
  • Loading branch information
bradwesthafer committed Feb 1, 2021
1 parent 449172c commit 798e571
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 52 deletions.
36 changes: 18 additions & 18 deletions r130/inref/zconvert.m
Original file line number Diff line number Diff line change
Expand Up @@ -192,23 +192,23 @@
; Expected behavior: current version has higher number of computations than the previous version.
compdectohex
write "Comparing performance of current %DH implementation vs previous %DH implementation for 16 digit values",!
set interval=2000000
set iend=$zut+interval
set interval=200
set iend=$zgetjpi(0,"CPUTIM")+interval
set istart=1
set ncnt=1
set seed=21474836 ; hard coded as this is a performance test
for do quit:iend<istart
. set istart=$zut
. set istart=$zgetjpi(0,"CPUTIM")
. set ncnt=$increment(ncnt)
. quit:iend<istart
. set i=$random(seed)_$random(seed)
. set k=$$FUNC^%DH(i,)
; checking previous m implementation
set iend=$zut+interval
set iend=$zgetjpi(0,"CPUTIM")+interval
set istart=1
set ocnt=1
for do quit:iend<istart
. set istart=$zut
. set istart=$zgetjpi(0,"CPUTIM")
. set ocnt=$increment(ocnt)
. quit:iend<istart
. set i=$random(seed)_$random(seed)
Expand All @@ -217,24 +217,24 @@
if (ncnt<ocnt) write "FAILED as performance is less than previous implementation ","new count:",ncnt," ","previous count:",ocnt," ",!
;
write "Comparing performance of current %DH implementation vs previous %DH implementation for 20 digit values",!
set iend=$zut+interval
set iend=$zgetjpi(0,"CPUTIM")+interval
set istart=1
set ncnt=1
; seed and seed2 hardcoded as this is a performance test
set seed=1844674407
set seed2=3709551615
for do quit:iend<istart
. set istart=$zut
. set istart=$zgetjpi(0,"CPUTIM")
. set ncnt=$increment(ncnt)
. quit:iend<istart
. set i=$random(seed)_$random(seed2)
. set k=$$FUNC^%DH(i,)
; checking previous m implementation
set iend=$zut+interval
set iend=$zgetjpi(0,"CPUTIM")+interval
set istart=1
set ocnt=1
for do quit:iend<istart
. set istart=$zut
. set istart=$zgetjpi(0,"CPUTIM")
. set ocnt=$increment(ocnt)
. quit:iend<istart
. set i=$random(seed)_$random(seed2)
Expand All @@ -251,23 +251,23 @@
; Expected behavior: current version has higher number of computations than the previous version.
comphextodec
write "Comparing performance of current %HD implementation vs previous %HD implementation with 14 digits",!
set interval=2000000
set iend=$zut+interval
set interval=200
set iend=$zgetjpi(0,"CPUTIM")+interval
set istart=1
set ncnt=1
set seed=2147483 ; hard coded as this is a performance test
for do quit:iend<istart
. set istart=$zut
. set istart=$zgetjpi(0,"CPUTIM")
. set ncnt=$increment(ncnt)
. quit:iend<istart
. set i=$random(seed)_$random(seed)
. set k=$$FUNC^%HD(i)
; starting previous m implementation
set iend=$zut+interval
set iend=$zgetjpi(0,"CPUTIM")+interval
set istart=1
set ocnt=1
for do quit:iend<istart
. set istart=$zut
. set istart=$zgetjpi(0,"CPUTIM")
. set ocnt=$increment(ocnt)
. quit:iend<istart
. set i=$random(seed)_$random(seed)
Expand All @@ -276,22 +276,22 @@
write:(ncnt<ocnt) "FAILED as performance is less than previous implementation ","new count:",ncnt," ","previous count:",ocnt," ",!
;
write "Comparing performance of current %HD implementation vs previous %HD implementation 16 digits",!
set iend=$zut+interval
set iend=$zgetjpi(0,"CPUTIM")+interval
set istart=1
set ncnt=1
set seed=21474836 ; hard coded as this is a performance test
for do quit:iend<istart
. set istart=$zut
. set istart=$zgetjpi(0,"CPUTIM")
. set ncnt=$increment(ncnt)
. quit:iend<istart
. set i=$random(seed)_$random(seed)
. set k=$$FUNC^%HD(i)
; starting previous m implementation
set iend=$zut+interval
set iend=$zgetjpi(0,"CPUTIM")+interval
set istart=1
set ocnt=1
for do quit:iend<istart
. set istart=$zut
. set istart=$zgetjpi(0,"CPUTIM")
. set ocnt=$increment(ocnt)
. quit:iend<istart
. set i=$random(seed)_$random(seed)
Expand Down
68 changes: 34 additions & 34 deletions timing/inref/gtm9115.m
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,22 @@
; is faster. 16 digit and 20 digit inputs are used because they use different code paths in both versions of $DO.
compdectooct
write "Comparing performance of current %DO implementation vs previous %DO implementation for 16 digit values",!
set interval=2000000
set iend=$zut+interval
set interval=200
set iend=$zgetjpi(0,"CPUTIM")+interval
set istart=1
set ncnt=1
for do quit:iend<istart
. set istart=$zut
. set istart=$zgetjpi(0,"CPUTIM")
. set ncnt=$increment(ncnt)
. quit:iend<istart
. set i=$$getrandnumdecexactlen(16)
. set k=$$FUNC^%DO(i,16)
; checking previous m implementation
set iend=$zut+interval
set iend=$zgetjpi(0,"CPUTIM")+interval
set istart=1
set ocnt=1
for do quit:iend<istart
. set istart=$zut
. set istart=$zgetjpi(0,"CPUTIM")
. set ocnt=$increment(ocnt)
. quit:iend<istart
. set i=$$getrandnumdecexactlen(16)
Expand All @@ -43,21 +43,21 @@
if (ncnt<ocnt) write "FAILED as performance is less than previous implementation ","new count:",ncnt," ","previous count:",ocnt," ",!
;
write "Comparing performance of current %DO implementation vs previous %DO implementation for 20 digit values",!
set iend=$zut+interval
set iend=$zgetjpi(0,"CPUTIM")+interval
set istart=1
set ncnt=1
for do quit:iend<istart
. set istart=$zut
. set istart=$zgetjpi(0,"CPUTIM")
. set ncnt=$increment(ncnt)
. quit:iend<istart
. set i=$$getrandnumdecexactlen(20)
. set k=$$FUNC^%DO(i,16)
; checking previous m implementation
set iend=$zut+interval
set iend=$zgetjpi(0,"CPUTIM")+interval
set istart=1
set ocnt=1
for do quit:iend<istart
. set istart=$zut
. set istart=$zgetjpi(0,"CPUTIM")
. set ocnt=$increment(ocnt)
. quit:iend<istart
. set i=$$getrandnumdecexactlen(20)
Expand All @@ -75,22 +75,22 @@
; larger inputs.
compocttodec
write "Comparing performance of current %OD implementation vs previous %OD im plementation for 20 digit values",!
set interval=2000000
set iend=$zut+interval
set interval=200
set iend=$zgetjpi(0,"CPUTIM")+interval
set istart=1
set ncnt=1
for do quit:iend<istart
. set istart=$zut
. set istart=$zgetjpi(0,"CPUTIM")
. set ncnt=$increment(ncnt)
. quit:iend<istart
. set i=$$getrandnumoctexactlen(20)
. set k=$$FUNC^%OD(i)
; checking previous m implementation
set iend=$zut+interval
set iend=$zgetjpi(0,"CPUTIM")+interval
set istart=1
set ocnt=1
for do quit:iend<istart
. set istart=$zut
. set istart=$zgetjpi(0,"CPUTIM")
. set ocnt=$increment(ocnt)
. quit:iend<istart
. set i=$$getrandnumoctexactlen(20)
Expand All @@ -105,48 +105,48 @@
; 2 second loop keeping track of the number of conversions done and this is compared to verify that the current
; implementation is faster. 14 digit and 16 digit inputs are used because they use different code paths in both versions of $HO.
; Since the 14 digit implementation runs virtually identical code and occasionally performs slightly worse than the old, it is
; compared to 95% of the old implementation's performance.
; compared to 90% of the old implementation's performance.
comphextooct
write "Comparing performance of current %HO implementation vs previous %HO implementation for 14 digit values",!
set interval=2000000
set iend=$zut+interval
set interval=200
set iend=$zgetjpi(0,"CPUTIM")+interval
set istart=1
set ncnt=1
for do quit:iend<istart
. set istart=$zut
. set istart=$zgetjpi(0,"CPUTIM")
. set ncnt=$increment(ncnt)
. quit:iend<istart
. set i=$$getrandnumhexexactlen(14)
. set k=$$FUNC^%HO(i)
; starting previous m implementation
set iend=$zut+interval
set iend=$zgetjpi(0,"CPUTIM")+interval
set istart=1
set ocnt=1
for do quit:iend<istart
. set istart=$zut
. set istart=$zgetjpi(0,"CPUTIM")
. set ocnt=$increment(ocnt)
. quit:iend<istart
. set i=$$getrandnumhexexactlen(14)
. set k=$$FUNCPREVHEXTOOCT(i)
write "Performance: current ",ncnt," ","previous ",ocnt,!
write:(ncnt<(ocnt*0.95)) "FAILED as performance is less than 95% of previous implementation ","new count:",ncnt," ","previous count:",ocnt," ",!
write:(ncnt<(ocnt*0.9)) "FAILED as performance is less than 90% of previous implementation ","new count:",ncnt," ","previous count:",ocnt," ",!
;
write "Comparing performance of current %HO implementation vs previous %HO implementation for 16 digit values",!
set iend=$zut+interval
set iend=$zgetjpi(0,"CPUTIM")+interval
set istart=1
set ncnt=1
for do quit:iend<istart
. set istart=$zut
. set istart=$zgetjpi(0,"CPUTIM")
. set ncnt=$increment(ncnt)
. quit:iend<istart
. set i=$$getrandnumhexexactlen(16)
. set k=$$FUNC^%HO(i)
; starting previous m implementation
set iend=$zut+interval
set iend=$zgetjpi(0,"CPUTIM")+interval
set istart=1
set ocnt=1
for do quit:iend<istart
. set istart=$zut
. set istart=$zgetjpi(0,"CPUTIM")
. set ocnt=$increment(ocnt)
. quit:iend<istart
. set i=$$getrandnumhexexactlen(16)
Expand All @@ -162,22 +162,22 @@
; implementation is faster. 16 digit and 20 digit inputs are used because they use different code paths in both versions of $OH.
compocttohex
write "Comparing performance of current %OH implementation vs previous %OH implementation for 16 digit values",!
set interval=2000000
set iend=$zut+interval
set interval=200
set iend=$zgetjpi(0,"CPUTIM")+interval
set istart=1
set ncnt=1
for do quit:iend<istart
. set istart=$zut
. set istart=$zgetjpi(0,"CPUTIM")
. set ncnt=$increment(ncnt)
. quit:iend<istart
. set i=$$getrandnumoctexactlen(16)
. set k=$$FUNC^%OH(i)
; starting previous m implementation
set iend=$zut+interval
set iend=$zgetjpi(0,"CPUTIM")+interval
set istart=1
set ocnt=1
for do quit:iend<istart
. set istart=$zut
. set istart=$zgetjpi(0,"CPUTIM")
. set ocnt=$increment(ocnt)
. quit:iend<istart
. set i=$$getrandnumoctexactlen(16)
Expand All @@ -186,21 +186,21 @@
write:(ncnt<ocnt) "FAILED as performance is less than previous implementation ","new count:",ncnt," ","previous count:",ocnt," ",!
;
write "Comparing performance of current %OH implementation vs previous %OH implementation for 20 digit values",!
set iend=$zut+interval
set iend=$zgetjpi(0,"CPUTIM")+interval
set istart=1
set ncnt=1
for do quit:iend<istart
. set istart=$zut
. set istart=$zgetjpi(0,"CPUTIM")
. set ncnt=$increment(ncnt)
. quit:iend<istart
. set i=$$getrandnumoctexactlen(20)
. set k=$$FUNC^%OH(i)
; starting previous m implementation
set iend=$zut+interval
set iend=$zgetjpi(0,"CPUTIM")+interval
set istart=1
set ocnt=1
for do quit:iend<istart
. set istart=$zut
. set istart=$zgetjpi(0,"CPUTIM")
. set ocnt=$increment(ocnt)
. quit:iend<istart
. set i=$$getrandnumoctexactlen(20)
Expand Down

0 comments on commit 798e571

Please sign in to comment.