[CCONTRACTS-1] Make defconstrainedrecord's predicate fast Created: 06/Jun/13 Updated: 28/Jun/13 Resolved: 28/Jun/13
Instead of using the slow `clojure.core/type`, use an inlining function calling `instance?`. I have not tested the performance, but it's probably much faster.
|Comment by Ambrose Bonnaire-Sergeant [ 16/Jun/13 11:17 AM ]|
These are the kinds of numbers I'm seeing between using type vs. instance? (220ms vs. 15ms).
Crude tests, but it should be obvious the inlining version is much faster.
|Comment by Ambrose Bonnaire-Sergeant [ 17/Jun/13 12:38 AM ]|
Attached new patch: fast-predicate2.diff
Ensure instance? inlines. Needs to be put in a fn rather than definline.
There's a little benchmark. I noticed a speedup to 17ms for 1e6 iterations, from 185ms.
|Comment by Fogus [ 28/Jun/13 8:11 AM ]|
Applied on master. I will push a point-version out later today. Thanks.