On Jun 5, 2009, at 10:52 AM, Bennett, Patrick wrote:
Still - how is that desc - something that does nothing more than setting a string, take more time more than reading a file
Because unless you actually request an option that needs task comments, the comments are not parsed, so nothing is done. Currently, the desc method doesn't look at the "need task metadata" flag, so it still runs and stores the comment. But even if I fix that, you still have a method dispatch (that does nothing).
(a bunch of two line files isn't the best test, but you did actually test something so I can't complain too much ;>)
300 files, each 400 lines long. Each file defining 100 tasks. Longer more complicated tasks would add to the individual task overhead times without contributing to the comment parse times. So I figure this is a worst case scenario for the Ruby comment runtime overhead.
and running a regexp parse across the caller backtrace? That really doesn't make any sense Jim.
The line number info is needed anyways to support the new -W option. Is there a better way to get the line number info? (If we had macros, we could capture the __FILE__ and __LINE__ values at the point of task definition ... never mind ... too much clojure programming lately :)
Actually, another way just occurred to me. We can eval("__FILE__", block) to get the file name (and __LINE__ for the line number). However, that only works if the task supplies a block (and not all tasks do). But I don't know if it will be significantly faster, and even if we used that, we would still need a call stack search fall back for tasks without blocks.
Speaking of the patch - how does it handle it when multiple tasks are created on the same line [say in a block iteration]? If there happens to be a comment on the line above they'll all get the same task description?
Right. The desc technique can be customized with string interpolation for each task. The ruby comment version can't do that. Good point. And desc isn't going away, so its still available.
-- -- Jim Weirich -- [email protected] _______________________________________________ Rake-devel mailing list [email protected] http://rubyforge.org/mailman/listinfo/rake-devel
