Fork me on GitHub
#clojure
<
2021-02-01
>
jaide01:02:22

What would it take for http://teavm.org/ to support Clojure?

Alex Miller (Clojure team)01:02:39

If it starts from bytecode then it should work with aot-compiled Clojure (which is bytecode)

Alex Miller (Clojure team)01:02:51

but why not ClojureScript?

Robert Mitchell01:02:04

It would be interesting to see how bundle size & runtime performance compare between that & clojurescript.

jaide01:02:31

I love ClojureScript but why not explore other options as well?

👍 3
hiredman02:02:29

Bundle size must be larger. Cljs compilation model includes tree shaking via Google closure

mbarillier16:02:08

I think I'm Doing It the Wrong Way (TM): I'm using hive-jdbc-uber.jar and clojure.java.jdbc but "uber" doesn't quite mean uber: calling jdbc/execute! is resulting in a series of class not found exceptions, so I'm killing the inferior clojure process (under emacs), editing project.clj to add a missing jar to :resource-paths and restarting clj. this seems stupid ... is there a way to tell leiningen "just go out to a repo and get whatever dependencies are needed to load this jar"?

noisesmith16:02:04

that's what the lein uberjar task does (along with packaging all those deps into one jar file)

noisesmith16:02:07

I wouldn't expect a jdbc specific jar to include all the adapters for the various dbs for example

mbarillier16:02:39

agreed ... but I'm getting errors for classes from jetty, antlr, etc. I suspect it's related to logging: this nonsense started a bit after I tried to set up slf4j/logback/etc.

dpsutton17:02:19

are you making an uberjar or are you depending on an uberjar? I'm a bit confused where uber fits into this. As you're talking about how to get lein to get dependencies. So it sounds like regular repl development to me

mbarillier17:02:59

depending -- just trying to run some queries interactively in a clj scratch buffer

dpsutton17:02:42

and you added all of your deps to the :dependencies vector in your project.clj? I'm confused why you think :resource-paths is the way to go

mbarillier17:02:25

what's the proper way to add a java .jar to the runtime classpath?

dpsutton17:02:00

a local jar or a jar that has coordinates on maven?

mbarillier17:02:27

local ... though it may be on maven as well, didn't look. I've got local copies of hive and hadoop in $HOME/opt/ (older versions to match the versions we're running in prod).\

mbarillier17:02:05

yeah, version's listed in maven central -- will give that a shot.

dpsutton17:02:45

simplest option is to just add the deps you require to your dependencies vector specifying the versions that you need. this will get all transitive deps required by those. if you have jars locally it gets a bit more complicated with lein it seems. reading a stack overflow example that mentions the runtime trick of using :resource-paths but if you make your own uberjar it will put the jars in the jar and not the classfiles

dpsutton17:02:56

the suggested fixes seem to be to set up your own private repo to serve the deps which seems strange. but that gets into more java world than i'm familiar with. I do remember from my time in .NET that nuget makes it far easier to treat a directory with packages in it as a repo. seems kinda heavy

noisesmith17:02:05

the advantage of having a private repo for the deps is that it makes a "build" a transparent and repeatable thing, if every dev / CI task uses the same repo every build will produce the same result

noisesmith17:02:41

it reduces the complexity of every dev / CI setup, at the cost of being one more service to install and configure for global usage

noisesmith17:02:26

using the s3 wagon for example is trivial if you already use amazon s3 - no maven server needed, it just uses a plugin to treat s3 as a repo

dpsutton17:02:12

that makes sense. my mind went to treating a local directory as the repo so it completely avoided all the benefits you were touting

noisesmith17:02:51

right, that's just a re-shuffle of the "put all the jars you use in a folder" option, which is what you have to do without maven

noisesmith17:02:11

(it still does dep resolution thankfully...)

Ronny Li20:02:32

Hi everyone, I just got started using VisualVM which is awesome and it helped me identify that plumatic schema was slowing down my code a lot. After switching off schema validation my profiling results say that clojure.lang.RT.seq is the new bottleneck. Based on what you see here do you identify any "easy" optimization wins or should I quit while I'm ahead?

noisesmith20:02:52

@ronny463 this is where normal profiling gets weird in clojure - if you do work inside a lazy seq, then consume it later, the method that forces the data shows up as the one performing the work

😮 3
noisesmith20:02:38

but I've had decent luck with going down the list of hotspots until I find functions I wrote

Ronny Li20:02:33

ah okay! I was going to ask if you use different tools for profiling in Clojure

Ronny Li20:02:56

it sounds like you use something similar to visualvm but then you scroll down the hotspot list?

noisesmith20:02:44

there are good tools for micro-benchmarking (eg criterium) - I use the dump of a real profiler, find which of my code is up in that list, then microbenchmark, then attempt to speed it up and microbenchmark it again

noisesmith20:02:58

there are clojure specific profilers but I haven't used any of them in anger

noisesmith21:02:05

there are also disassembly tools, if reasoning about what your code does from first principles is failing and you'd rather read pseudocode derived from jvm assembly...

noisesmith21:02:33

also definitely turn on reflection and boxed math warnings

Alex Miller (Clojure team)21:02:22

you are still fighting the same thing you're seeing in visualvm though

dmillett21:02:43

I sometimes use this for looking at how quickly latency drops with number of calls. It's isolated though and not part of a larger ecosystem. https://github.com/dmillett/clash/blob/master/src/clash/tools.clj#L114

🙏 3
dmillett21:02:05

It might be useful for part of your case.