Performance: Database and app orchestration
HIGH IMPACT
This concept affects how quickly the app communicates with the database and manages data flow, impacting page load and interaction speed.
public List<User> getUsers() {
return userRepository.findAllById(IntStream.range(0, 100).boxed().collect(Collectors.toList()));
}public List<User> getUsers() {
List<User> users = new ArrayList<>();
for (int i = 0; i < 100; i++) {
users.add(userRepository.findById(i).orElse(null));
}
return users;
}| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Multiple individual DB calls | N/A | N/A | Blocks rendering until data arrives | [X] Bad |
| Batch DB calls with async processing | N/A | N/A | Faster data delivery enables quicker paint | [OK] Good |