All Projects → morozovsk → Php Arrays In Memory Comparison

morozovsk / Php Arrays In Memory Comparison

How to store 11kk items in memory? Comparison of methods: array vs object vs SplFixedArray vs pack vs swoole_table vs swoole_pack vs redis vs memsql vs node.js arrays in php7

Projects that are alternatives of or similar to Php Arrays In Memory Comparison

Groupco
PHP的服务化框架。适用于Api、Http Server、Rpc Server;帮助原生PHP项目转向微服务化。出色的性能与支持高并发的协程相结合
Stars: ✭ 473 (+469.88%)
Mutual labels:  redis, swoole
Smartsql
SmartSql = MyBatis in C# + .NET Core+ Cache(Memory | Redis) + R/W Splitting + PropertyChangedTrack +Dynamic Repository + InvokeSync + Diagnostics
Stars: ✭ 775 (+833.73%)
Mutual labels:  redis, sqlite
Memtier benchmark
NoSQL Redis and Memcache traffic generation and benchmarking tool.
Stars: ✭ 480 (+478.31%)
Mutual labels:  redis, benchmark
hood
The plugin to manage benchmarks on your CI
Stars: ✭ 17 (-79.52%)
Mutual labels:  benchmark, comparison
Dbbench
🏋️ dbbench is a simple database benchmarking tool which supports several databases and own scripts
Stars: ✭ 52 (-37.35%)
Mutual labels:  sqlite, benchmark
javascript-serialization-benchmark
Comparison and benchmark of JavaScript serialization libraries (Protocol Buffer, Avro, BSON, etc.)
Stars: ✭ 54 (-34.94%)
Mutual labels:  benchmark, comparison
Zxw.framework.netcore
基于EF Core的Code First模式的DotNetCore快速开发框架,其中包括DBContext、IOC组件autofac和AspectCore.Injector、代码生成器(也支持DB First)、基于AspectCore的memcache和Redis缓存组件,以及基于ICanPay的支付库和一些日常用的方法和扩展,比如批量插入、更新、删除以及触发器支持,当然还有demo。欢迎提交各种建议、意见和pr~
Stars: ✭ 691 (+732.53%)
Mutual labels:  redis, sqlite
Volley
Volley is a benchmarking tool for measuring the performance of server networking stacks.
Stars: ✭ 119 (+43.37%)
Mutual labels:  comparison, benchmark
Easycaching
💥 EasyCaching is an open source caching library that contains basic usages and some advanced usages of caching which can help us to handle caching more easier!
Stars: ✭ 1,047 (+1161.45%)
Mutual labels:  redis, sqlite
Socket Io
基于Hyperf微服务协程框架开发的sokcet-io分布式系统
Stars: ✭ 38 (-54.22%)
Mutual labels:  redis, swoole
language-benchmarks
A simple benchmark system for compiled and interpreted languages.
Stars: ✭ 21 (-74.7%)
Mutual labels:  benchmark, comparison
Gl vs vk
Comparison of OpenGL and Vulkan API in terms of performance.
Stars: ✭ 65 (-21.69%)
Mutual labels:  comparison, benchmark
Are We Fast Yet
Are We Fast Yet? Comparing Language Implementations with Objects, Closures, and Arrays
Stars: ✭ 161 (+93.98%)
Mutual labels:  comparison, benchmark
Reading
整理阅读过的干货文章, 帖子
Stars: ✭ 318 (+283.13%)
Mutual labels:  redis, swoole
Benchmarks
Comparison tools
Stars: ✭ 139 (+67.47%)
Mutual labels:  comparison, benchmark
Imi
imi 是基于 Swoole 的 PHP 协程开发框架,它支持 Http、Http2、WebSocket、TCP、UDP、MQTT 等主流协议的服务开发,特别适合互联网微服务、即时通讯聊天im、物联网等场景!。QQ群:17916227
Stars: ✭ 680 (+719.28%)
Mutual labels:  redis, swoole
Endb
Key-value storage for multiple databases. Supports MongoDB, MySQL, Postgres, Redis, and SQLite.
Stars: ✭ 208 (+150.6%)
Mutual labels:  redis, sqlite
Zapi
基于swoole的异步轻量级api框架,内部封装全套mysql、redis、mongo、memcached异步客户端,可以轻松start、reload、stop,加入数据库的查询模块,框架已经封装好近乎同步写法,底层异步调用。现已支持异步mysql、异步redis、异步http请求.
Stars: ✭ 245 (+195.18%)
Mutual labels:  redis, swoole
Huststore
High-performance Distributed Storage
Stars: ✭ 806 (+871.08%)
Mutual labels:  redis, benchmark
Nodbi
Document DBI connector for R
Stars: ✭ 56 (-32.53%)
Mutual labels:  redis, sqlite

Data

11kk items in 101 json file 1.5MB each. https://github.com/sat2707/hlcupdocs/tree/master/data/FULL/data

schema:

  • id — unique id: int32 unsigned
  • location — location id: int32 unsigned
  • user — user id: int32 unsigned
  • visited_at — timestamp.
  • mark — int from 0 to 5

Example:
{"visits": [{"user": 34, "location": 6, "visited_at": 1330898799, "id": 1, "mark": 4}, ...]}
$row = ["user" => 34, "location" => 6, "visited_at" => 1330898799, "id" => 1, "mark" => 4];

Results (on php7 x64):

memory, Mb initializing filling
php array of objects 6231 $visits = new SplFixedArray(11000000); $visits[$row['id']] = (object) $row;
php array (hash) 6057 $visits = []; $visits[$row['id']] = $row;
php SplFixedArray 5696 $visits = new SplFixedArray(11000000); $visits[$row['id']] = $row;
php array (index) 3936 $visits = new SplFixedArray(11000000); $visits[$row['id']] = [$row['user'],...];
redis mset 3354 MSet(["u{$row['id']}" => $row['user'], "l{$row['id']}" => $row['location'], ...])
php SplFixedArray 2790 $visits = new SplFixedArray(11000000); $visits[$row['id']] = new SplFixedArray(4);
php swoole_table 2200 $visits = new swoole_table(11000000); $visits->set($row['id'], $row);
php arrays 2147 $user = $location = ... = []; $user[$row['id']] = $row['user'];$location[$row['id']] = $row['location'];...
php my object 1430 $visits = new SplFixedArray(11000000); $visits[$row['id']] = new MyArrayClass($row['user'], ...);
redis hmset 1409 hMSet("v{$row['id']}", ['user' => $row['user'], 'location' => $row['location'], ...]);
redis hmset 1225 hMSet("v{$row['id']}", ['u' => $row['user'], 'l' => $row['location'], ...]);
memsql insert 842 create table insert into
node.js array 780 visits = []; visits[visitsData.visits[y]['id']] = {user:visitsData.visits[y].user,...}
php strings 736 $visits = new SplFixedArray(11000000); $visits[$row['id']] = join(',', [$row['user'], $row['location'], ...]);
php SplFixedArrays 704 $user = new SplFixedArray(11000000);... $user[$row['id']] = $row['user'];$location[$row['id']] = $row['location'];...
sqlite insert 623 create table insert into
php swoole_pack 539 shmop_open($k, "c", 0644, 49*11000000); swoole_pack(['user' => $row['user'], 'location' => $row['location'], ...])
tarantool insert 530 create_index('primary', ...) insert($row['id'], $row['user'], $row['location'], ...]);
mysql insert 515 create table insert into
node.js arrays 514 visits_user = []; visits_location = [];... visits_user[visitsData.visits[y]['id']] = visitsData.visits[y].user;...
php swoole_pack 341 shmop_open($k, "c", 0644, 31*11000000); swoole_pack(['u' => $row['user'], 'l' => $row['location'], ...])
php swoole_pack 209 shmop_open($k, "c", 0644, 19*11000000); swoole_pack([$row['user'], $row['location'], $row['visited_at'], $row['mark']]);
php pack 143 shmop_open($k, "c", 0644, 13*11000000); pack('LLLc', $row['user'], $row['location'], $row['visited_at'], $row['mark']);

See also comparison swoole vs workerman vs roadrunner vs node.js vs fasthttp

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].