DEV Community

Discussion on: 🚀⚙️ JavaScript Visualized: the JavaScript Engine

Collapse
 
mattishii26 profile image
Matthew Ishii

Very good job on this article! You broke it down to really easy to understand bits!

This brought up a question, and assuming I am understanding this correctly. There are parser nodes that signify a group of tokens that represent a single parser. For example, a single parser contains tokens about a single function.

With that said, what is faster? Having your JS code that is all in a single parser with more tokens or more parser's with less tokens?

I'd assume it depends on the case of how many parser's there are, because you could theoretically search for parser's in O(nlogn), with O(n) tokens, but at some point, if there are so many parser's, a single parser with more tokens would make sense.