[CTYP-99] Checking an ns becomes significantly slower as the number of optional keys in a HMap increases Created: 03/Dec/13 Updated: 03/Dec/13
|Reporter:||Gordon Syme||Assignee:||Ambrose Bonnaire-Sergeant|
I'm using clojure.core.typed 0.2.19 with the slim classifier but I've observed the same without slim.
My suspicion is that the latent filters associated with functions grow in size exponentially with each extra optional key to a HMap (based on the output when you have a type error). I think it's generating all combinations of present and absent keys for the HMap when calculating latent filters for a function.
I've attached a tarball with a lein project with ten namespaces that all contain the same ten simple functions in the form
The type annotations vary in the number of optional keywords.
(test-hmap.core/go) checks all the namespaces. The time to check each namespace grows non-linearly. The first namespace gets penalised by core.typed initialisation the first time it's run.
E.g. on my local machine:
|Comment by Ambrose Bonnaire-Sergeant [ 03/Dec/13 12:50 PM ]|
Yes, the primitives are :mandatory, :absent-keys and :complete; :optional expands to be in terms of those.
Thanks for the report, I haven't done performance testing on this strategy. It will probably need to be reconsidered.