concat_003.phpt 791 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. --TEST--
  2. Concatenating many small strings should not slowdown allocations
  3. --SKIPIF--
  4. <?php
  5. if (PHP_DEBUG) { die ("skip debug version is slow"); }
  6. if (getenv('SKIP_PERF_SENSITIVE')) die("skip performance sensitive test");
  7. ?>
  8. --FILE--
  9. <?php
  10. $time = microtime(TRUE);
  11. /* This might vary on Linux/Windows, so the worst case and also count in slow machines. */
  12. $t_max = 1.0;
  13. $datas = array_fill(0, 220000, [
  14. '000.000.000.000',
  15. '000.255.255.255',
  16. '保留地址',
  17. '保留地址',
  18. '保留地址',
  19. '保留地址',
  20. '保留地址',
  21. '保留地址',
  22. ]);
  23. $time = microtime(TRUE);
  24. $texts = '';
  25. foreach ($datas AS $data)
  26. {
  27. $texts .= implode("\t", $data) . "\r\n";
  28. }
  29. $t = microtime(TRUE) - $time;
  30. var_dump($t < $t_max);
  31. ?>
  32. +++DONE+++
  33. --EXPECT--
  34. bool(true)
  35. +++DONE+++