@@ -98,6 +98,11 @@ export function parseMatches(text: string, args: ParseMatchesArgs): Match[] {
9898 for ( let stateIdx = context . stateMachines . length - 1 ; stateIdx >= 0 ; stateIdx -- ) {
9999 const stateMachine = context . stateMachines [ stateIdx ] ;
100100
101+ // Performance note: tried turning this switch/case into a lookup
102+ // table, but resulted in ~350 fewer ops/sec in benchmarks.
103+ // Switch/case may be more efficient due to potential function
104+ // inlining by the engine? Either way, run benchmarks if
105+ // attempting to change again.
101106 switch ( stateMachine . state ) {
102107 // Protocol-relative URL states
103108 case State . ProtocolRelativeSlash1 :
@@ -137,7 +142,7 @@ export function parseMatches(text: string, args: ParseMatchesArgs): Match[] {
137142 stateIpV4Digit ( context , stateMachine as IpV4UrlStateMachine , char ) ;
138143 break ;
139144 case State . IpV4Dot :
140- stateIPv4Dot ( context , stateMachine as IpV4UrlStateMachine , char ) ;
145+ stateIpV4Dot ( context , stateMachine as IpV4UrlStateMachine , char ) ;
141146 break ;
142147
143148 case State . PortColon :
@@ -556,7 +561,7 @@ function stateIpV4Digit(
556561 }
557562}
558563
559- function stateIPv4Dot (
564+ function stateIpV4Dot (
560565 context : ParseMatchesContext ,
561566 stateMachine : IpV4UrlStateMachine ,
562567 char : string
0 commit comments