News for hackers. Stuff that matters.
Re:Why did Clojure gain so much popularity? by pron on Tuesday April 23, 2019 @08:52AM (#19728064)
> But so are other stacks.

Not really. Few if any platforms compete with the JVM on performance and observability (monitoring/management) and ecosystem. It's technologically head and shoulders above pretty much all other runtimes (e.g. BEAM has excellent observability, but loses big time on performance and ecosystem). Also, if you're OK with the JVM running at BEAM speeds, you can give it far less memory.

Re:Why did Clojure gain so much popularity? by gameswithgo on Tuesday April 23, 2019 @09:28AM (#19728345)
.NET has come up on par, or slightly better than, the JVM in recent years in terms of performance. Ecosystem may not be as big but its pretty well fleshed out.
Re:Why did Clojure gain so much popularity? by pron on Tuesday April 23, 2019 @11:35AM (#19729618)
.NET is the only runtime that comes close. Unfortunately, some early design decisions (reified generics) make language interop on the CLR much more cumbersome than on the JVM. Clojure in particular makes heavy use of the fact that a Clojure map/list/set is a Java map/list/set. This is awkward on the CLR (where you must specialize the collection).
Re:Why did Clojure gain so much popularity? by didibus on Tuesday April 23, 2019 @12:43PM (#19730326)
ClojureCLR exists as well, to target the .net CLR VM.

It's an official dialect: https://clojure.org/about/clojureclr

Re:Why did Clojure gain so much popularity? by yogthos on Tuesday April 23, 2019 @04:28PM (#19732500)
There's also [MAGIC](https://github.com/nasser/magic) compiler that Ramsey Nasser of Arcadia fame is working on.
Re:Why did Clojure gain so much popularity? by iLemming on Tuesday April 23, 2019 @03:20PM (#19731925)
Initial implementation of Clojure targeted CLR and JVM. Urban legend says: Rich Hickey named the language "Clojure" because it has 'c', 'l', 'r' and 'j' in it.
Re:Why did Clojure gain so much popularity? by rcarmo on Wednesday April 24, 2019 @02:46AM (#19736127)
I have found that quite hard to get working in various aspects (from runtime installation to package management and compatibility with the rest of the ecosystem).
Re:Why did Clojure gain so much popularity? by pron on Tuesday April 23, 2019 @01:16PM (#19730709)
Re:Why did Clojure gain so much popularity? by dhruvmittal on Tuesday April 23, 2019 @10:42AM (#19729088)
At my last job, I was a C#/F# dev. Recently changed jobs and learned that even in 2018, .NET is a dirty word at many companies.
Re:Why did Clojure gain so much popularity? by adambard on Tuesday April 23, 2019 @12:35PM (#19730220)
.NET-the-technology is pretty good, but for many developers, .NET is synonymous with expensive licensing and tooling (and you pretty much have to use Windows, ick).

The JVM and .NET are presently about the same capability-wise, but Java is (or at least, is perceived as) much easier and cheaper to freely experiment with. Unless you need to use C# for some deep Windows integration, this makes Java the obvious choice for anyone without sunk costs in the .NET ecosystem.

Re:Why did Clojure gain so much popularity? by h_r on Wednesday April 24, 2019 @05:14PM (#19742647)
You are aware of .net core right? We're deploying services using linux docker containers. And I'm having a blast writing my macos utilities in f#
Re:Why did Clojure gain so much popularity? by rhizome31 on Tuesday April 23, 2019 @08:58AM (#19728117)
> Also, if you're OK with the JVM running at BEAM speeds, you can give it far less memory.

I'm curious about this. How do you do it in practice? Doesn't it just crash with OutOfMemory errors when it runs out of memory?

Re:Why did Clojure gain so much popularity? by bad_user on Tuesday April 23, 2019 @09:26AM (#19728329)
The JVM doesn't use more memory than other virtual machines, the problem is that it doesn't release memory back to the operating system, which is why it is being configured with a maximum heap size. Also compacting garbage collectors need more memory available for de-fragmenting the heap.

I've been running a simple JVM web app on my own personal server with an allocated 128 MB of RAM and a lot of that is actually unused. You can do a lot with a heap of just 64 MB.

People aren't aware, but when running your average PHP app you need more than that with just a couple of requests done at the same time, whereas my JVM server can easily handle 1000 requests per second. Similarly Ruby or Python apps can be big resource hogs, especially when you end up setting up multiple parallel processes.

I was also surprised to find that compilation to "native" isn't necessarily efficient in terms of used memory. I've built a similar app in Haskell and the used memory ended up being higher and more unpredictable. If something like Go fares better, it's not because it is compiled to native.

All in all the JVM is actually quite efficient in terms of used memory, for a garbage collected language ;-)

Re:Why did Clojure gain so much popularity? by brazzy on Tuesday April 23, 2019 @10:44AM (#19729099)
> The JVM doesn't use more memory than other virtual machines, the problem is that it doesn't release memory back to the operating system

This is untrue. The default configuration is just to do it very reluctantly, but this can be changed.

Re:Why did Clojure gain so much popularity? by cutler on Tuesday April 23, 2019 @12:02PM (#19729884)
I'm intrigued. Was your "simple JVM web app" written in Java? What kind of JVM optimisations were used and do these also apply to Clojure?
Re:Why did Clojure gain so much popularity? by liveoneggs on Tuesday April 23, 2019 @11:24AM (#19729518)
I like how you think 64MB is small
Re:Why did Clojure gain so much popularity? by cutler on Tuesday April 23, 2019 @12:04PM (#19729910)
Considering Hetzner (hetzner.com) offer VPSs with 2Gb RAM for 2.99 Euros per month I think it's fair to say we've left the 90s behind as far as RAM is concerned.
Re:Why did Clojure gain so much popularity? by thomascgalvin on Tuesday April 23, 2019 @11:57AM (#19729832)
I mean I have 64 gigs of ram on my personal desktop. RAM is cheap, and there are a lot of problems that can be solved by throwing more RAM at it.
Re:Why did Clojure gain so much popularity? by pron on Tuesday April 23, 2019 @11:33AM (#19729607)
You get an OOM if your working set is larger than the heap. Otherwise, the GC just works harder, reducing your performance. Generally, the JVM uses as much memory as you let it.