top | item 23009236

Taming Callback Pyramids in AnuglarJS App Using Async/Await

14 points| prabhatjha | 6 years ago |engineering.wootric.com | reply

2 comments

order
[+] sharkenstein|6 years ago|reply
Are there any performance penalizations because of this? The code for the state machine looks very complex and I'm curious about what's the difference in terms of performance between the pyramid model or the flat model.
[+] hachibu|6 years ago|reply
Author here. Yes, there is a trade-off. The resulting code is much bigger than the original code because of this transformation. But, I think the trade-off is worth it because it makes the code simpler to read, write and maintain. As far as speed, I don't have any benchmarks but I don't think there is speed penalty. It's mainly an issue of code size.