←back to thread

Scala 3 slowed us down?

(kmaliszewski9.github.io)
261 points kmaliszewski | 3 comments | | HN request time: 0.001s | source
Show context
munchler ◴[] No.46183417[source]
I’m not familiar with Scala’s macro system, but it seems like a big takeaway here is: Be careful with code that invokes the compiler (JIT) at runtime. That seems like it’s asking for trouble.
replies(1): >>46183886 #
dtech ◴[] No.46183886[source]
Macro's are compile time, there is no runtime codegen.

The problem was overly-frequent inlining generating enormous expressions, causing a lot JIT phase and slow execution.

replies(2): >>46183957 #>>46185245 #
1. gavinray ◴[] No.46185245[source]
That's not true, Spark's entire query engine relies on use of runtime codegen via macros/quasi quotes

Look up the architecture of Catalyst + Tungsten

https://www.databricks.com/glossary/catalyst-optimizer

replies(2): >>46187183 #>>46211270 #
2. lmm ◴[] No.46187183[source]
Catalyst uses runtime codegen, sure, but the OP wasn't using that.
3. still_grokking ◴[] No.46211270[source]
Scala 2's macros are compile time constructs. There is no runtime code generation / staging.

Scala 3's macros support staged compilation, so you can have macros which create code in later stages at runtime.

https://docs.scala-lang.org/scala3/reference/metaprogramming...