This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-06-23
Channels
- # announcements (3)
- # aws (1)
- # beginners (44)
- # biff (6)
- # calva (31)
- # cider (26)
- # clerk (12)
- # clj-kondo (9)
- # clojure (17)
- # clojure-dev (18)
- # clojure-europe (13)
- # clojure-norway (45)
- # clojure-uk (4)
- # clojurescript (34)
- # datomic (54)
- # dev-tooling (14)
- # emacs (19)
- # events (7)
- # honeysql (2)
- # hyperfiddle (51)
- # lsp (34)
- # malli (24)
- # matrix (1)
- # missionary (5)
- # off-topic (27)
- # re-frame (6)
- # reagent (18)
- # releases (2)
- # sci (6)
- # shadow-cljs (88)
- # vim (9)
There's https://github.com/clj-commons/seesaw/blob/7dbc738b25e7c144051eedbc6abb02c626992f12/src/seesaw/graphics.clj#L162 But it doesn't seem to be documented.
As I see in the code image
should be a java.awt.Image
or java.swing.ImageIcon
object. If you need to load image from file you can steal the code from Clojure2d: https://github.com/Clojure2D/clojure2d/blob/master/src/clojure2d/core.clj#L229-L251
I'm working on a library that defines many "rules". I've split each of the rules into separate files/namespaces for clarity and ease of development. To load these, I have a big :require
block in my main namespace declaration that lists them all: (:require noahtheduke.splint.rules.lint.assoc-fn noahtheduke.splint.rules.lint.body-unquote-splicing ...)
Doing some testing, it seems this is rather slow. Timings done by wrapping the ns
call in time
: With the require block, it takes roughly 3.2 seconds, and without, it takes roughly 1.7 seconds. Using load-file
instead of a require block, it takes the same time to load the empty ns plus load-file calls, so it's not the ns
/`:require` itself, it's just how long it takes clojure to load files.
is there anything to be done about this?
it's not the ns or require themselves that are slow, it's what's in the rule files so ... what's in the rule files
a macro that calls into another macro that parses s-expressions into predicate functions lol
"well there's your problem!"
have you tried aot compiling
that lets you do all that macro stuff once and not at runtime
I have :gen-class
so I can turn this into a jar/uberjar, but I haven't tried running compile or anything to see if that helps. i can look into that
I don't know much about compiling, to be honest
well, macros is compiling :)
once you've compiled, the time is mostly var creation and initialization
and a smidge of classloading
https://clojure.org/guides/dev_startup_time might help you try some stuff without bothering to make a jar
Setting that up cut down the big ns
declaration from 3.2 seconds to .8 seconds. Much improved, thank you