-
Notifications
You must be signed in to change notification settings - Fork 335
Redis序列化方式对比
xiaolyuh123 edited this page Dec 25, 2020
·
3 revisions
public class User implements Serializable {
public User() {
this.userId = 11L;
this.name = "name";
this.address = new Address();
this.lastName = new String[]{"w", "四川", "~!@#%……&*()——+{}:“?》:''\">?《~!@#$%^&*()_+{}\\"};
List<String> lastNameList = new ArrayList<>();
lastNameList.add("W");
lastNameList.add("成都");
this.lastNameList = lastNameList;
this.lastNameSet = new HashSet<>(lastNameList);
this.lastName = new String[]{"w", "四川", "~!@#%……&*()——+{}:“?》:''\">?《~!@#$%^&*()_+{}\\"};
this.age = 122;
this.height = 18.2;
this.income = new BigDecimal(22.22);
this.birthday = new Date();
}
private long userId;
private String name;
private Address address;
private String[] lastName;
private List<String> lastNameList;
private Set<String> lastNameSet;
private int age;
private double height;
private BigDecimal income;
private Date birthday;
public static class Address implements Serializable {
private String addredd;
public Address() {
this.addredd = "成都";
}
public String getAddredd() {
return addredd;
}
public void setAddredd(String addredd) {
this.addredd = addredd;
}
}
}
OS: mac os x
CPU: 2.6 GHz 六核Intel Core i7
内存: 16 GB 2667 MHz DDR4
size | serialize(get 10W次) | deserialize(set 10W次) | serialize(cup) | deserialize(cup) | |
---|---|---|---|---|---|
Kryo | 273 b | 82919 ms | 90917 ms | 8% | 12% |
FastJson | 329 b | 15405 ms | 18886 ms | 12% | 13% |
Jackson | 473 b | 16066 ms | 16140 ms | 15% | 14% |
Jdk | 1036 b | 17344 ms | 24917 ms | 14% | 13% |
Protostuff | 282 b | 14295 ms | 14355 ms | 15% | 13% |
作者博客:https://xiaolyuh.blog.csdn.net/
作者邮箱: [email protected]
github 地址:https://github.com/xiaolyuh/layering-cache
项目的发展离不开你的支持,请作者喝杯咖啡吧!
添加微信记得备注 layering-cache
。