Change { type: 'Name' } to { type: Symbol('Name') } across our APIs. This is expected to bring a roughly 2x speedup to equality checks against node.type due to the extremely straightforward nature of symbol comparison. String comparison does have relatively fast cases for interned strings, but likely the fact that comparison between two interned strings is only one of many possible types of string comparison means that string comparison is will probably continue to be slower than symbol comparison well into the future.
The real implementation cannot be { type: Symbol('Name') } though, as the Symbol('Name') expression must be created only once so that all references to the Name production can do so using the same symbol. The VM will need to manage these symbols, making them available through context.
Change
{ type: 'Name' }
to{ type: Symbol('Name') }
across our APIs. This is expected to bring a roughly 2x speedup to equality checks againstnode.type
due to the extremely straightforward nature of symbol comparison. String comparison does have relatively fast cases for interned strings, but likely the fact that comparison between two interned strings is only one of many possible types of string comparison means that string comparison is will probably continue to be slower than symbol comparison well into the future.The real implementation cannot be
{ type: Symbol('Name') }
though, as theSymbol('Name')
expression must be created only once so that all references to theName
production can do so using the same symbol. The VM will need to manage these symbols, making them available throughcontext
.