Nov11 / kryo

Automatically exported from code.google.com/p/kryo
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

ArraySerializer is slow due to reflection #61

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
ArraySerializer is slow due to reflection:
Arrays.get and Arrays.set introduce quite some overhead according to profilers.

One way to solve the issue could be to avoid using reflection in simple, 
typical cases, i.e. for one-dimensional arrays.

I created a possible solution. The code can be found here:
https://github.com/romix/kryo/commit/0b92463995ef2dc867252e9a9596337dc87527ef

Original issue reported on code.google.com by romixlev on 3 May 2012 at 10:59

GoogleCodeExporter commented 8 years ago
Agreed, this can be improved, probably by having default serializers for 
particular array types (see DefaultSerializers.ByteArraySerializer).

Original comment by nathan.s...@gmail.com on 3 May 2012 at 10:00

GoogleCodeExporter commented 8 years ago
This issue was closed by revision r253.

Original comment by nathan.s...@gmail.com on 23 May 2012 at 10:24

GoogleCodeExporter commented 8 years ago
This issue was closed by revision r254.

Original comment by nathan.s...@gmail.com on 23 May 2012 at 10:46

GoogleCodeExporter commented 8 years ago
This ended up being a very nice fix. ArraySerializer is dead. There are 
efficient 1D array serializers for all primitives, String, and Object. >1D 
arrays are handled by these 1D serializers recursively. It's sweet. ;)

Original comment by nathan.s...@gmail.com on 23 May 2012 at 10:47