I am curious because I am doing real-time financial data processing with sub-millisecond latencies just fine in Clojure. Admittedly, there’s no heavy number crunching in my use case.
At least it did in 2017. I haven’t used it since then.
Seq is extremely leaky, as whether or not a built in function takes a seq or a specific collection is undocumented and arbitrary. Hashmaps for example do not accept seqs when using “into”, it accepts vectors. So my code was littered with (into {} (map vec <thing>)). That’s a leaky abstraction.
You need to hint protocols if you want to go fast.
It took me watching the "transducers", "inside transducers" and "reducers" talks several times, before i realized that `into`, `transduce`, `eduction`, etc are the same family of functions, providing transducing contexts.
Despite that, I have no idea what are those issues in the critique above.
To me it smells like trying to do something forcefully, instead of stepping back and approaching the problem differently, in simpler ways.
Other way to avoid such issues is to formulate the problem clearly and ask it on a couple of forums, where more experienced Clojurists can answer it. This of course takes some time, sometimes hours, but it yields great results. I've received very insightful responses directly from authors of libraries on Github issues or Clojurians Slack and from Cognitect too about some advanced Datomic query technique.
I've noticed that some ppl, instead of asking for help, sweat out some convoluted, inconvenient way to solve a problem, then decide it's the only way to solve it in a specific language or with a library in question and they just keep copying that solution and teaching it to others too and constantly complain about it... It feels to me that OP might be in a similar situation to some extent.
I’m more than happy to explain the issues I had, but don’t imply that the problem is that I don’t know any better and I’m doing it wrong.
Usually the bulk of your perf. problem comes from a few hot places that are called often and the JVM needs to do reflection on those every time. Type-hint those and the performance usually goes through the roof.
In the end I retreated back to Java but even that is wrought with a number of performance issues due to its lack of contiguous arrays of complex types. I’m toying with Go as it’s a simple language that has far fewer performance surprises than most other popular high level languages. If that turns out disappointing I’m going back to where I started 24 years ago which was C++.
That said I found its performance still a bit on the wanting side particularly if you avoid type hints. For many tasks the performance is probably acceptable but the backend work I tend to do makes the abstract style get in the way of trying to figure out performance issues.
Also I'm coming around to the imperative style more and more. Sometimes a for loop is all that's needed and makes for a more understandable code than all those hipster maps and folds.