* Benchmark: Query with Include (Parallel Pointers) * Tests the performance improvement when fetching multiple pointers at the same level.
(name)
| 491 | * Tests the performance improvement when fetching multiple pointers at the same level. |
| 492 | */ |
| 493 | async function benchmarkQueryWithIncludeParallel(name) { |
| 494 | const PointerAClass = Parse.Object.extend('PointerA'); |
| 495 | const PointerBClass = Parse.Object.extend('PointerB'); |
| 496 | const PointerCClass = Parse.Object.extend('PointerC'); |
| 497 | const RootClass = Parse.Object.extend('Root'); |
| 498 | |
| 499 | // Create pointer objects |
| 500 | const pointerAObjects = []; |
| 501 | for (let i = 0; i < 10; i++) { |
| 502 | const obj = new PointerAClass(); |
| 503 | obj.set('name', `pointerA-${i}`); |
| 504 | pointerAObjects.push(obj); |
| 505 | } |
| 506 | await Parse.Object.saveAll(pointerAObjects); |
| 507 | |
| 508 | const pointerBObjects = []; |
| 509 | for (let i = 0; i < 10; i++) { |
| 510 | const obj = new PointerBClass(); |
| 511 | obj.set('name', `pointerB-${i}`); |
| 512 | pointerBObjects.push(obj); |
| 513 | } |
| 514 | await Parse.Object.saveAll(pointerBObjects); |
| 515 | |
| 516 | const pointerCObjects = []; |
| 517 | for (let i = 0; i < 10; i++) { |
| 518 | const obj = new PointerCClass(); |
| 519 | obj.set('name', `pointerC-${i}`); |
| 520 | pointerCObjects.push(obj); |
| 521 | } |
| 522 | await Parse.Object.saveAll(pointerCObjects); |
| 523 | |
| 524 | // Create Root objects with multiple pointers at the same level |
| 525 | const rootObjects = []; |
| 526 | for (let i = 0; i < 10; i++) { |
| 527 | const obj = new RootClass(); |
| 528 | obj.set('name', `root-${i}`); |
| 529 | obj.set('pointerA', pointerAObjects[i % pointerAObjects.length]); |
| 530 | obj.set('pointerB', pointerBObjects[i % pointerBObjects.length]); |
| 531 | obj.set('pointerC', pointerCObjects[i % pointerCObjects.length]); |
| 532 | rootObjects.push(obj); |
| 533 | } |
| 534 | await Parse.Object.saveAll(rootObjects); |
| 535 | |
| 536 | return measureOperation({ |
| 537 | name, |
| 538 | skipWarmup: true, |
| 539 | dbLatency: 100, |
| 540 | iterations: 100, |
| 541 | operation: async () => { |
| 542 | const query = new Parse.Query('Root'); |
| 543 | // Include multiple pointers at the same level - should fetch in parallel |
| 544 | query.include(['pointerA', 'pointerB', 'pointerC']); |
| 545 | await query.find(); |
| 546 | }, |
| 547 | }); |
| 548 | } |
| 549 | |
| 550 | /** |
nothing calls this directly
no test coverage detected