package
Version:
v0.0.0-...-ed2f012
Opens a new window with list of versions in this module.
Published: Jul 22, 2020
License: MIT
Opens a new window with license information.
Imports: 6
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
¶
golang�����������л�ʱ����ʹ��gob��Ҳ����ʹ��json��
����֮�£�json�Ƚ����ͨ��һЩ����gob�������õ���һЩ��json��һ���Ƚϴ��������ǣ�mapֻ��ʹ��string key����gob����ʹ��int��Ϊkey��
һ����Ϊ�ձ��Ľ������£�
1 ������������ʱ�����糤��Ϊ10��slice��map��json���ٶ�ԶԶ����gob������������100����ʱ�������ٶ��൱������������������ʱ��gob�����ƾͱȽ������ˡ�
2 ��gob��Encode��decode������Ϊinterface{}��gob�ڸ���������������Ч�ʶ�����json����json����Ϊinterface{}��Ӱ�첻����
3��ʹ��gobʱ��Encode��Decode��ҪNewEncoder��NewDecoder����ҲӰ����gob����ʱ��Ч�ʣ�������stream��ʽ�£�ֻ��ҪNewEncoder,NewDecoderһ�Σ�gob��Ч�ʾ����ֳ����ˡ�
���Խ�����
-ni ����δʹ��interface{}������decodeʱ�Ľ���
golang�����������л�ʱ����ʹ��gob��Ҳ����ʹ��json�� ����֮�£�json�Ƚ����ͨ��һЩ����gob�������õ���һЩ��json��һ���Ƚϴ��������ǣ�mapֻ��ʹ��string key����gob����ʹ��int��Ϊkey�� һ����Ϊ�ձ��Ľ������£� 1 ������������ʱ�����糤��Ϊ10��slice��map��json���ٶ�ԶԶ����gob������������100����ʱ�������ٶ��൱������������������ʱ��gob�����ƾͱȽ������ˡ� 2 ��gob��Encode��decode������Ϊinterface{}��gob�ڸ���������������Ч�ʶ�����json����json����Ϊinterface{}��Ӱ�첻���� 3��ʹ��gobʱ��Encode��Decode��ҪNewEncoder��NewDecoder����ҲӰ����gob����ʱ��Ч�ʣ�������stream��ʽ�£�ֻ��ҪNewEncoder,NewDecoderһ�Σ�gob��Ч�ʾ����ֳ����ˡ� ���Խ����� -ni ����δʹ��interface{}������decodeʱ�Ľ��� === RUN TestBench Gob Encode []int(2000) : Total used: 1.2708419s , Per operation: 127084 ns/ops 10000 Gob Encode-ni []int(2000) : Total used: 1.1107361s , Per operation: 111073 ns/ops
Documentation
¶
type GobConnection interface {
Read() (msg message, err error)
Write(msg interface{}) (err error)
Close() error
LocalAddr() net.Addr
RemoteAddr() net.Addr
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.