MCPcopy
hub / github.com/parse-community/parse-server / benchmarkSimpleQuery

Function benchmarkSimpleQuery

benchmark/performance.js:387–412  ·  view source on GitHub ↗

* Benchmark: Simple Query

(name)

Source from the content-addressed store, hash-verified

385 * Benchmark: Simple Query
386 */
387async function benchmarkSimpleQuery(name) {
388 // Setup: Create test data
389 const TestObject = Parse.Object.extend('BenchmarkTest');
390 const objects = [];
391
392 for (let i = 0; i < 100; i++) {
393 const obj = new TestObject();
394 obj.set('category', i % 10);
395 obj.set('value', i);
396 objects.push(obj);
397 }
398
399 await Parse.Object.saveAll(objects);
400
401 let counter = 0;
402
403 return measureOperation({
404 name,
405 iterations: 1_000,
406 operation: async () => {
407 const query = new Parse.Query('BenchmarkTest');
408 query.equalTo('category', counter++ % 10);
409 await query.find();
410 },
411 });
412}
413
414/**
415 * Benchmark: Batch Save (saveAll)

Callers

nothing calls this directly

Calls 2

measureOperationFunction · 0.85
findMethod · 0.65

Tested by

no test coverage detected