A company reached out asking for help with identifying slow JavaScript code. They thought that the reactivity engine in the framework they used (Vue) was the culprit.

Finding slow code in an app filled with frameworks and libraries like Firebase looks like a difficult task. In fact it used to be incredibly difficult. Luckily, we have access to phenomenal dev tools that can help us track down slow performing code.

It took just a few minutes to find the exact place in code that slowed the app down. I documented the process in this easy-to-follow video. Feel free to use it if your app could benefit from optimizing JavaScript code.

The bottom line is that it’s easy to blame frameworks and libraries for being slow. After all, there’s often a lot of blackbox magic going on under the hood that makes it intimidating to even try finding where things are going bad. More often than not, it’s not the libraries, but our code that needs tweaks, optimizations, or a complete overhaul.

Just fire up the dev tools in your Chrome (other browsers have great alternatives, too) and start profiling. The bottom-up chart will show exactly where you can improve.

r/webdev - "Why is my JavaScript slow?" It's not the framework, it's probably your code.

What about you? Have you ever gone crazy trying to identify poor performing code?

Source link

Write A Comment