[CLJ-1730] Improve `refer` performance Created: 13/May/15 Updated: 08/Oct/18
|Affects Version/s:||Release 1.6|
|Fix Version/s:||Release 1.11|
|Attachments:||clj-1730-2.patch refer-perf.patch Screenshot from 2018-08-01 23-23-41.png|
refer underlies require, use, and refer-clojure use cases and is not particularly efficient at its primary job of copying symbol/var mapping from one namespace to another.
Approach: Some improvements that can be made:
There are undoubtedly more dramatic changes (like immutable namespaces) in how all this works that could further improve performance but I tried to make the scope small-ish for this change.
While individual refer timings are greatly reduced (~50% reduction for (refer clojure.core), ~90% reduction for :only use), refer is only a small component of broader require load times so the improvements in practice are modest.
Patch appears correct but we should consider:
|Comment by Alex Miller [ 07/Sep/17 10:52 AM ]|
Patch updated to address first screening comment. I didn't actually find any case of the second one? Give me a pointer.
|Comment by Ghadi Shayban [ 01/Aug/18 10:30 PM ]|
I suspect that this will not matter much for peak performance. Given the attached picture of clojure.instant loading, this patch may shave a bit off startup time.
(picture made with Bytestacks, profile recorded a JDK11 debug build from today)