Bug #79856 [NEW]: for() terribly poor performance
| From: | bugzilla77 at gmail dot com | Date: | Tue, 14 Jul 2020 07:36:18 +0000 |
| Subject: | Bug #79856 [NEW]: for() terribly poor performance | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-228024@lists.php.net to get a copy of this message | ||
From: bugzilla77 at gmail dot com
Operating system: Windows 10 Pro
PHP version: 8.0.0alpha2
Package: Performance problem
Bug Type: Bug
Bug description:for() terribly poor performance
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
--
Edit bug report at https://bugs.php.net/bug.php?id=79856&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=79856&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=79856&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=79856&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=79856&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=79856&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=79856&r=support
Expected behavior: https://bugs.php.net/fix.php?id=79856&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=79856&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=79856&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=79856&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=79856&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=79856&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=79856&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=79856&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=79856&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=79856&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=79856&r=mysqlcfg