实验目标
- 测试不同数据结构的内存占用情况
- 测试不同读写比下不同数据结构的读写性能
实验环境
- OS: mac OS
- memory:8G
- CPU:双核 2.7 GHz Intel Core i5
- java version: 1.8.074
内存占用
单序列一百万个点
Array: 4MB
SkipList:52MB (Integer:16MB, SkipListNode:36MB)
十万序列每序列十个点
SkipList:59.6 MB (SkipList: 58MB, ref: 1.6MB)
Array: 5.6MB (data: 4MB, ref: 1.6MB)
单线程写入+查询
单序列一千万个点
写入
Array:360ms
SkipList:8921ms
查询
Array:449ms
SkipList:76ms
十万序列每序列一百个点
写入
Array:429ms
SkipList:10129ms
查询
Array:449ms
SkipList:76ms
并发写入+查询
测试方法
单线程写入,同时匹配n个线程查询,测试在有查询的负载下,写入线程最终完成写入的总时间
单序列一千万个点
n = 1
Array:528ms
SkipList: 12413ms
n = 3
Array:702ms
SkipList: 14202ms
n = 5
Array:1131ms
SkipList: 16304ms
十万序列每序列一百个点
n = 1
Array:1056ms
SkipList:10243ms
n = 3
Array:1539ms
SkipList:11620ms
n = 5
Array:2064ms
SkipList:13714ms