3 ms·
Honestly, both of these I think are pretty applicable to line-of-business apps as well. The "push loops down" advice most especially: for any CRUD app, handlin
by simiones 3y ago
Honestly, both of these I think are pretty applicable to line-of-business apps as well.
The "push loops down" advice most especially: for any CRUD app, handling creation and updates in bulk when possible will typically save huge amounts of time, much more than in CPU bound use cases. The difference between doing `items.map(insertToDb/postToServer) ` vs doing `insertToDb/postToServer(items)` is going to be orders of magnitude in almost all cases.
I have seen optimizations of this kind take operations from seconds or minutes down to milliseconds. And often the APIs end up cleaner and logs are are much easier to read.
- atherton33 3y agoGreat point. The n+1 sql queries antipattern comes to mind as a very common "push loops down" application in line of business stuff. Let the db do the work/join.
- crabmusket 3y agoOh definitely. I've seen the same kind of benefits. Avoiding 1+n queries is a similar change - push the loop "down" into the database.