dongshang5862 2014-04-14 01:54 采纳率: 0%
浏览 42
已采纳

为什么php 4.3中的bcmath比php 5+快得多?

Decided to run a quick test to see how bcmath operates on various versions of PHP, and noticed that the latest and greatest is lacking significantly in speed when compared to 4.3,

I am wondering if anyone knows what the reason behind this is, and/or how the speed can be improved on 5+ so that it is reasonably comparable to 4.3.

Also note, the memory consumption from 5.6+ is triple that which 4.3 requires for the same operation :

Performance Test Results (Waterflow)

  • 写回答

1条回答 默认 最新

  • douchanxiu5636 2014-04-14 02:05
    关注

    It's not faster. The graphs you see include not only the bcmath call, but the startup & shutdown overhead as well.

    $start = microtime(true);
    for ($i = 0; $i < 1000; ++$i) {
        bcdiv(40075036, 86164.098903691, 40);
    }
    
    echo microtime(true) - $start;
    

    This snippet would measure the bcdiv performance: http://3v4l.org/unrRL

    As you can see - the performance is pretty much the same.

    A note: you can see that the numbers are really small, it means that you cannot completely trust them and you should understand that any additional load on the machine can affect the test results.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 拟通过pc下指令到安卓系统,如果追求响应速度,尽可能无延迟,是不是用安卓模拟器会优于实体的安卓手机?如果是,可以快多少毫秒?
  • ¥20 神经网络Sequential name=sequential, built=False
  • ¥16 Qphython 用xlrd读取excel报错
  • ¥15 单片机学习顺序问题!!
  • ¥15 ikuai客户端多拨vpn,重启总是有个别重拨不上
  • ¥20 关于#anlogic#sdram#的问题,如何解决?(关键词-performance)
  • ¥15 相敏解调 matlab
  • ¥15 求lingo代码和思路
  • ¥15 公交车和无人机协同运输
  • ¥15 stm32代码移植没反应