Reflections cache

38 views
Skip to first unread message

wesley.s...@gmail.com

unread,
Mar 14, 2015, 6:08:13 PM3/14/15
to activate-p...@googlegroups.com
Hey, there's some way to cache reflections results? When developing it's really slow, sometimes it takes 10 seconds to process all reflections. Or there's a way to limit the reflection scanner to a specific package/module?

Thanks!

Flavio W. Brasil

unread,
Mar 14, 2015, 6:18:18 PM3/14/15
to wesley.s...@gmail.com, activate-p...@googlegroups.com
Hi Wesley,

There ins’t a mechanism to cache the reflections, but you can restrict the scan to specific packages. You just need to override `entitiesPackages`:


Let me know if it solves your issue. If not, I think it is possible to configure the reflections library to use multiple threads.

Best,

-- 
Flavio W. Brasil

On Saturday, March 14, 2015 at 11:08 PM, wesley.s...@gmail.com wrote:

Hey, there's some way to cache reflections results? When developing it's really slow, sometimes it takes 10 seconds to process all reflections. Or there's a way to limit the reflection scanner to a specific package/module?

Thanks!

--
You received this message because you are subscribed to the Google Groups "Activate Persistence Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to activate-persist...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

wesley.s...@gmail.com

unread,
Mar 14, 2015, 6:57:58 PM3/14/15
to activate-p...@googlegroups.com, wesley.s...@gmail.com

Yeah, this helped a little, but still walking through others packages, like this:

19:30:50.015 [main] DEBUG - going to scan these urls:
 file
:/Users/schleumer/Projects/jupiter/callisto/target/scala-2.11/classes/
 jar
:file:/Users/schleumer/.ivy2/cache/net.fwbrasil/activate-core_2.11/jars/activate-core_2.11-1.7.jar!/

19:30:50.273 [main] INFO  - Reflections took 251 ms to scan 2 urls, producing 48 keys and 942 values
19:30:50.299 [main] DEBUG - going to scan these urls:
 file:/
Users/schleumer/Projects/jupiter/callisto/target/scala-2.11/classes/
 jar
:file:/Users/schleumer/.ivy2/cache/net.fwbrasil/activate-jdbc_2.11/jars/activate-jdbc_2.11-1.7.jar!/
 jar:file:/
Users/schleumer/.ivy2/cache/net.fwbrasil/activate-core_2.11/jars/activate-core_2.11-1.7.jar!/

19:30:50.669 [main] INFO  - Reflections took 369 ms to scan 3 urls, producing 151 keys and 3570 values
19:30:52.027 [main] INFO  - Initializing live cache for context Context
19:30:52.178 [main] INFO  - Initializing context Context
19:30:52.199 [main] DEBUG - going to scan these urls:
 jar:file:/
Users/schleumer/.ivy2/cache/net.fwbrasil/activate-jdbc_2.11/jars/activate-jdbc_2.11-1.7.jar!/
 jar:file:/
Users/schleumer/.ivy2/cache/net.fwbrasil/activate-core_2.11/jars/activate-core_2.11-1.7.jar!/

19:30:52.247 [main] INFO  - Reflections took 47 ms to scan 2 urls, producing 27 keys and 294 values
19:30:53.108 [main] DEBUG - going to scan these urls:
 file:/
Users/schleumer/Projects/jupiter/callisto/target/scala-2.11/classes/
 jar
:file:/Users/schleumer/.ivy2/cache/net.fwbrasil/activate-core_2.11/jars/activate-core_2.11-1.7.jar!/

19:30:53.176 [main] INFO  - Reflections took 67 ms to scan 2 urls, producing 30 keys and 439 values
19:30:53.186 [main] DEBUG - going to scan these urls:
 file:/
Users/schleumer/Projects/jupiter/callisto/target/scala-2.11/classes/
 jar
:file:/Users/schleumer/.ivy2/cache/net.fwbrasil/activate-core_2.11/jars/activate-core_2.11-1.7.jar!/

19:30:53.226 [main] INFO  - Reflections took 40 ms to scan 2 urls, producing 20 keys and 209 values
To unsubscribe from this group and stop receiving emails from it, send an email to activate-persistence+unsub...@googlegroups.com.

Flavio W. Brasil

unread,
Mar 15, 2015, 4:57:22 AM3/15/15
to wesley.s...@gmail.com, activate-p...@googlegroups.com
Hi,

These are reflections of the Activate’s class path that also defines migrations and the StorageVersion entity. I think it is possible to change Activate to avoid using reflections for them. I’ve also verified that it isn’t possible to configure the parallel scan without changing Activate.

Could you open an issue on github to optimize this?

If you want to try, there is also a maven plugin to pre-process the scan. Take a look at the readme:


Regards,

-- 
Flavio W. Brasil

To unsubscribe from this group and stop receiving emails from it, send an email to activate-persist...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages