On Sat, Nov 21, 2009 at 8:57 PM, David Brown <cloj...@davidb.org> wrote:
> On Sat, Nov 21, 2009 at 08:42:26PM -0500, John Harrop wrote: > > >Are you talking about binding things like String.class to vars referenced > by > >symbols like String? > > Not just String.class, every single class referenced by a given > namespace will be loaded, and most of them instantiated before a > single line of my code runs. It's why: > > $ time ant > ... (no ant file, it just fails) > real 0m0.155s > > $ time clj -e '(System/exit 0)' > real 0m0.960s > > is so drastically different. 1 second instead of 1/6 of a second. Yeah, like users will notice that difference in startup times. :) running > > $ time java -cp classes:clojure.jar foo > real 0m0.749s > > still loads and instantiates every single function defined in > core.clj. Avoiding instantiating all the Clojure functions used or not is a whole 'nother kettle of fish. Barring "eval", you can find out what functions are used in a codebase by loading it all, reading it in as Clojure data, taking it apart form by form, subjecting every form to macroexpand, and then resolving all symbols; this gives you all defn-defined functions called. You then assume that every closure in any of these functions is also potentially called, and that in theory gives you your answer, with a procedure that can theoretically be automated (and in Clojure itself perhaps without too much difficulty). -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en