MCPcopy Index your code
hub / github.com/parse-community/parse-server / benchmarkObjectRead

Function benchmarkObjectRead

benchmark/performance.js:328–351  ·  view source on GitHub ↗

* Benchmark: Object Read (by ID)

(name)

Source from the content-addressed store, hash-verified

326 * Benchmark: Object Read (by ID)
327 */
328async function benchmarkObjectRead(name) {
329 // Setup: Create test objects
330 const TestObject = Parse.Object.extend('BenchmarkTest');
331 const objects = [];
332
333 for (let i = 0; i < 1_000; i++) {
334 const obj = new TestObject();
335 obj.set('testField', `read-test-${i}`);
336 objects.push(obj);
337 }
338
339 await Parse.Object.saveAll(objects);
340
341 let counter = 0;
342
343 return measureOperation({
344 name,
345 iterations: 1_000,
346 operation: async () => {
347 const query = new Parse.Query('BenchmarkTest');
348 await query.get(objects[counter++ % objects.length].id);
349 },
350 });
351}
352
353/**
354 * Benchmark: Object Update

Callers

nothing calls this directly

Calls 2

measureOperationFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected