metabase / toucan

A classy high-level Clojure library for defining application models and retrieving them from a DB
Eclipse Public License 1.0
569 stars 49 forks source link

Remove classpath scanning in automagic batched hydration #38

Closed senior closed 6 years ago

senior commented 6 years ago

This code is pretty slow with large classpaths, taking over 10 seconds in Metabase. This code is also broken on JDK 9 due to the classloader changes, classpath/classpath will always return the empty list. With this removed, all of the Metabase tests still pass and we can save that 10 second load time the first time hydration is called.

senior commented 6 years ago

@camsaul This code didn't work at all on JDK 9 and our tests were still passing with it on Metabase. I removed it and tests pass with JDK 8 as well. The first thing that hits this code is the /api/user/current route, which takes a little over 10 seconds, after that initial load the results get cached and it doesn't call it again, but it's still noticeable on that first request.

camsaul commented 6 years ago

Yeah we can probably go ahead and take this out and speed things up a little for people. I think the docs say that Toucan automatically loads model namespaces somewhere so we need to find and update those docs too.