On 8 March 2013 10:35, Yusuke SUZUKI <[email protected]> wrote: > Yeah. We, Esprima developers, parse UnicodeData.txt to generate identifier > identification functions. > I wrote simple UnicodeData.txt parser and generated RegExp[1]. These > functions are also used in Acorn. >
RegEx is slower. I suggest using if statements on char codes and < and > to check it's within the range of z-a etc and then separate functions to handle higher ascii variables only when needed and then compare the char codes are within the ranges of allowed identifiers. https://code.google.com/p/mentaljs/source/browse/trunk/MentalJS/javascript/Mental.js#504 I still have to optimize that function further by removing <= and >= and maybe separating each identifier range into their own function since higher non-alpha variables take longer to parse since they are at the end of the if statement.
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

