[wp-trac] [WordPress Trac] #21760: get_term_by() calls are not cached

WordPress Trac noreply at wordpress.org
Thu Sep 29 13:21:58 UTC 2016


#21760: get_term_by() calls are not cached
-------------------------------------------------+-------------------------
 Reporter:  wonderboymusic                       |       Owner:  ocean90
     Type:  enhancement                          |      Status:  assigned
 Priority:  normal                               |   Milestone:  4.7
Component:  Taxonomy                             |     Version:  2.3
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch needs-testing has-unit-    |     Focuses:
  tests commit                                   |  performance
-------------------------------------------------+-------------------------
Changes (by ocean90):

 * keywords:  has-patch needs-testing has-unit-tests => has-patch needs-
     testing has-unit-tests commit


Comment:

 I did a small benchmark test with
 [https://gist.github.com/ocean90/4b41b5c4d91124d555a2f3d6412107e9 this
 script]. These are the results after 100 iterations:

 === Total ===
 ||        ||=  Time  =||= Queries =||=  Memory  =||
 ||= Before =||  0.4824721813|| 1900|| 2.751159668||
 ||= After (no persistent cache) =||  0.4861509800|| 400|| 3.027343750||
 ||= After (with persistent cache) =||  0.4600477219|| 4|| 3.149253845||

 Difference:
 ||        ||=  Time  =||=  Queries  =||=  Memory  =||
 ||= After (no persistent cache) =||  +0.003678798676|| -1500||
 +0.2761840820||
 ||= After (with persistent cache) =||  -0.022424459460|| -1896||
 +0.3980941772||

 [[BR]]

 === Average ===
 ||        ||=  Time  =||= Queries =||=  Memory  =||
 ||= Before =||  0.004824721813|| 19|| 0.02751159668||
 ||= After (no persistent cache) =||  0.004861509800|| 4|| 0.0302734375||
 ||= After (with persistent cache) =||  0.004600477219|| 0.04||
 0.03149253845||

 Difference:
 ||        ||=  Time  =||=  Queries  =||=  Memory  =||
 ||= After (no persistent cache) =||  +0.00003678798676|| -15||
 +0.002761840820||
 ||= After (with persistent cache) =||  -0.00022424459460|| -18.96||
 +0.003980941772||


 Numbers per iteration can be found in
 [https://docs.google.com/spreadsheets/d/1Vb5cdN3RODZ1MF6OKiNul6_PfeBr96_uG9ZirtrMiIU/edit?usp=sharing
 this sheet].

 Suggesting [attachment:21760.9.patch] for commit.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/21760#comment:106>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list