maddrid Posted on Oct 19, 2020 • Edited on Oct 26, 2020 Cake\Collection\Collection vs Illuminate\Support\Collection #php #laravel #help #cakephp Any thoughts(benchmarks) on witch performs better (faster , lower memory usage ) ? Any pro and cons on Cake\Collection\Collection vs Illuminate\Support\Collection Top comments (3) Subscribe Submit Preview Dismiss Collapse Expand maddrid maddrid maddrid Follow Joined Aug 22, 2020 • Oct 26 '20 • Edited on Oct 26 • Edited Dropdown menu Copy link Hide Hey ! Did some tests , here is the results : Filter 50 categories Bench::start('get_categories_cake'); $buff = new \Cake\Collection\Collection($all); for ($i = 0; $i < 10000; $i++) { $ladies = $buff->filter(function ($category, $key) { return $category['pk_i_id'] === '22'; }); $get_cake = $ladies->toArray(); } Bench::stop('get_categories_cake'); d($get_cake); Bench::start('get_categories_laravel'); $collection = new Illuminate\Support\Collection($all); for ($i = 0; $i < 10000; $i++) { $filtered = $collection->filter(function ($value, $key) { return $value['pk_i_id'] === '22'; }); $get_laravel = $filtered->all(); } Bench::stop('get_categories_laravel'); d($get_laravel); Enter fullscreen mode Exit fullscreen mode Results : [get_categories_cake] => Array ( [cpu_load] => Not enabled [duration] => 0.17000103 [memory] => 267.4 kb [peak] => 6.46 mb ) [get_categories_laravel] => Array ( [cpu_load] => Not enabled [duration] => 0.05999994 [memory] => 395.09 kb [peak] => 6.46 mb ) Enter fullscreen mode Exit fullscreen mode Collapse Expand Lawrence Lagerlof Lawrence Lagerlof Lawrence Lagerlof Follow Avid Isaac Asimov reader. Backend and frontend developer. Education Bachelor of Science in Information Technology Joined Aug 22, 2018 • Oct 21 '20 Dropdown menu Copy link Hide Add the tag #help to this post. Collapse Expand maddrid maddrid maddrid Follow Joined Aug 22, 2020 • Oct 26 '20 Dropdown menu Copy link Hide Thanks ! Some comments may only be visible to logged-in visitors. Sign in to view all comments. Code of Conduct • Report abuse
Top comments (3)
Hey ! Did some tests , here is the results :
Filter 50 categories
Results :
Add the tag #help to this post.
Thanks !
Some comments may only be visible to logged-in visitors. Sign in to view all comments.