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

Function benchmarkObjectUpdate

benchmark/performance.js:356–382  ·  view source on GitHub ↗

* Benchmark: Object Update

(name)

Source from the content-addressed store, hash-verified

354 * Benchmark: Object Update
355 */
356async function benchmarkObjectUpdate(name) {
357 // Setup: Create test objects
358 const TestObject = Parse.Object.extend('BenchmarkTest');
359 const objects = [];
360
361 for (let i = 0; i < 1_000; i++) {
362 const obj = new TestObject();
363 obj.set('testField', `update-test-${i}`);
364 obj.set('counter', 0);
365 objects.push(obj);
366 }
367
368 await Parse.Object.saveAll(objects);
369
370 let counter = 0;
371
372 return measureOperation({
373 name,
374 iterations: 1_000,
375 operation: async () => {
376 const obj = objects[counter++ % objects.length];
377 obj.increment('counter');
378 obj.set('lastUpdated', new Date());
379 await obj.save();
380 },
381 });
382}
383
384/**
385 * Benchmark: Simple Query

Callers

nothing calls this directly

Calls 1

measureOperationFunction · 0.85

Tested by

no test coverage detected