HNHacker News
TopNewBestAskShowJobs

kasperni

4,212 karma · joined April 5, 2016

submissionscomments
kasperni··on Taking Magnesium tablet everyday changes my life
> A year ago, I was just looking for why I get these leg cramps every 2 days, someone suggested taking Magnesium and Vitamin B - This was the turning point.

I know Holger Rune (Worlds nr 8 in Tennis) was dealing a lot with cramps in his earlier career. Based on some blood tests, he started taking magnesium recently which resolved the issues he had.

kasperni··on Java 20 / JDK 20: General Availability
The feature everyone is excited about is Virtual Threads. Something where .NET is still playing catch-up https://twitter.com/davidfowl/status/1532880744732758018.
kasperni··on How to explain the Monty Hall problem to a disbeliever
> Your sentence the particular way you worded it is not the correct mathematical model.

It wasn't really my sentence I just quoted the article. Nonetheless I disagree with you. The probability that the other boxes have the key is 2/3 and that is all that really matters. Opening a door doesn't change anything.

kasperni··on How to explain the Monty Hall problem to a disbeliever
I think their explanation is a lot easier to understand

"When we pick the original box, we know that the probability that the keys will be in there is 1/3. The probability that the keys will not be in the box you originally chose is 1 - 1/3 = 2/3. Just from this knowledge alone, you could decide that you will always switch, since the probability that the other boxes have the keys is 2/3."

kasperni··on Overhead of Returning Optional Values in Java and Rust (2021)
Realising that my formatting is difficult to understand if you have not used JMH previously. I've cleaned up the numbers:

                  Pre Valhalla   | Valhalla

  sumSimple       328,110 us/op  | 327,927 us/op

  sumOptionalLong 1201,987 us/op | 326,949 us/op

  sumNulls        570,800 us/op  | 584,967 us/op

  sumOptional     2223,887 us/op | 572,833 us/op
kasperni··on Overhead of Returning Optional Values in Java and Rust (2021)
It it the number of non-warmup-runs for the benchmarking tool (JMH). The original article included them as well so thought I would just post the numbers in the same format here. But I totally understand that they are confusing if you are not in the Java ecosystem.
kasperni··on Overhead of Returning Optional Values in Java and Rust (2021)
Right, it is the output from JMH (Java Microbenchmark Harness) which includes the number of non-warmup-runs before the actual score.

The original article included them as well so thought I would just post the numbers in the same format here.

kasperni··on Overhead of Returning Optional Values in Java and Rust (2021)
Could you tell me exactly what is the issue?

sumNullsValhalla and sumOptionalValhalla returns 584,967 us/op and 572,833 us/op respectively

sumSimpleValhalla and sumOptionalLongValhalla returns 327,927 us/op and 326,949 us/op respectively

kasperni··on Overhead of Returning Optional Values in Java and Rust (2021)
Optional is being being converted to a value class as part of Project Valhalla. I reran the benchmarks with the latest Valhalla branch [1] and added a test that used OptionalLong instead of Optional<Long>.

Without Valhalla

- OptionBenchmark.sumSimple avgt 5 328,110 us/op

- OptionBenchmark.sumNulls avgt 5 570,800 us/op

- OptionBenchmark.sumOptional avgt 5 2223,887 us/op

- OptionBenchmark.sumOptionalLong avgt 5 1201,987 us/op

With Valhalla

- OptionBenchmark.sumSimpleValhalla avgt 5 327,927 us/op

- OptionBenchmark.sumNullsValhalla avgt 5 584,967 us/op

- OptionBenchmark.sumOptionalValhalla avgt 5 572,833 us/op

- OptionBenchmark.sumOptionalLongValhalla avgt 5 326,949 us/op

OptionalLong is now as fast as simple sum. And SumOptional is now as fast as SumNulls. So the overhead of using OptionalLong and Optional<Long> seems to have gone away with Valhalla.

It would be great if boxing could be eliminated as well. But few people writes code like what is being benchmarked (in hot loops) in practice.

[1] https://github.com/openjdk/valhalla

kasperni··on Dansk and the Promise of a Simple Scandinavian Life
https://archive.ph/KsntF
kasperni··on WebContainer API
I like the website layout. Knowing little about Web development. Is this custom made or using some kind of framework/template?
kasperni··on What is .NET, and why should you choose it?
> It is very hard explaining to Java programmers why Java is so bad

Referencing a short story doesn't really explain it to anyone.

kasperni··on Ask HN: Advice from people who strength train from home
Check out https://gmb.io/ and their elements program it is a great starter program with a schedule. You will get a really good mix of strength, movement and flexibility training. And it is a great base for getting into calisthenics if you want to get more serious.

There is no need to buy any equipment. You just need some floor space.

I think starting out with some kind of program as a beginner. Is a lot better than just buying a bunch of equipment and watching a lot of random YouTube videos. You will quickly get overwhelmed.

Also maybe start focusing on a routine first for a couple of months, and then look into your diet. Doing both at the same time as a complete beginner can quickly lead to information overload.

kasperni··on YouTube has become the world's nanny
> Is the kid not capable of quietly playing with their toys?

You don't have kids right?

