perf[protocol]: 更新文档

This commit is contained in:
jaysunxiao
2022-05-25 22:24:15 +08:00
parent dbfad5abf5
commit c774bd7529
6 changed files with 52 additions and 49 deletions
@@ -15,10 +15,8 @@ package com.zfoo.protocol;
import com.esotericsoftware.kryo.Kryo;
import com.esotericsoftware.kryo.io.ByteBufferInput;
import com.esotericsoftware.kryo.io.ByteBufferOutput;
import com.esotericsoftware.kryo.io.Input;
import com.esotericsoftware.kryo.io.Output;
import com.esotericsoftware.kryo.unsafe.UnsafeInput;
import com.esotericsoftware.kryo.unsafe.UnsafeOutput;
import com.google.protobuf.ByteString;
import com.google.protobuf.CodedInputStream;
import com.google.protobuf.CodedOutputStream;
@@ -33,7 +31,6 @@ import io.netty.buffer.UnpooledUnsafeHeapByteBuf;
import org.junit.Ignore;
import org.junit.Test;
import java.nio.ByteBuffer;
import java.util.*;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
@@ -54,8 +51,8 @@ public class SpeedTest {
* <p>
* 包体大小:
* 简单对象,zfoo包体大小8kryo包体大小5protobuf包体大小8
* 常规对象,zfoo包体大小547kryo包体大小594protobuf包体大小984
* 复杂对象,zfoo包体大小2214kryo包体大小2525protobuf包体大小5091
* 常规对象,zfoo包体大小430kryo包体大小483protobuf包体大小793
* 复杂对象,zfoo包体大小2216kryo包体大小2528protobuf包体大小5091
*/
@Ignore
@Test
@@ -140,8 +137,8 @@ public class SpeedTest {
public void kryoTest() {
var kryo = kryos.get();
var output = new Output(1024 * 8);
var input = new Input(output.getBuffer());
var output = new UnsafeOutput(1024 * 8);
var input = new UnsafeInput(output.getBuffer());
// 序列化和反序列化简单对象
long startTime = System.currentTimeMillis();