Re: Spec validation cache?

2016-11-16 Thread Alex Miller
Maybe you don't need to instrument *all* functions in development? 

Alternatively, you could instrument and provide simpler replacement specs 
to improve speed. For example, an fspec arg could be replaced with ifn?. 

On Tuesday, November 15, 2016 at 10:29:34 PM UTC-6, Gal Dolber wrote:
>
> I'm having an issue with clojure.spec, its been great in more ways than I 
> expected but it's slowing down everything too much for development. On one 
> side when running the app on development with all fspecs instrumented and 
> on the other when running the tests.
>
> For the first case, most of the fdef functions take the app state as the 
> first argument, and the app state, being a really big data structure, gets 
> constantly validated and re-validated, while only few parts change. So I've 
> been wondering if there's a way to memoize spec/valid? to speed everything 
> up (while sacrificing memory).
>
> For the tests the case is different, because the app state gets generated 
> every time, so I don't see how this could speed them up.
>
> I tried doing it with `with-redefs without any luck. 
> Any ideas? (I'm running on clojurescript)
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Spec validation cache?

2016-11-15 Thread Gal Dolber
I'm having an issue with clojure.spec, its been great in more ways than I
expected but it's slowing down everything too much for development. On one
side when running the app on development with all fspecs instrumented and
on the other when running the tests.

For the first case, most of the fdef functions take the app state as the
first argument, and the app state, being a really big data structure, gets
constantly validated and re-validated, while only few parts change. So I've
been wondering if there's a way to memoize spec/valid? to speed everything
up (while sacrificing memory).

For the tests the case is different, because the app state gets generated
every time, so I don't see how this could speed them up.

I tried doing it with `with-redefs without any luck.
Any ideas? (I'm running on clojurescript)

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.