kasperni··on YouTube has become the world's nanny
For people cooking alone with a kid. How do you entertain them while cooking without screentime? Kid is 16 months. Too old to lie still, and too young to help out in any capacity without getting injured.

Edit: Letting them play with utensils gives me about 2-3 minutes.

kasperni··on Oracle per-employee Java pricing causes concern
JDK 19 and JDK 17 binaries are free to use in production and free to redistribute, at no cost, under the Oracle No-Fee Terms and Conditions [1].

This license change concerns people who have a subscription service with Oracle.

[1] https://www.oracle.com/uk/java/technologies/downloads/#java1...

kasperni··on Oracle per-employee Java pricing causes concern
Actually, Oracle JDK are free for anyone. This only concerns people who have a Java SE Universal subscription.
kasperni··on No, you can’t manufacture that like Apple does (2014)
> It stood out to me that the author of the post is the COO at a meditation service start-up, not a manufacturing one... Unless Ten Percent Happier is making physical products that I'm unaware of.

The guy started bolt.io. A VC for hardware based startups and got $100 million funding. So I think he knows a thing or two about manufacturing.

kasperni··on Java is in decline, and there's data to prove it
Custom schedulers are coming later with Project Loom. Should be fairly easy to create something where particular threads could have a higher/lower priority.
kasperni··on Java is in decline, and there's data to prove it
> won't catch-up because the language itself has some pain points like type erasure, nullable references (even C# got rid of that), etc. and that won't change ever.

I wouldn't be so sure if I was you. A lot of work is being put into JSpecify [1] lead by Google and with most major players in the Java ecosystem participating. If it is a success we might see it in the language one day and not just with annotations.

[1] https://jspecify.dev/

kasperni··on WebAssembly for the Java Geek
From another comment > Meaning you cannot type new in a method only in the class definition.

How would you handle the ~ 1000 java.x classes that even a minimal HelloWorld programs uses. There are plenty of random allocation.

kasperni··on OpenJDK Proposes Project Galahad to Merge GraalVM Native Compilation
> Currently about 1% of the JVM runtime is implemented in C

The JIT is probably half of the VM and is written in C++.

Github [1] says (for the whole JDK, not just the VM): Java 75.1% C++ 13.4% C 7.4% Assembly 2.3% Objective-C 0.4%

[1] https://github.com/openjdk/jdk

kasperni··on OpenJDK Proposes Project Galahad to Merge GraalVM Native Compilation
There are no plans to move Truffle to OpenJDK.
kasperni··on OpenJDK Proposes Project Galahad to Merge GraalVM Native Compilation
The title of the article is a bit misleading. The goal is first to merge GraalVMs JIT compiler (as an alternative to C2). Then later to bring in the AOT compiler.
kasperni··on Is Europe just not good at innovating?
Honestly, outside of banking the U.K. is a 3rd world country digital service wise. A lot of countries in the EU have had digital identies for more than 15 years. The U.K hasn't even started.

You want to signup for a digital service from the government, your bank, your insurance company,.. . Well you need to send in a copy of a bill and your passport. And then they will give you a separate login for every service. And it is not even like there are many services you can use.

In Denmark, for example, all communication with the government has been digital for almost 10 years, unless you are exempt. In the U.K. I've experienced places where I had to send in a physical letter.

So yeah, banking is fine, but that is about it. In other places they are at least 10 years behind similar countries.

kasperni··on New Zealand bans young people from buying cigarettes for life
> What's G?

https://en.wikipedia.org/wiki/Gamma-Hydroxybutyric_acid

kasperni··on New GPT-3 model: text-DaVinci-003
Stole your promt and replaced it with a turing machine.

"Write a short rhyming poem explain a turing machine in easy but accurate terms"

A Turing machine is quite a feat

It can compute things quite discrete

It helps us solve problems of all sorts

And keeps us from feeling like we're in a court

It can be represented with a tape

And even replaced if we feel the need to escape

It's a model of computation to which we can relate

kasperni··on Scala 3 is not production ready
> Fibers have finally landed, about a decade later than promised, but the ecosystem hasn't even begun to adopt them yet and who knows what edge cases or issues may turn up.

First, Project Loom was announced in late 2017 [1]. So I don't really understand where you get that decade from? Second, it is available as a preview feature in latest JDK. Why would people adopt a preview feature in their production systems? A lot of frameworks have already added support or as a minimum started working on support for virtual threads. I'm sure all major frameworks will support them once they are out of preview.

[1] https://cr.openjdk.java.net/~rpressler/loom/loom/sol1_part1....

kasperni··on Swarm – Low cost, global satellite connectivity for IoT
It is a wholly-owned subsidiary of SpaceX [1].

[1] https://en.wikipedia.org/wiki/Swarm_Technologies

kasperni··on GraalVM 22.3: JDK 19 builds, jlink support, new monitoring features, and more
GraalVM comes with its own JIT the Graal Compiler [1] which I believe was what metadat was talking about. You are probably thinking about the native image generation which can cause issues with reflection and other dynamic constructs.

[1] https://www.graalvm.org/22.3/reference-manual/java/compiler/

← PreviousPage 5 of 19Next →