Million Lint detects slow code by using a combination of static analysis and runtime analysis. It injects instrumentation into your code during compilation, which captures render, timing, and metadata information as you interact with your web app in dev mode. This allows it to gather runtime profiling data from running the app while keeping access to the source code. The collected data is then fed into the VSCode extension, where you can see the performance issues and suggestions to fix them.
Million Lint identifies several triggers for re-renders in React applications, including state changes, parent component re-renders, context changes, and hooks changes1. By addressing these issues, developers can optimize their code for better performance and improve the overall user experience.
Yes, Million Lint can analyze both static and runtime code. It uses dynamic analysis, which combines static analysis and runtime analysis, to provide a comprehensive profiling experience without hogging build time or runtime6. This allows developers to effectively identify and fix performance issues in their React applications.