Leiningen and loading hooks

349 views
Skip to first unread message

Phil Hagelberg

unread,
Jul 30, 2010, 12:07:10 AM7/30/10
to clo...@googlegroups.com
I discovered a problem in Leiningen 1.2.0 that I am debating how to
fix in 1.2.1. The gist is that it searches the whole classpath for all
namespaces matching leiningen.hooks.*, and this is very slow for large
classpaths. It can add several seconds to the Leiningen boot time.

I'm contemplating a fix to this that would require hooks to be
declared in project.clj in order for them to be loaded. This is a good
idea for reasons other than just boot time, but it is a breaking
change.

I'd like to gauge how many people would be affected by such a change.
Auto-loading hooks is a pretty new feature, so if I can fix the
performance issues with it before its use is widespread that might be
nice. But if a lot of people are relying on implicit loading, then I
will be more cautious.

Please let me know.

thanks,
Phil

Heinz N. Gies

unread,
Jul 30, 2010, 1:16:51 AM7/30/10
to clo...@googlegroups.com

My suggestion would be make a project.clj tag like :hook-cps which holds all classpathes checked for hooks and one :implict-hooks true that would turn back old behavior - that said I'm not 'hurt' by any chance since I've no project that uses them :P

Regards,
Heinz

David Cabana

unread,
Jul 30, 2010, 8:28:19 AM7/30/10
to clo...@googlegroups.com
Phil,

Just a personal opinion, but I'd urge you not to worry too much about
breaking changes just yet. The future value of doing the right thing
now outweighs the value of backwards compatibility in an application
as young as Lein.

To answer your direct question, I would not be affected by a
requirement that hooks be
declared in project.clj. Actually, I think there are advantages to
explicit declarations.

David

lprefo...@softaddicts.ca

unread,
Jul 30, 2010, 11:03:18 AM7/30/10
to clo...@googlegroups.com
+1,

auto loading is simple and if performance becomes an issue, an explicit
list of hooks would solve this issue. I would however leave auto loading by
default. We have a couple of hundred jar dependencies so speed for us is
an issue but auto loading seems to me a decent default for beginners, better
than failing on a missing implementation or other "strange" behaviours.

Luc P.

Heinz N. Gies <he...@licenser.net> wrote ..

> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clo...@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+u...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en

Phil Hagelberg

unread,
Jul 30, 2010, 1:22:39 PM7/30/10
to clo...@googlegroups.com
On Fri, Jul 30, 2010 at 8:03 AM, <lprefo...@softaddicts.ca> wrote:
> +1,
>
> auto loading is simple and if performance becomes an issue, an explicit
> list of hooks would solve this issue. I would however leave auto loading by
> default. We have a couple of hundred jar dependencies so speed for us is
> an issue but auto loading seems to me a decent default for beginners, better
> than failing on a missing implementation or other "strange" behaviours.

Sorry, auto-loading will not stay on by default in the long-term. The
question is whether it will be removed in 1.2.1 or later on. I may
allow auto-loading to be turned on in project.clj, but having stuff
happen behind your back because of what happens to be on your
classpath (even things you didn't add explicitly but were pulled in
via transitive dependencies) is a little too much magic I think.

-Phil

lprefo...@softaddicts.ca

unread,
Jul 30, 2010, 1:50:37 PM7/30/10
to clo...@googlegroups.com
I like magic, life is so complicated these days :)))

Luc P.

Phil Hagelberg <ph...@hagelb.org> wrote ..

Michał Marczyk

unread,
Jul 30, 2010, 3:39:26 PM7/30/10
to clo...@googlegroups.com
On 30 July 2010 14:28, David Cabana <drca...@gmail.com> wrote:
> Just a personal opinion, but I'd urge you not to worry too much about
> breaking changes just yet. The future value of doing the right thing
> now outweighs the value of backwards compatibility in an application
> as young as Lein.

This sounds eminently reasonable to me. Especially since --
fortunately! -- the hooks functionality has only just been released,
so if it's causing trouble, we're probably in a window of opportunity
to fix this before huge quantities of code become dependent on the
current behaviour. So... (inc)

Sincerely,
Michał

Reply all
Reply to author
Forward
0 new messages