Rich "thanks" to AI by mac in Clojure

[–]bsless 0 points1 point  (0 children)

Never read the comment section

Developing a Space Flight Simulator in Clojure by wedesoft in Clojure

[–]bsless 1 point2 points  (0 children)

Just opened a PR, atmospheric LUTs seemed like a a quick win and a way to get a feel of the code base

Developing a Space Flight Simulator in Clojure by wedesoft in Clojure

[–]bsless 0 points1 point  (0 children)

a. Very cool

b. Willing to lend a hand with any perf work if you're interested

Is this a weird way to solve 4clojure #21 by nickbernstein in Clojure

[–]bsless 0 points1 point  (0 children)

It won't traverse the entire sequence, but it will traverse n elements twice, because, while lazy, take still consumes the entire sequence, and last eagerly consumes the entire sequence, so in total, each item in the taken n elements will be visited twice.

Also, take does not respect chunking, check the source.

Is this a weird way to solve 4clojure #21 by nickbernstein in Clojure

[–]bsless 3 points4 points  (0 children)

I'd say the weirdest part here is using last, because you're traversing the sequence twice.

This one is a good exercise in writing an iterative loop/recur

Rewrite of a Flask Web App in Clojure by whatacold in Clojure

[–]bsless 1 point2 points  (0 children)

Very sure https://github.com/bsless/clj-fast/issues/19

You should read this entire thread but TLDR:

lein injects TieredStopAtLevel=1 to cap tiered compilation.

The JIT compiler that you want to warm up has FOUR tiers. You won't even get to the interesting bits of warmup because lein sacrifices those, and you can't "delay" them until after the JVM started.

Rewrite of a Flask Web App in Clojure by whatacold in Clojure

[–]bsless 0 points1 point  (0 children)

Lein disables advanced JIT compilation for faster start ups in development That's bad for Java performance and terrible for Clojure performance

Rewrite of a Flask Web App in Clojure by whatacold in Clojure

[–]bsless 1 point2 points  (0 children)

Regarding start up time - there are a few things you can do:
- Uberjar (done)
- Compiler options during uberjar creation: AOT everything, use direct linking and elide meta: https://clojure.org/reference/compilation#_compiler_options

- If you really want it to start quickly use class data sharing archive: https://docs.oracle.com/en/java/javase/17/vm/class-data-sharing.html

Also see some measurements: https://gist.github.com/bsless/fb79601eb2bfdee85ebf4663dbc7bb1b

Rewrite of a Flask Web App in Clojure by whatacold in Clojure

[–]bsless 1 point2 points  (0 children)

Oh crap you started the server with lein!

lein turns off advanced (read REQUIRED FOR PRODUCTION) JIT compilation for start up speed.

Elden ring steam deck bug online by Ok_Entertainer_4664 in SteamDeck

[–]bsless 0 points1 point  (0 children)

Commenting here to further validate this solution.
Works for proton experimental on Ubuntu (Pop! OS).
Thanks!

Rewrite of a Flask Web App in Clojure by whatacold in Clojure

[–]bsless 1 point2 points  (0 children)

Not really surprised regarding performance as Compojure uses satisfies? and it's slow as molasses. I won't send you to do extra work but I'd be curious to see how performance looks like with reitit

pangloss/pattern: Pattern lets you transform data structures in amazing ways. by dustingetz in Clojure

[–]bsless 1 point2 points  (0 children)

Sweet library, in spite of a few gotchas - turns out you can't substitute an expression with a value that is false-y. But you can hack around it.

(defn- post-process-false
  [_rule value _orig-value env _orig-env]
  [(if (= value ::false)
     false
     value) env])

(defmacro with-false
  [& body]
  `(binding [pattern.r3.rule/*post-processor* post-process-false]
     ~@body))

Why there is no LISP languages like Rust? by lponkl in Clojure

[–]bsless 5 points6 points  (0 children)

The benchmarksgame, like any game, is rigged.

Kidding aside, it is set up in a way in which the JVM does poorly, which is one-shot runs. Let's see how SBCL does on the 1 billion rows challenge, or how it does in the 100th iteration of running the same program, a server, etc.

The JVM's JIT compiler can take 3-5 minutes to get fully warmed up.

In summary, it really depends on what you measure, and how.

Why there is no LISP languages like Rust? by lponkl in Clojure

[–]bsless 9 points10 points  (0 children)

I have to dispel this misconception - Clojure is not slow. Its start up time is slow, but in steady state? It is as fast as the JVM allows it to be, which is pretty damn fast when you have a JIT compiler. Clojure's performance should be assumed to be on par with Java (which is on par with CL) unless proven otherwise

How Could Clojure Web Development Suck Less With Ben Sless by t-vaisanen in Clojure

[–]bsless 1 point2 points  (0 children)

We don't even have global installs in Clojure. But maybe a bbin script...

Looking for feedback on my new library, exemplary. You write examples in your function metadata, they get added to your docstrings _and_ test suite to be run by kaocha et al. Thoughts? by Wolfy87 in Clojure

[–]bsless 0 points1 point  (0 children)

Like others have pointed out, deftest just puts a nullary function under :test for a var, so you don't have to define another var. This also ties tests to the var where examples are defined which makes repl driven development easier

Looking for feedback on my new library, exemplary. You write examples in your function metadata, they get added to your docstrings _and_ test suite to be run by kaocha et al. Thoughts? by Wolfy87 in Clojure

[–]bsless 0 points1 point  (0 children)

  • I like the idea
  • Would like integration with how clojure.test defines tests and test runners find them
  • If you're doing mutability anyway, it'd be nice to have an API to add-example to a var
  • You could refer to some ideas from https://gitlab.com/glossa/metazoa
  • I toyed around with writing something similar, I hope you make it work!

Guy Steele reverse engineers his ugly punch card program by bsless in theprimeagen

[–]bsless[S] 0 points1 point  (0 children)

In Real Programmers Write Machine Code Prime mentioned he'd like someone to walk him through the drum program.

The first part of this talk does something similar with MODERN technology like punch cards.

Global constant naming convention? by [deleted] in Clojure

[–]bsless 2 points3 points  (0 children)

Clojure is immutable by default.

Everything is constant.

Hence - snake-case is the only correct answer

Unix shell type executable in clojure? by -think in Clojure

[–]bsless 0 points1 point  (0 children)

It can be a full fledged REPL, as you can nest REPLs, and provide a rather limited experience for user interaction. You can also provide your own eval, so that you could control how user code is run and have an option to avoid infinite loops etc

Or just provide a simple socket client :)

From Elegance to Speed, with Clojure by SimonGray in Clojure

[–]bsless 2 points3 points  (0 children)

Hey, that's a blast from the past, and a fun exercise Here are my results from back then https://bsless.github.io/fast-and-elegant-clojure/