| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 779ce29 commit 35240ca
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,13 +1,4 @@ | |||
| 1 | 1 | 'use strict'; | |
| 2 | - function min(arr) { | ||
| 3 | - let res = arr[0]; | ||
| 4 | - for (let i = 1; i < arr.length; i++) { | ||
| 5 | - const val = arr[i]; | ||
| 6 | - if (val < res) | ||
| 7 | - res = val; | ||
| 8 | - } | ||
| 9 | - return res; | ||
| 10 | - } | ||
| 11 | 2 | function run_repeated(n, fn) { | |
| 12 | 3 | const res = []; | |
| 13 | 4 | for (let i = 0; i < n; i++) res.push(fn()); | |
@@ -118,11 +109,11 @@ let tester_set_treshold; | |||
| 118 | 109 | ||
| 119 | 110 | // calibrate Set access times for accessing the full bucket / an empty bucket | |
| 120 | 111 | const pos_time = | |
| 121 | - min(run_repeated(10000, time_set_lookup.bind(null, tester_set, | ||
| 122 | - positive_test_value))); | ||
| 112 | + Math.min(...run_repeated(10000, time_set_lookup.bind(null, tester_set, | ||
| 113 | + positive_test_value))); | ||
| 123 | 114 | const neg_time = | |
| 124 | - min(run_repeated(10000, time_set_lookup.bind(null, tester_set, | ||
| 125 | - negative_test_value))); | ||
| 115 | + Math.min(...run_repeated(10000, time_set_lookup.bind(null, tester_set, | ||
| 116 | + negative_test_value))); | ||
| 126 | 117 | tester_set_treshold = (pos_time + neg_time) / 2; | |
| 127 | 118 | // console.log(`pos_time: ${pos_time}, neg_time: ${neg_time},`, | |
| 128 | 119 | // `threshold: ${tester_set_treshold}`); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments