Performance: Loading from databases
HIGH IMPACT
This affects the initial page load speed and responsiveness by controlling how quickly data is fetched and made available for rendering or processing.
async def load_data(): data = await db.query_async('SELECT * FROM large_table LIMIT 100') process(data) render(data) # Load more data on demand or in background
data = db.query('SELECT * FROM large_table') # synchronous blocking call process(data) render(data)
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Synchronous full data load | High (large DOM updates after full data) | Multiple reflows as data arrives | High paint cost due to large updates | [X] Bad |
| Asynchronous partial data load | Lower (incremental DOM updates) | Single or few reflows | Lower paint cost with smaller updates | [OK] Good |