3 ms·
I am calling in question validity of this project as a benchmark. The author asserts, that "it's virtually impossible to write allocation-free idiomatic Java c
by yc12340 7y ago
I am calling in question validity of this project as a benchmark.
The author asserts, that "it's virtually impossible to write allocation-free idiomatic Java code, so we still allocate... 20 bytes on average per forwarded packet". This sounds questionable, — does that mean, that he actually performs a JVM memory allocation for _every_ packet?! Furthermore, the specifics of memory management look murky. One implementation uses "volatile" C writes [1] (simply storing data to memory). Another implementations of the same thing uses a full CPU memory barrier [2]. Which one is right?
In my opinion, significant inconsistencies between implementations render any comparison between them invalid. And when a whole cross-language test suite is written by one person, you can be sure, that they don't really excel in many of those languages.
This is why I like Benchmark Game — all benchmarks are submitted by users, so they are a lot closer to how a real-world decent programmers can solve the problem. Still not perfect, but at least that counts as an attempt.
1: https://github.com/ixy-languages/ixy.java/blob/fcad50339e5372d7cc1cc53d7a7360bec04aaebd/ixy/src/main/java/de/tum/in/net/ixy/ixgbe/IxgbeTxQueue.java https://github.com/ixy-languages/ixy.java/blob/fcad50339e537...
2: https://github.com/ixy-languages/ixy.java/blob/fcad50339e5372d7cc1cc53d7a7360bec04aaebd/ixy/src/ixy/c/ixy.c https://github.com/ixy-languages/ixy.java/blob/fcad50339e537...
- masklinn 7y ago> The author asserts, that "it's virtually impossible to write allocation-free idiomatic Java code, so we still allocate... 20 bytes on average per forwarded packet". This sounds questionable The code is public, I'm sure they'd be happy to have your insight and fix this issue, it doesn't seem like they were happy about it.
- emmericp 7y agoJava reaches 52% of C speed in the benchmark game ("fastest measurement at the largest workload" data set, geometric mean), we reach 38%. Seems like our implementation is within a reasonable range for something that's usually not done in Java. A full memory barrier is not required, but some languages only offer that. For example, go had the same problem. It's not a bottleneck because it goes to MMIO PCIe space which is super slow anyways (awaits a whole PCIe roundtrip). And no, it obviously wasn't written by only one person but a team of 10. No, we are not saying that we allocate for every packet. We say that we allocate 20 bytes on average per packet.
- altfredd 7y agoJava support all sorts of memory barriers via VarHandles (see GET_OPAQUE/SET_OPAQUE). VarHandles can be created from contents of ByteBuffers: https://docs.oracle.com/javase/9/docs/api/java/lang/invoke/MethodHandles.html#byteBufferViewVarHandle-java.lang.Class-java.nio.ByteOrder- https://docs.oracle.com/javase/9/docs/api/java/lang/invoke/M...