Skip to content

Memoize schema coercion#181

Merged
ikitommi merged 3 commits intomasterfrom
memoized_coercion
Dec 8, 2015
Merged

Memoize schema coercion#181
ikitommi merged 3 commits intomasterfrom
memoized_coercion

Conversation

@ikitommi
Copy link
Copy Markdown
Member

@ikitommi ikitommi commented Dec 8, 2015

Instead of creating the coercer on every request, we cache those via clojure.core/memoize. There will be a cache entry for all schema & matcher -pairs. Measured latency via api decreases by up to 40% in the new criterium tests, depending on the Schema complexity.

@Deraen
Copy link
Copy Markdown
Member

Deraen commented Dec 8, 2015

👍

@Deraen
Copy link
Copy Markdown
Member

Deraen commented Dec 8, 2015

Should work fine in production. In development memoize will keep references to old schemas and could eventually use lots of memory? Probably won't be a problem though.

ikitommi added a commit that referenced this pull request Dec 8, 2015
@ikitommi ikitommi merged commit 8258f28 into master Dec 8, 2015
@ikitommi ikitommi deleted the memoized_coercion branch December 25, 2016 16:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants