<story><title>Why Is Esbuild Fast?</title><url>https://esbuild.github.io/faq/#why-is-esbuild-fast</url></story><parent_chain><item><author>filleokus</author><text>Esbuild looks amazing. It seems to have been written almost exclusively by one guy (evanw) during 2020. Just the main JS parser file [0] is 12k lines. According to the Github stats he has committed 280k lines, that&amp;#x27;s almost 1000 lines per day every day since he started. Amazingly productive.&lt;p&gt;[0]: &lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;github.com&amp;#x2F;evanw&amp;#x2F;esbuild&amp;#x2F;blob&amp;#x2F;master&amp;#x2F;internal&amp;#x2F;js_parser&amp;#x2F;js_parser.go&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;github.com&amp;#x2F;evanw&amp;#x2F;esbuild&amp;#x2F;blob&amp;#x2F;master&amp;#x2F;internal&amp;#x2F;js_par...&lt;/a&gt;</text></item></parent_chain><comment><author>lhorie</author><text>&amp;gt; Just the main JS parser file [0] is 12k lines&lt;p&gt;While that is impressive, I think this is also an indication of a problem: the grammar is becoming unwieldy. For example, even for someone as prolific as Evan, he must decide between feature depth (e.g. bundle splitting) and feature breadth (e.g. implementing the equivalent to @babel&amp;#x2F;preset-flow, which is used by both flow and hegel[0] type systems)[1]&lt;p&gt;Esbuild supporting Typescript and JSX is undoubtedly a byproduct of these grammar extensions having become popular. But supporting extra grammar extensions does add to complexity, sometimes in non-trivial ways. In Typescript, for example, you can import types using runtime import syntax, making it ambiguous whether running side-effects from a library is intentional or not. This gets problematic once you consider treeshaking and not-really-standard things like conditional resolution via package.json&amp;#x27;s `browser` field.&lt;p&gt;It gets even more fun when you realize that module resolution isn&amp;#x27;t even specified, meaning that as far as a bundler is concerned, something like `import &amp;#x27;lodash&amp;#x27;` means completely different things for a browser vs a project installed via npm vs one installed via yarn v2...&lt;p&gt;[0] &lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;hegel.js.org&amp;#x2F;&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;hegel.js.org&amp;#x2F;&lt;/a&gt;&lt;p&gt;[1] &lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;github.com&amp;#x2F;evanw&amp;#x2F;esbuild&amp;#x2F;issues&amp;#x2F;79&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;github.com&amp;#x2F;evanw&amp;#x2F;esbuild&amp;#x2F;issues&amp;#x2F;79&lt;/a&gt;</text></comment>
<story><title>Why Is Esbuild Fast?</title><url>https://esbuild.github.io/faq/#why-is-esbuild-fast</url></story><parent_chain><item><author>filleokus</author><text>Esbuild looks amazing. It seems to have been written almost exclusively by one guy (evanw) during 2020. Just the main JS parser file [0] is 12k lines. According to the Github stats he has committed 280k lines, that&amp;#x27;s almost 1000 lines per day every day since he started. Amazingly productive.&lt;p&gt;[0]: &lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;github.com&amp;#x2F;evanw&amp;#x2F;esbuild&amp;#x2F;blob&amp;#x2F;master&amp;#x2F;internal&amp;#x2F;js_parser&amp;#x2F;js_parser.go&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;github.com&amp;#x2F;evanw&amp;#x2F;esbuild&amp;#x2F;blob&amp;#x2F;master&amp;#x2F;internal&amp;#x2F;js_par...&lt;/a&gt;</text></item></parent_chain><comment><author>lucideer</author><text>Just to put the 280k lines into perspective, deletion rate seems close to addition rate[0]; measuring the number of changes made to code is also a poor proxy for productivity, but is at least not quite as bad as the pure &amp;quot;lines added&amp;quot; metric.&lt;p&gt;[0] &lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;github.com&amp;#x2F;evanw&amp;#x2F;esbuild&amp;#x2F;graphs&amp;#x2F;code-frequency&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;github.com&amp;#x2F;evanw&amp;#x2F;esbuild&amp;#x2F;graphs&amp;#x2F;code-frequency&lt;/a&gt;</text></comment>