Speed up tokenization a bit.

This commit is contained in:
Lawrence Kesteloot 2018-08-04 17:35:55 -07:00
parent 013056e778
commit fb467e5289

3
main.c
View File

@ -625,7 +625,8 @@ static uint16_t tokenize(uint8_t *s) {
// Try every token.
for (i = 0; i < TOKEN_COUNT; i++) {
skipped = skip_over(s, TOKEN[i]);
// Quick optimization, peek at the first letter.
skipped = s[0] == TOKEN[i][0] ? skip_over(s, TOKEN[i]) : 0;
if (skipped != 0) {
// Record token.
*t++ = 0x80 + i;