peteguhl/CodeMirror2 — comment on commit c611c4a5c381d2aa4794678529152e34d1647779
File: mode/vbscript/vbscript.js line 112
By marijnh:

Why are you doing the check on the first letter? Just put the keywords in one big array, and do this loop once, unconditionally. It'll only match stuff that matches a keyword anyway. Alternatively, us an object to store the keywords, so that lookup is super-fast. For example

var keywords = {Call: true, Case: true, CDate: true, /* .... */ VbTab: true};
/* ... */
if (keywords.hasOwnProperty(strToken)) return "keyword";