* Benchmark: Object Read (by ID)
(name)
| 326 | * Benchmark: Object Read (by ID) |
| 327 | */ |
| 328 | async 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 |
nothing calls this directly
no test coverage detected