Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
caching vs no cachink ye
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36
Browser:
Chrome 126
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
no chace
281081.4 Ops/sec
with cache
170673.9 Ops/sec
Script Preparation code:
var objectString = { "reportActions_1234": { action: "view", timestamp: "2024-07-17T10:15:30Z", user: "JohnDoe" }, "reportActions_5678": { action: "edit", timestamp: "2024-07-17T11:20:45Z", user: "JaneSmith" }, "reportActions_91011": { action: "delete", timestamp: "2024-07-17T12:25:50Z", user: "AlexJohnson" }, "reportActions_1213": { action: "create", timestamp: "2024-07-17T13:30:55Z", user: "EmilyBrown" }, "reportActions_1415": { action: "share", timestamp: "2024-07-17T14:35:00Z", user: "ChrisDavis" }, "reportActions_1235": { action: "view", timestamp: "2024-07-17T10:15:30Z", user: "JohnDoe" }, "reportActions_5679": { action: "edit", timestamp: "2024-07-17T11:20:45Z", user: "JaneSmith" }, "reportActions_91021": { action: "delete", timestamp: "2024-07-17T12:25:50Z", user: "AlexJohnson" }, "reportActions_1214": { action: "create", timestamp: "2024-07-17T13:30:55Z", user: "EmilyBrown" }, "reportActions_1416": { action: "share", timestamp: "2024-07-17T14:35:00Z", user: "ChrisDavis" }, "report_1234": { action: "view", timestamp: "2024-07-17T10:15:30Z", user: "JohnDoe" }, "report_5678": { action: "edit", timestamp: "2024-07-17T11:20:45Z", user: "JaneSmith" }, "report_91011": { action: "delete", timestamp: "2024-07-17T12:25:50Z", user: "AlexJohnson" }, "report_1213": { action: "create", timestamp: "2024-07-17T13:30:55Z", user: "EmilyBrown" }, "report_1415": { action: "share", timestamp: "2024-07-17T14:35:00Z", user: "ChrisDavis" }, "report_1235": { action: "view", timestamp: "2024-07-17T10:15:30Z", user: "JohnDoe" }, "report_5679": { action: "edit", timestamp: "2024-07-17T11:20:45Z", user: "JaneSmith" }, "report_91021": { action: "delete", timestamp: "2024-07-17T12:25:50Z", user: "AlexJohnson" }, "report_1214": { action: "create", timestamp: "2024-07-17T13:30:55Z", user: "EmilyBrown" }, "report_1416": { action: "share", timestamp: "2024-07-17T14:35:00Z", user: "ChrisDavis" } }; var reportActionIds = [ "1234", "5678", "91011", "1213", "1415", "1235", "5679", "91021", "1214", "1416" ]; var reportIds = [ "1234", "5678", "91011", "1213", "1415", "1235", "5679", "91021", "1214", "1416" ];
Tests:
no chace
function getString(collection, id) { return `${collection}${id}`; } for (let i of reportActionIds) { objectString[getString("reportActions_", i)]; } for (let i of reportIds) { objectString[getString("report_", i)]; } for (let i of reportActionIds) { objectString[getString("reportActions_", i)]; } for (let i of reportIds) { objectString[getString("report_", i)]; }
with cache
const cache = {}; function getString(collection, id) { if (!cache[collection]) { cache[collection] = {}; } if (cache[collection][id]) { return cache[collection][id]; } cache[collection][id] = `${collection}${id}`; return cache[collection][id]; } for (let i of reportActionIds) { objectString[getString("reportActions_", i)]; } for (let i of reportIds) { objectString[getString("report_", i)]; } for (let i of reportActionIds) { objectString[getString("reportActions_", i)]; } for (let i of reportIds) { objectString[getString("report_", i)]; }