-
Notifications
You must be signed in to change notification settings - Fork 257
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Validation in ClojureScript extremely slow #356
Comments
Thanks for the report. Is this possibly the same issue as #352 ? Are you observing failures, or is it slow despite everything succeeding? I don't know much about ClojureScript profiling, but I'll try to take a look and see what I can find. If you can share a slow js file that I can profile in Chrome, that would be a big help. Thanks! |
It's always succeeding so not sure if the underlying issue is related to the mentioned one by you. |
I pushed compiled files with simple html file to this repo: https://github.com/sickill/gh-356 |
I have added CPU profile dump to the repo, you can load it in Chrome profiler. Lot's of |
If you switch to "Heavy (Bottom Up)" view in the profiler it's easier to spot. (btw, sorry for the noise ;-) |
Thanks, that's very helpful! Now that I'm looking at the code, it seems like you have a large state I'm not sure if this is the only thing going on or if something else is If there is a way to improve the performance of cljs checking, we'd On Thu, Apr 28, 2016 at 12:53 AM, Marcin Kulik [email protected]
|
Yes, it's validated many times, including generative tests. Generative tests are the major cause of 15+ minutes test run because of the high number of times they stress I didn't observe anything I could stick to in the profile (mostly because I don't know schema's internals). Re adding I appreciate you dug deeper, looked at my code ❤️. I think I'll stay with the reader conditional enabling schema checking in tests only under CLJ, which is fine as I'm running tests under both CLJ and CLJS on CI so potential bugs will be caught anyway. |
Ah, thanks for the context -- that all makes sense, and sounds like a reasonable compromise. I haven't done much with performance in ClojureScript, but I don't know of any specific reason it would be slower -- maybe the JIT just isn't as good at optimizing the work as its set up as does as the JVM (the specific way checkers are created is aimed at high performance after aggressive inlining, FWIW). So I guess I'll put this on the back burner for now, but I'll definitely keep it in the back of my mind next time I'm digging into things. |
Ok, thanks! (feel free to close this or keep it open, whichever you prefer). |
I have defined schema'd record (here https://github.com/asciinema/asciinema-player/blob/19c5c423e3ca78df1ae04dcebbf0d32437e303e1/src/asciinema/player/vt.cljc#L56), used
s/defn
to few functions and enabled schema validation in test via(use-fixtures :once schema.test/validate-schemas)
(here https://github.com/asciinema/asciinema-player/blob/19c5c423e3ca78df1ae04dcebbf0d32437e303e1/test/asciinema/player/vt_test.cljc#L15).I have noticed that schema validation is very slow when under ClojureScript. Without validation the tests under both Clojure and ClojureScript were finishing in few seconds. After enabling the validation I noticed that it's still couple of seconds for Clojure but 15+ minutes for ClojureScript (phantomjs). Right now I'm enabling test validation for Clojure only because of this, using reader conditional (as seen in the second link above).
It seems it's not test-specific problem, because I can observe the same behavior when using
(s/set-fn-validation! true)
.I tried to find a specific part of this
VT
schema that makes it so slow (changing different sub-schemas tos/Any
etc) and it seems there's no single key/sub-schema that makes it slow, it just adds up from all sub-schemas.I'd be happy to give more information, test, dig deeper. Any hints?
The text was updated successfully, but these errors were encountered: