Skip to content

Instantly share code, notes, and snippets.

@benjamn
Created September 14, 2012 05:52
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save benjamn/3720055 to your computer and use it in GitHub Desktop.
Today I wrote a function whose running time was quadratic in the number of characters it took me to write the function.
exports.testSlice = function(t) {
var code = arguments.callee + "",
lines = fromString(code);
lines.eachPos(function(start) {
lines.eachPos(function(end) {
check(lines.slice(start, end),
lines.bootstrapSlice(start, end));
}, start);
});
t.finish();
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment