; ; AC 2024-Feb-27 ; ; more systematics tests on loops ; showing the serious/critical issue on OSX ... ; ; ----------------- REPEAT ------ ; pro TEST_LOOP_REPEAT, nbp=nbp if ~KEYWORD_SET(nbp) then nbp=100000L ; a=0L TIC ; repeat begin a=a+1L endrep until A GT nbp ; TOC ; end ; ; ----------------- WHILE ------ ; pro TEST_LOOP_WHILE, nbp=nbp ; if ~KEYWORD_SET(nbp) then nbp=100000L ; a=0L ; TIC ; While (a LT nbp) do begin a=a+1L endwhile ; TOC ; end ; ; ----------------- FOR ------ ; pro TEST_LOOP_FOR, nbp=nbp ; if ~KEYWORD_SET(nbp) then nbp=100000L ; a=0L ; TIC ; for ii=0, nbp do begin a=a+1L endfor ; TOC ; end ; ; ----------------- FOREACH ------ ; pro TEST_LOOP_FOREACH, nbp=nbp ; if ~KEYWORD_SET(nbp) then nbp=100000L ; a=LINDGEN(nbp) ; TIC ; foreach elem, a do begin a[elem]=0 endforeach ; if TOTAL(a) GT 0 then MESSAGE, 'pb here' ; TOC ; end ; ; ----------------- call all of them ------ ; pro TEST_LOOPS, nbp=nbp ; if ~KEYWORD_SET(nbp) then nbp=100000L ; TEST_LOOP_REPEAT, nbp=nbp TEST_LOOP_WHILE, nbp=nbp TEST_LOOP_FOR, nbp=nbp TEST_LOOP_FOREACH, nbp=nbp ; end