Live data from Hacker News

Scala Native v0.1

scala-lang.org

81–90 of 254 posts

Re: Scala Native v0.1

#81

Earlier quoted context omitted.

Servers very frequently benefit from lower memory footprints, as it can also dramatically improve performance by improving cache efficiency.

The large memory footprint of the JVM is memory for classes, profiles, things like that. Those are used to create optimised code and to recover when optimisations were too optimistic. When your program is optimised and running in steady state, this memory isn't actively used and so doesn't contend with your application memory and so has no impact on cache efficiency.

This sounds like a plausible explanation, but is this verified/verifiable? Are there memory profilers that can show me the relative sizes of the young/old/permanent generation segments of the GC?

I'm always blown away at the memory usage of JVM apps. Part of it is the fact that java has encouraged insanity-inducing inheritance hierarchies...but also it is incredibly hard to do dead code optimization on for such a static (type and compilation model) language (I blame dymanic classloading, but that's more of a guess than anything). Maybe what you're saying is the reason we don't see noticable GC pauses until you start seeing large amounts of data...but it is still a huge pain for low memory environments like phones, embedded devices, IoT, etc. And while memory usage is always gonna be higher on a GC'd language, the JVM still consumes vastly more memory than other languages like OCaml, D, Go, etc.

Re: Scala Native v0.1

#82
post #79

Unfortunately, this requires an existing Scala compiler to build, so it won't be useful as a bootstrap compiler for Scala on the JVM. Does anyone here know of an alternative implementation of Scala that could be used to build the libraries and tools of the reference implementation from source? It is a problem that many compilers cannot be bootstrapped from source without a trusted binary of a previous release.

It's a universal truism that all compilers cannot be bootstrapped from source without a trusted binary. It's true that in the world of standardized languages (which mostly means "C" in practice) there are compilers (mostly just gcc and clang) that can bootstrap themselves with a trusted binary of a previous release of some other compiler.

Is that such a big deal?

Re: Scala Native v0.1

#83
post #79

Unfortunately, this requires an existing Scala compiler to build, so it won't be useful as a bootstrap compiler for Scala on the JVM. Does anyone here know of an alternative implementation of Scala that could be used to build the libraries and tools of the reference implementation from source? It is a problem that many compilers cannot be bootstrapped from source without a trusted binary of a previous release.

how big of a problem is it, really?

is it a theoretical problem or a practical problem for industry users?

Re: Scala Native v0.1

#84
post #50

As a Scala guy on a Scala team, I'd think this would be most immediately useful on smaller fill-the-gaps sub-projects where we have to integrate with native code.

Looks like a good fit for the CLI we have been planning for our API bases on a Scala backend.

Re: Scala Native v0.1

#85

Will macros work with Scala Native, as they do with ScalaJs? (I believe that compile-time metaprogramming is the way forward, especially if the target doesn't support reflection or dynamic code loading).

If i recall correctly, they are planning to (or have already) remove macros in a newer version of Scala.

Yeah, the current macro system will be replaced with scala-meta, which is a different macro system, but it hasn't happened yet. Scala-meta doesn't have def macros yet, so it's not ready.

Re: Scala Native v0.1

#86
post #20

I can't get hello_world to work, something about a unresolved dependency: org.scala-native#sbt-Scalia-native;0.1.0: not found I'm not a regular Scala user.

I am a regular Scala user and I hate that message

Re: Scala Native v0.1

#87
post #44

Earlier quoted context omitted.

It looks like it can! http://www.scala-native.org/en/latest/user/interop.html >Scala Native provides an interop layer that makes it easy to interact with foreign native code. This includes C and other languages that can expose APIs via C ABI (e.g. C++, D, Rust etc.)

From that page, it looks like Scala-C interop is decent, but that's a far cry from C++/Rust interop. For C++ at least, you more or less need to write a pure-C wrapper API to call from Scala, since it doesn't handle C++ types.

Interesting, I guess I understood that wrong. Looks like no "easy" interop, but it's there if you really need it and don't mind the extra work.

I've been playing with this and trying to convert a ~20 line helper script that I use at work (and would really like to benefit from no JVM warmup time), and I've already run into missing core library functions like parallel collections and regexes.

This thing will be really great when it's ready, but it's not even close yet.

Re: Scala Native v0.1

#88
post #40

Question: what kind of frameworks can be practically migrated to Scala Native?

I think the dependencies (like Netty for a web framework) would have to be migrated first. Scala native has a subset of java core libraries (from e.g. io, nio, util) rewritten in Scala, which could be a blocker if there's anything missing.

Re: Scala Native v0.1

#89
post #33
post #29

It seems to me like Scala's biggest benefit and biggest downside are two sides of the same coin: easy interop with the JVM and Java code. Scala Native just seems like you're paying all the price of that for none of the benefit.

Well, this is just targeting a different VM, LLVM instead of the JVM. You get easy interop with all LLVM languages with this, including C.

You should really check your facts before posting a statement like this.

While the VM in LLVM historically was short for Virtual Machine, it really has nothing to do with that. It's a compiler backend used by Clang (C++ compiler) and Rust.

Re: Scala Native v0.1

#90
post #80
post #71

This will be huge for getting Scala running on AWS Lambda. The cold-start times for JVM apps is just ridiculous and makes Lambda/API gateway essentially unusable for anything written on the JVM.

Actually, there are people using Scala.js to run Scala on AWS lambda, precisely for that reason. * https://github.com/tptodorov/aws-lambda-scalajs * http://underscore.io/blog/posts/2016/03/21/serverless-scale-...

^ From the creator of Scala.js :)

I am excited that now there will be an option for getting both quick startup and fastest execution time!

Post reply on HN