This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-06-24
Channels
- # announcements (1)
- # beginners (78)
- # cider (19)
- # circleci (4)
- # clojure (27)
- # clojure-denmark (3)
- # clojure-europe (29)
- # clojure-gamedev (1)
- # clojure-madison (1)
- # clojure-nl (2)
- # clojure-norway (37)
- # clojure-sweden (5)
- # clojure-uk (4)
- # core-typed (45)
- # datahike (5)
- # fulcro (1)
- # graalvm (17)
- # gratitude (1)
- # hyperfiddle (3)
- # lsp (17)
- # malli (1)
- # off-topic (3)
- # pathom (11)
- # polylith (7)
- # re-frame (13)
- # releases (1)
- # ring (20)
- # scittle (21)
- # specter (4)
- # tools-build (8)
- # xtdb (10)
- # yamlscript (7)
Is there anyway the process of registering annotations can be sped up? It takes a decent amount of time to the startup process of our application which already had a longish startup time lol.
I assume you're talking about dev-time? I think a lot of time is spent compiling the type checker. Perhaps see if this helps https://clojure.org/guides/dev_startup_time
It affects everything really. Whenever we run tests, start the site, type check, certain linters etc. Its not the worst thing but I was just curious if there is anyway to speed that up or remove it entirely. For our production setup it does do the same thing there but we have a rolling update setup so it doesn't cause our service to go down or anything for longer so its honestly more of a dev thing.
We use lein uberjar to compile the jar
Yeah that does remove it for the jar thanks.
We use [org.typedclojure/typed.clj.runtime "1.2.2-SNAPSHOT"], [org.typedclojure/typed.clj.checker "1.2.2-SNAPSHOT"], and [org.typedclojure/typed.lib.clojure "1.2.2-SNAPSHOT"]. I think we experimented previously and we needed those or it wouldn't work since we use t/pred
Ok let me try that
removing the checker should have no effect on the loading time but will drastically reduce the # of prod deps
Sounds good thanks. I was able to move the checker to dev dependencies and everything still works.
for production startup, AOT compilation may solve many of your issues. t/pred
only loads annotation at macroexpansion time.
Yeah it cuts the startup time down significantly
Idk how i never heard of that before
It pre compiles all of the files that is what we want anyways I wonder why that isn't the default
No it doesn't print out the registering annotations stuff
just need to make sure annotations for the checker's implementation aren't being loaded
In dev I get
Registering annotations from typed.ann.clojure...
Registering annotations from typed.cljc.runtime.env-utils-annotations...
Registering annotations from typed.clj.checker.assoc-utils...
Registering annotations from typed.clj.checker.parse-unparse...
Registering annotations from typed.clj.checker.subtype...
Registering annotations from typed.cljc.checker.check...
Registering annotations from typed.cljc.checker.check.funapp...
Registering annotations from typed.cljc.checker.cs-gen...
Registering annotations from typed.cljc.checker.filter-ops...
Registering annotations from typed.cljc.checker.filter-rep...
Registering annotations from typed.cljc.checker.lex-env...
Registering annotations from typed.cljc.checker.object-rep...
Registering annotations from typed.cljc.checker.var-env...
latest main now AOT compiles typed.clojure and clojure.core.typed. might give 100ms back during dev.
another improvement, you should only see this log now, all the others won't be loaded:
Registering annotations from typed.ann.clojure...
that should be a drastic improvement on startup since before t/pred
would load half the checker in dev.
the tradeoff being the first t/check-ns-clj
will take longer. but I'll work on that.
I think something in a recent snapshot commit is causing this weird error during our CI pipeline when doing lein uberjar. We are getting this error
Registering annotations from typed.ann.clojure...
Unexpected error macroexpanding tyc/pred at (ourfile.clj:43:12).
Unexpected error (IndexOutOfBoundsException) macroexpanding tyc/pred at (ourfile.clj:43:12).
Method code too large!
That line its referring to looks like (def user? (tyc/pred User))
and User is just a hmap defaliashttps://github.com/typedclojure/typedclojure/commit/eb40954e383371c25865f550a7ae1b75b2915806
Cool thanks