1
1
mirror of https://github.com/kanaka/mal.git synced 2024-11-13 01:43:50 +03:00

perf: simplify perf3 iter calc. Enable perf^mal.

Since the iter count increases by 1 each time through the "loop", when
we hit more than 10 seconds elapsed time we can just return the
previous iter count rather than doing a percentage calculation. This
fixes results for basic modes which couldn't do the percent
calculation because itermediate values were greater than 32,768 which
is the limit for basic MODES.

Also, the mal implementation now runs and returns legit results so
re-enable perf^impl.
This commit is contained in:
Joel Martin 2018-07-16 12:24:05 -05:00
parent 6da59ec2f4
commit 5ffa3314f9
2 changed files with 5 additions and 7 deletions

View File

@ -125,8 +125,6 @@ test_EXCLUDES += test^plsql^step5 # too slow for 10,000
test_EXCLUDES += test^powershell^step5 # too slow for 10,000
test_EXCLUDES += $(if $(filter cpp,$(haxe_MODE)),test^haxe^step5,) # cpp finishes 10,000, segfaults at 100,000
perf_EXCLUDES = mal # TODO: fix this
dist_EXCLUDES += mal
# TODO: still need to implement dist
dist_EXCLUDES += guile io julia matlab swift

View File

@ -7,16 +7,16 @@
ret_FIXME))))
(def! run-fn-for*
(fn* [fn max-ms acc-ms iters]
(fn* [fn max-ms acc-ms last-iters]
(let* [start (time-ms)
_ (fn)
elapsed (- (time-ms) start)
new-iters (+ 1 iters)
iters (+ 1 last-iters)
new-acc-ms (+ acc-ms elapsed)]
;(do (prn "here:" new-acc-ms "/" max-ms "iters:" new-iters) )
;(do (prn "new-acc-ms:" new-acc-ms "iters:" iters))
(if (>= new-acc-ms max-ms)
(/ (* max-ms iters) new-acc-ms)
(run-fn-for* fn max-ms new-acc-ms new-iters)))))
iters
(run-fn-for* fn max-ms new-acc-ms iters)))))
(def! run-fn-for
(fn* [fn max-secs]