markjgsmith

Linkblog

Speeding up the JavaScript ecosystem - The barrel file debacle - So called barrel files that re-export modules so they can all be easily imported somewhere else is such a common pattern in javascript. It can make code more readable by not having millions of imports at the top of the file. Turns out it can increase runtime in some cases because the module graph becomes unnecesarily large. It's especially noticeable in tests because the same code is running again and again, each time adding the overhead. Tldr, don't overuse barrel files. Check that they aren't slowing down your tests. marvinh.dev #

For enquiries about my consulting, development, training and writing services, aswell as sponsorship opportunities contact me directly via email. More details about me here.