MCPcopy Index your code
hub / github.com/techfort/LokiJS / perfFindInterlacesUpdates

Function perfFindInterlacesUpdates

benchmark/benchmark_binary.js:258–285  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

256
257// Find Interlaced Updates -> same as now except mix up customId val (increment by 10000?)
258function perfFindInterlacesUpdates() {
259 var start, end;
260 var totalTimes = [];
261 var totalMS = 0;
262
263 for (var idx = 0; idx < arraySize; idx++) {
264 //var customidx = Math.floor(Math.random() * arraySize) + 1;
265
266 start = process.hrtime();
267 var results = samplecoll.find({
268 'customId': idx
269 });
270 // just call update on document to force index rebuild
271 samplecoll.update(results[0]);
272
273 end = process.hrtime(start);
274 totalTimes.push(end);
275 }
276
277 for (var idx = 0; idx < totalTimes.length; idx++) {
278 totalMS += totalTimes[idx][0] * 1e3 + totalTimes[idx][1] / 1e6;
279 }
280
281 totalMS = totalMS.toFixed(2);
282 var rate = arraySize * 1000 / totalMS;
283 rate = rate.toFixed(2);
284 console.log("interlaced updates + coll.find() : " + totalMS + "ms (" + rate + " ops/s) " + arraySize + " iterations");
285}
286
287console.log("");
288console.log("Perf: Unindexed Inserts---------------------");

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…