MCPcopy Create free account
hub / github.com/techfort/LokiJS / perfFindInterlacedRemoves

Function perfFindInterlacedRemoves

benchmark/benchmark_binary.js:228–255  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

226
227// Find Interlaced Removes -> use linear customid for() loop find() and delete that obj when found
228function perfFindInterlacedRemoves() {
229 var start, end;
230 var totalTimes = [];
231 var totalMS = 0;
232
233 for (var idx = 0; idx < arraySize; idx++) {
234 //var customidx = Math.floor(Math.random() * arraySize) + 1;
235
236 start = process.hrtime();
237 var result = samplecoll.findOne({
238 'customId': idx
239 });
240 // remove document now (outside timing routine) to force index rebuild
241 samplecoll.remove(result);
242
243 end = process.hrtime(start);
244 totalTimes.push(end);
245 }
246
247 for (var idx = 0; idx < totalTimes.length; idx++) {
248 totalMS += totalTimes[idx][0] * 1e3 + totalTimes[idx][1] / 1e6;
249 }
250
251 totalMS = totalMS.toFixed(2);
252 var rate = arraySize * 1000 / totalMS;
253 rate = rate.toFixed(2);
254 console.log("interlaced removes + coll.find() : " + totalMS + "ms (" + rate + " ops/s) " + arraySize + " iterations");
255}
256
257// Find Interlaced Updates -> same as now except mix up customId val (increment by 10000?)
258function perfFindInterlacesUpdates() {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…