|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2020-07-14 07:40 UTC] beberlei@php.net
-Status: Open
+Status: Closed
-Assigned To:
+Assigned To: beberlei
[2020-07-14 07:40 UTC] beberlei@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 09 00:00:01 2025 UTC |
Description: ------------ for() terribly poor performance Test script: --------------- // --- php <?php $t=microtime(true); $s=0; for($i=0;$i<20000000;$i++){ $s+=$i; } $t=microtime(true)-$t; print(($t*1000).'ms'); ?> // --- javascript <script> t=new Date(); s=0; for(i=0;i<20000000;i++){ s+=i } t=new Date()-t; document.write(t+'ms'); </script> // --- C# using System; namespace ConsoleApp1 { class Program { static void Main(string[] args) { int t = Environment.TickCount; long s = 0; for (int i = 0; i < 20000000; i++) { s += i; } t = Environment.TickCount - t; Console.WriteLine(t+"ms"); Console.ReadKey(); } } } Expected result: ---------------- Performance at the level of other languages. Actual result: -------------- PHP 8.0alpha2: 343ms PHP 7.4: 461ms javascript (Firefox 78.0.2): 58ms C#: 16ms