Advertisement
Faguss

Userspice $db->insert() speed test

Mar 3rd, 2020
254
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.36 KB | None | 0 0
  1. $array = [];
  2. for($i=0; $i<10000; $i++)
  3.     $array[] = Hash::unique();
  4.  
  5. $start = microtime(true);
  6. $db->insert("temptest",["text"=>$array]);
  7. $end = microtime(true) - $start;
  8. dump($end);
  9. #0.021837949752808
  10.  
  11. $start = microtime(true);
  12. foreach($array as $item)
  13.     $db->insert("temptest2",["text"=>$item]);
  14. $end = microtime(true) - $start;
  15. dump($end);
  16. #0.28586792945862
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement