Detect slow-running loops and abort after a user-defined timeout
npm install slowpoke
|6||downloads in the last month|
|Version||0.0.6 last updated 5 months ago|
|Keywords||detect, slow, loops, ast, transform, while, for, do|
slowpoke takes as input an AST generated by
esprima and injects instrumentation code into all
do loops encountered therein. Any loop which does not terminate after a user-specified timeout will throw an error.
$ npm install slowpoke
var slowpoke = require('slowpoke');
ast in-place such that all slow loops will throw an
ast must be an
esprima-compatible AST structure.
timeout: number of milliseconds after which loop should abort. Default:
slowpoke only catches slow
do loops - it cannot detect unbounded recursion.
Error throwing as its abort mechanism, code containing
catch may not function as intended. Future work could modify
catch blocks re-raise errors thrown by slow loops.