4 ms·
Lets say you've thrown away the ast, don't have a token stream, etc, but do still have access to the source of the function. Getting the function length is O(1)
by yoklov 10y ago
Lets say you've thrown away the ast, don't have a token stream, etc, but do still have access to the source of the function. Getting the function length is O(1). At worst, its a subtraction. Lexing it is considerably more expensive, and doing so just to improve the heuristic may not be worth the time.