[wp-trac] [WordPress Trac] #14889: Memory Comparison Broken / WordPress Memory Limit

WordPress Trac wp-trac at lists.automattic.com
Mon Jun 6 20:46:05 UTC 2011


#14889: Memory Comparison Broken / WordPress Memory Limit
-----------------------------------------------+---------------------------
 Reporter:  hakre                              |       Owner:
     Type:  defect (bug)                       |      Status:  new
 Priority:  normal                             |   Milestone:  Future
Component:  General                            |  Release
 Severity:  normal                             |     Version:  3.0
 Keywords:  has-patch 3.2-early needs-testing  |  Resolution:
-----------------------------------------------+---------------------------

Comment (by chrisbliss18):

 I ran some benchmarks with the code provided by Hakre and Aaron. The
 updated benchmark script is attached.

 With a total of 1,000,000 runs spread between the seven different function
 versions that have cropped up in this ticket, I get the following results:

 {{{
 wp_function
 ==========================
 Trials:           143735
 Total Time:       28.980546236038
 Average Time:     0.00020162483901651
 Runs per Sec:     4959.7063778343
 Success Rate:     0.5
 Speed Difference: 0

 patch_function_original
 ==========================
 Trials:           142930
 Total Time:       70.426205396652
 Average Time:     0.00049273214438293
 Runs per Sec:     2029.5002292825
 Success Rate:     0.75
 Speed Difference: 1.4301200130271

 patch_function_new
 ==========================
 Trials:           142482
 Total Time:       36.730138063431
 Average Time:     0.00025778791751541
 Runs per Sec:     3879.1577574237
 Success Rate:     1
 Speed Difference: 0.26740668599806

 patch_function_new_complete
 ==========================
 Trials:           142732
 Total Time:       34.809070825577
 Average Time:     0.0002438771321468
 Runs per Sec:     4100.4254527565
 Success Rate:     1
 Speed Difference: 0.20111852075068

 wp_convert_hr_to_bytes
 ==========================
 Trials:           142653
 Total Time:       46.752933263779
 Average Time:     0.0003277388716941
 Runs per Sec:     3051.2096256112
 Success Rate:     0.625
 Speed Difference: 0.61325231356889

 map
 ==========================
 Trials:           142673
 Total Time:       40.819175481796
 Average Time:     0.00028610301515911
 Runs per Sec:     3495.2445343642
 Success Rate:     1
 Speed Difference: 0.40850262618709

 aaron
 ==========================
 Trials:           142795
 Total Time:       56.10250377655
 Average Time:     0.00039288843290417
 Runs per Sec:     2545.2518227838
 Success Rate:     1
 Speed Difference: 0.93586771345204
 }}}

 Note: My current patch is represented by patch_function_new_complete.

 Creating that array seems to have a high penalty on the code execution
 time. I also believe that the pow function has a high overhead that
 accounts for the more than doubling of processing time when compared to
 the other function using a map.

 As for the reason that I decided to test in order of M, G, and then K is
 because most systems will have configurations that use a unit of M. Both G
 and K are unlikely (I've never seen them), but I decided to put G second
 as it is more likely to be used with more frequency than K as the years go
 on. I would have loved to put a test for no unit second since that is the
 second most-likely case, but since that has to be the fallback, it had to
 be made last.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/14889#comment:21>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list