chaokunyang commented on issue #1994:
URL: https://github.com/apache/fury/issues/1994#issuecomment-2571308329
Seems your benchmark doesn't collect correct metrics. If you use jmh to
test, you will find out fury is 4x faster than kryo:
```java
package jim.serialization.core;
import jim.serialization.core.codec.FurySerializeUtil;
import jim.serialization.core.codec.NeoRedisValueCodecHelper;
import jim.serialization.core.enums.RedisCodecType;
import jim.serialization.core.model.NeoSerializerModel;
import org.openjdk.jmh.Main;
import org.openjdk.jmh.annotations.BenchmarkMode;
import org.openjdk.jmh.annotations.CompilerControl;
import org.openjdk.jmh.annotations.Mode;
import org.openjdk.jmh.infra.Blackhole;
import java.io.IOException;
import static jim.serialization.core.RunTest.createModel;
@BenchmarkMode(Mode.Throughput)
@CompilerControl(value = CompilerControl.Mode.INLINE)
public class Benchmark {
static NeoSerializerModel serializerModel;
static {
serializerModel = createModel();
FurySerializeUtil.registerClass(NeoSerializerModel.class);
}
@org.openjdk.jmh.annotations.Benchmark
public Object benchmarkKryo(Blackhole blackhole) {
byte[] tmpBytes =
NeoRedisValueCodecHelper.encodeToBytes(serializerModel, RedisCodecType.KRYO);
return NeoRedisValueCodecHelper.decodeFromBytes(tmpBytes,
RedisCodecType.KRYO, NeoSerializerModel.class);
}
@org.openjdk.jmh.annotations.Benchmark
public Object benchmarkFury(Blackhole blackhole) {
byte[] tmpBytes =
NeoRedisValueCodecHelper.encodeToBytes(serializerModel, RedisCodecType.FURY);
return NeoRedisValueCodecHelper.decodeFromBytes(tmpBytes,
RedisCodecType.FURY, NeoSerializerModel.class);
}
public static void main(String[] args) throws IOException {
if (args.length == 0) {
String commandLine =
" -f 1 -wi 5 -i 10 -t 1 -w 2s -r 2s -rf csv ";
System.out.println(commandLine);
args = commandLine.split(" ");
}
Main.main(args);
}
}
```
```java
Benchmark Mode Cnt Score Error Units
Benchmark.benchmarkFury thrpt 10 249240.339 ± 47699.519 ops/s
Benchmark.benchmarkKryo thrpt 10 70397.901 ± 9909.524 ops/s
```

--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]