PL
вычислить интеграл методом трапеции, использовать мемоизацию и показать профит
Size: a a a
PL
KR
ST
Evaluation count : 6940272 in 6 samples of 1156712 calls.
Execution time mean : 78,123236 ns
Execution time std-deviation : 10,839200 ns
Execution time lower quantile : 70,441333 ns ( 2,5%)
Execution time upper quantile : 95,491345 ns (97,5%)
Overhead used : 9,244968 ns
Found 1 outliers in 6 samples (16,6667 %)
low-severe 1 (16,6667 %)
Variance from outliers : 31,8302 % Variance is moderately inflated by outliers
(calculate-area identity 4)
=> 0.0020001249999999997
(do
#?(:clj (in-ns 'user.memoize))
(->> (calculate-area-m identity 4)
#?@(:clj [criterium.core/quick-bench] :cljs [(dotimes [_ 10000]) time (dotimes [_ 10])]))
(println "")
(prn (quote (calculate-area-m identity 4)))
;•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
(calculate-area-m identity 4)
;•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
)
Evaluation count : 1607772 in 6 samples of 267962 calls.
Execution time mean : 351,223183 ns
Execution time std-deviation : 34,214818 ns
Execution time lower quantile : 317,171838 ns ( 2,5%)
Execution time upper quantile : 396,683112 ns (97,5%)
Overhead used : 9,244968 ns
(calculate-area-m identity 4)
=> 0.0020001249999999997
PL
IG
IG
IG
PL
KR
ST
PL
KR
KR
PL
ST
(let [f (memoize (partial calculate function))])KR
KR
ST
(memoize (fn [function x modifier] ...))PL