4 ms·
There are additional tests included in https://arh.antoinevastel.com/javascripts/fpCollect.min.js https://arh.antoinevastel.com/javascripts/fpCollect.min.js tha
by lol768 7y ago
There are additional tests included in https://arh.antoinevastel.com/javascripts/fpCollect.min.js https://arh.antoinevastel.com/javascripts/fpCollect.min.js that do not exist in the GitHub repository over at https://github.com/antoinevastel/fp-collect https://github.com/antoinevastel/fp-collect.
redPill: function() {
for (var e = performance.now(), n = 0, t = 0, r = [], o = performance.now(); o - e < 50; o = performance.now()) r.push(Math.floor(1e6 * Math.random())), r.pop(), n++;
e = performance.now();
for (var a = performance.now(); a - e < 50; a = performance.now()) localStorage.setItem("0", "constant string"), localStorage.removeItem("0"), t++;
return 1e3 * Math.round(t / n)
},
redPill2: function() {
function e(n, t) {
return n < 1e-8 ? t : n < t ? e(t - Math.floor(t / n) * n, n) : n == t ? n : e(t, n)
}
for (var n = performance.now() / 1e3, t = performance.now() / 1e3 - n, r = 0; r < 10; r++) t = e(t, performance.now() / 1e3 - n);
return Math.round(1 / t)
},
redPill3: function() {
var e = void 0;
try {
for (var n = "", t = [Math.abs, Math.acos, Math.asin, Math.atanh, Math.cbrt, Math.exp, Math.random, Math.round, Math.sqrt, isFinite, isNaN, parseFloat, parseInt, JSON.parse], r = 0; r < t.length; r++) {
var o = [],
a = 0,
i = performance.now(),
c = 0,
u = 0;
if (void 0 !== t[r]) {
for (c = 0; c < 1e3 && a < .6; c++) {
for (var d = performance.now(), s = 0; s < 4e3; s++) t[r](3.14);
var m = performance.now();
o.push(Math.round(1e3 * (m - d))), a = m - i
}
var l = o.sort();
u = l[Math.floor(l.length / 2)] / 5
}
n = n + u + ","
}
e = n
} catch (t) {
e = "error"
}
return e
}
};
- jadell 7y agoIt doesn't seem to be using the Javascript. Looking at the page source, it has already made the determination before the Javascript runs. If I load the page source in Chrome, it already includes the "You are not Chrome headless" message, but when I run it in a scraper I maintain, the page source loads with the "You are Chrome headless" message, even without running any Javascript.
- Hitton 7y agoSo it's just measuring computation speed of math calculations? That doesn't sound very reliable.