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

Function perfFind

benchmark/benchmark_binary.js:154–183  ·  view source on GitHub ↗
(multiplier)

Source from the content-addressed store, hash-verified

152}
153
154function perfFind(multiplier) {
155 var start, end;
156 var totalTimes = [];
157 var totalMS = 0;
158
159 var loopIterations = arraySize;
160 if (typeof (multiplier) != "undefined") {
161 loopIterations = loopIterations * multiplier;
162 }
163
164 for (var idx = 0; idx < loopIterations; idx++) {
165 var customidx = Math.floor(Math.random() * arraySize) + 1;
166
167 start = process.hrtime();
168 var results = samplecoll.find({
169 'customId': customidx
170 });
171 end = process.hrtime(start);
172 totalTimes.push(end);
173 }
174
175 for (var idx = 0; idx < totalTimes.length; idx++) {
176 totalMS += totalTimes[idx][0] * 1e3 + totalTimes[idx][1] / 1e6;
177 }
178
179 totalMS = totalMS.toFixed(2);
180 var rate = loopIterations * 1000 / totalMS;
181 rate = rate.toFixed(2);
182 console.log("contiguous coll.find() : " + totalMS + "ms (" + rate + " ops/s) " + loopIterations + " iterations");
183}
184
185// Find Interlaced Inserts -> insert 5000, for 5000 more iterations insert same test obj after
186function perfFindInterlacedInserts(multiplier) {

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…