(multiplier)
| 152 | } |
| 153 | |
| 154 | function 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 |
| 186 | function perfFindInterlacedInserts(multiplier) { |
no outgoing calls
no test coverage detected
searching dependent graphs…