--
You received this message because you are subscribed to the "kryo-users" group.
http://groups.google.com/group/kryo-users
---
You received this message because you are subscribed to the Google Groups "kryo-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kryo-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the "kryo-users" group.
http://groups.google.com/group/kryo-users
---
You received this message because you are subscribed to the Google Groups "kryo-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kryo-users+...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to kryo-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the "kryo-users" group.
http://groups.google.com/group/kryo-users
---
You received this message because you are subscribed to the Google Groups "kryo-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kryo-users+unsubscribe@googlegroups.com.
More work has been done in the kryo-5.0.0-dev branch. I think it's pretty close to finished. Some notes:
- Reading ASCII strings no longer modifies the buffer.
It has the same serialized bytes but copies bytes to chars before creating the string. It's nice to remove this gotcha.
Output/Input classes now use little endian everywhere (previously everything was big endian, except var ints/longs).- ByteBufferInput/Output no longer rely on the buffer's byte order
(removes a bit of juggling, plus asXxxBuffer allocates), theinput/output positionand the buffer's position are kept in sync, and lots of other clean up.- writeInt(int, boolean) for letting the output decide if a fixed or variable length int is written is back. All inputs/outputs have setVariableLengthEncoding for ints and longs. Unsafe buffers don't turn this on by default, but doing so can be much faster (taking just 23% of the time in a very simple test, but of course producing larger output).
- Unsafe buffers are back.
As before, the downside to using these is that the deserializing computer's native byte order must match the serializing computer. With Java 10 and a simple benchmark, using unsafe buffers completes in 59% of the time as Output/Input. If variable encoding is disabled, unsafe buffers complete in just 16% of the time (woo!).
FieldSerializer can use Unsafe to read object fields again. Unlike unsafe buffers, using unsafe for this doesn't have any downsides. Currently it uses unsafe if possible, then ReflectASM if possible, then reflection as a last resort. Since it degrades gracefully, I'm not sure users ever need to disable unsafe or ReflectASM (though we might for tests). Are there ever cases where unsafe is worse than ReflectASM or reflection, or ReflectASM is worse than reflection? TBH with Java 10 and a simple benchmark, I don't see much difference between the three.
- I haven't added the FieldSerializer "memory regions" features back due to this ominous comment:
https://github.com/EsotericSoftware/kryo/blob/master/src/com/esotericsoftware/kryo/serializers/FieldSerializer.java#L92-L100
Leo, is this feature actually usable? Is anyone using it?
- Unsafe buffers are back.
As before, the downside to using these is that the deserializing computer's native byte order must match the serializing computer. With Java 10 and a simple benchmark, using unsafe buffers completes in 59% of the time as Output/Input. If variable encoding is disabled, unsafe buffers complete in just 16% of the time (woo!).I'm glad you changed your mind. I remember you didn't like Unsafe buffers first ;-) But in terms of performance they are hard to beat!
- I haven't added the FieldSerializer "memory regions" features back due to this ominous comment:
https://github.com/EsotericSoftware/kryo/blob/master/src/com/esotericsoftware/kryo/serializers/FieldSerializer.java#L92-L100
Leo, is this feature actually usable? Is anyone using it?No, I'm not aware of anyone really using it. It was more of implementing an optimization that could be potentially useful. So, if you simplified the code an removed it, that's fine.
Also, I really like your clean-ups of the code for handling generics. Great job!
Not sure why tagged would beat field, maybe because TaggedFieldSerializer has no subclasses?AFAIK Hotspot compiles to native depending on call frequence and does not care much about whether there's a subclass or not.
Details can vary considerably between JVM versions. E.g. for Java 8, compilation strategy is described in http://hg.openjdk.java.net/jdk8u/jdk8u/hotspot/file/2b2511bd3cc8/src/share/vm/runtime/advancedThresholdPolicy.hpp#l34 .
https://stackoverflow.com/a/35602023/6944068 mentions a case where escape analysis happened after a million iterations, long after a lot of other optimizations were done.
I think one really needs to know what the JIT of the JVM in question is doing: What mechanisms exist, which of them have kicked in and which haven't, that kind of stuff.
Lather, rinse, repeat for other JVM versions.
I suspect that a benchmark that aims at a single number per test is at best futile, at worst misleading (because you start optimizing the wrong cases).
1. I'd first define some use cases. One that comes to mind is high-throughput with a significant time spent inside Kryo. Another would be low-latency. All of them long-running.
2. I'd make time series. What's the metric initially, how does it change over time? That's going to give the users much more confidence in the results.
3. Graphs help tremendously in interpreting the numbers. If tests ran repeatedly, smoke graphs would be helpful, too. ("Smoke graph" is not a standard term, I mean graphs like those produced by "smoke ping", see https://www.google.com/imgres?imgurl=https%3A%2F%2Foss.oetiker.ch%2Fsmokeping%2Fdoc%2Freading_detail.png&imgrefurl=http%3A%2F%2Foss.oetiker.ch%2Fsmokeping%2Fdoc%2Freading.en.html&docid=HYqKuuEPsC7HEM&tbnid=AMRykYXB66kdPM%3A&vet=10ahUKEwj5seHZ0MjbAhWKK5oKHbZEBVAQMwg0KAAwAA..i&w=697&h=321&client=ubuntu&bih=906&biw=1541&q=%22smoke%20graph%22&ved=0ahUKEwj5seHZ0MjbAhWKK5oKHbZEBVAQMwg0KAAwAA&iact=mrc&uact=8 for a list of examples.)
--
You received this message because you are subscribed to the "kryo-users" group.
http://groups.google.com/group/kryo-users
---
You received this message because you are subscribed to the Google Groups "kryo-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kryo-users+...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to kryo-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the "kryo-users" group.
http://groups.google.com/group/kryo-users
---
You received this message because you are subscribed to the Google Groups "kryo-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kryo-users+unsubscribe@googlegroups.com.