elixir基准测试记录
elixir基准测试
测试变量
Operating System: Linux" CPU Information: Intel(R) Core(TM) i7-7700 CPU @ 3.60GHz Number of Available Cores: 8 Available memory: 11.70 GB Elixir 1.7.3 Erlang 21.0
总表
操作 | 耗时 |
---|---|
10 members lists ++ 100 members lists | 0.02μs |
100w process dict get/put/delete | 0.03μs |
map get | 0.03μs |
map put/delete | 0.05μs |
100w ets set/bag/duplicate_bag read | 0.1μs |
100 members lists ++ 10 members lists | 0.02μs |
100w ets ordered_set read | 0.3μs |
keyfind 1000 pos at 500 | 1.5μs |
spawn 进程 | 2μs |
ets
100w条数据的ets表. 100次读取耗时如下.
Name ips average deviation median 99th % ets_bag_without_read_concurrency 75.57 K 13.23 μs ±106.18% 12 μs 47 μs ets_set_without_read_concurrency 75.45 K 13.25 μs ±125.17% 11 μs 55 μs ets_duplicate_bag_without_read_concurrency 68.65 K 14.57 μs ±134.46% 12 μs 66 μs ets_duplicate_bag_with_read_concurrency 61.99 K 16.13 μs ±93.12% 14 μs 54 μs ets_bag_with_read_concurrency 61.13 K 16.36 μs ±96.35% 15 μs 54 μs ets_set_with_read_concurrency 58.37 K 17.13 μs ±114.66% 14 μs 65 μs ets_ordered_set_without_read_concurrency 24.44 K 40.92 μs ±83.32% 32 μs 162 μs ets_ordered_set_with_read_concurrency 23.70 K 42.20 μs ±59.90% 35 μs 129 μs
100w条数据的ets表. 4进程100次并发读取耗时如下.
Name ips average deviation median 99th % ets_set_with_read_concurrency 50.08 K 19.97 μs ±218.08% 19 μs 58 μs ets_duplicate_bag_with_read_concurrency 48.09 K 20.79 μs ±88.09% 20 μs 64 μs ets_bag_with_read_concurrency 46.98 K 21.29 μs ±68.07% 20 μs 63 μs ets_set_without_read_concurrency 32.66 K 30.61 μs ±41.88% 28 μs 68 μs ets_bag_without_read_concurrency 31.29 K 31.96 μs ±45.26% 28 μs 72 μs ets_duplicate_bag_without_read_concurrency 31.27 K 31.98 μs ±44.26% 29 μs 72 μs ets_ordered_set_without_read_concurrency 16.90 K 59.18 μs ±35.78% 53 μs 120 μs ets_ordered_set_with_read_concurrency 16.73 K 59.77 μs ±39.17% 61 μs 124 μs
spawn process
创建100个进程耗时如下.
Name ips average deviation median 99th % spawn 5.40 K 185.15 μs ±43.21% 205 μs 350 μs
process dict get/put/delete
100w条数据的process dict, 1000次get/delete/put/put and delete耗时如下.
Name ips average deviation median 99th % test get 33.02 K 30.28 μs ±42.62% 28 μs 70 μs test delete 30.16 K 33.15 μs ±40.02% 31 μs 77 μs test put 25.07 K 39.89 μs ±24.66% 37 μs 86 μs test put and delete 17.45 K 57.32 μs ±21.14% 54 μs 108 μs
map get/put
看erlang源码发现, 若size小于MAP_SMALL_MAP_LIMIT(32), 则为flat_map. 故对map size为31, 10000分别测试.
Name ips average deviation median 99th % test small get 278.62 K 3.59 μs ±45.60% 3.30 μs 8.10 μs test large get 195.21 K 5.12 μs ±320.97% 5 μs 19 μs test small put 159.15 K 6.28 μs ±334.82% 5 μs 30 μs test small delete 146.99 K 6.80 μs ±299.38% 5 μs 56 μs test large delete 99.32 K 10.07 μs ±333.88% 7 μs 67 μs test large put 79.47 K 12.58 μs ±144.02% 10 μs 83 μs test large merge 35.25 K 28.37 μs ±62.48% 25 μs 105 μs test small merge 23.99 K 41.68 μs ±23.69% 38 μs 84 μs
list
++
应将较小的list放左边.
Name ips average deviation median 99th % 10 members ++ 100 members 31.52 M 0.0317 μs ±1658.39% 0.0200 μs 0.180 μs 100 members ++ 10 members 6.20 M 0.161 μs ±127.63% 0.130 μs 0.72 μs
keyfind
list 搜索是线性时间复杂度.
Name ips average deviation median 99th % keyfind 1000 pos at 1 29623.30 K 0.0338 μs ±33.88% 0.0300 μs 0.0800 μs keyfind 1000 pos at 500 615.29 K 1.63 μs ±22.16% 1.55 μs 2.93 μs keyfind 1000 pos at 1000 288.02 K 3.47 μs ±38.52% 3.20 μs 7.70 μs keydelete 1000 pos at 1 35960.25 K 0.0278 μs ±27.15% 0.0260 μs 0.0650 μs keydelete 1000 pos at 500 181.93 K 5.50 μs ±49.39% 5.10 μs 11.30 μs keydelete 1000 pos at 1000 89.13 K 11.22 μs ±127.23% 10 μs 35 μs
flatten
Name ips average deviation median 99th % 10 100 member list flatten 113.45 K 8.81 μs ±394.86% 7 μs 31 μs 100 10 member list flatten 104.56 K 9.56 μs ±287.26% 8 μs 32 μs
相关推荐
M守护神 2019-12-10
woxmh 2019-12-03
ElixirDeBombe 2019-12-01
Elixir 2019-11-17
garfieldcatcat 2019-11-04
MJlife 2019-06-26
dazhi00 2019-06-26
坚强00CSDN 2019-06-26
Colourful 2019-06-21
nxin的小抄本 2019-06-21
LustrousElixir 2019-06-21
坚强00CSDN 2019-06-21
ElixirDeBombe 2019-06-21
ElixirDeBombe 2019-06-21
Elixir 2019-06-21
Elixir 2019-06-21
helloxiaoliang 2019-06-21
Godfavoredone 2019-06-21