* Benchmark: Object Update
(name)
| 354 | * Benchmark: Object Update |
| 355 | */ |
| 356 | async 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 |
nothing calls this directly
no test coverage detected