[wp-trac] [WordPress Trac] #16794: pomo/streams.php str_split() suggestion ?

WordPress Trac wp-trac at lists.automattic.com
Tue Mar 8 10:19:16 UTC 2011


#16794: pomo/streams.php str_split() suggestion ?
-------------------------+------------------------------
 Reporter:  mrasnika     |       Owner:
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  Performance  |     Version:  3.1
 Severity:  minor        |  Resolution:
 Keywords:               |
-------------------------+------------------------------

Comment (by hakre):

 Replying to [comment:2 mrasnika]:
 > It seems that this "optimization" is not going to help at all since all
 arguments are passed by reference UNTIL/UNLESS they are modified:
 >
 >   ''PHP already optimises it - variables are assigned using copy-on-
 write, and objects are passed by reference''
 > http://stackoverflow.com/questions/496669/are-php-strings-immutable

 And as it's copy on write, it's even counter-productive to pass by
 reference to built-in functions as this does even increase the memory
 usage.

 If you need to be able to use more than 256MB of memory, you can use the
 working patch
 [http://core.trac.wordpress.org/attachment/ticket/13847/13847.patch
 13847.patch] (Related: #13847) which replaces the hard-encoded memory
 limit value with a configure-able constant.

 However if you're looking for memory optimizations for pomo, extending
 classes could be overwrite parent functions and access their resources
 more optimized.

 A review of of the composition of the final objects are might reveal some
 structural benefit as well, AFAIK POMO tries to combine single and
 multibyte string operations with string- or file-io.

 But that's structural and needs a refactoring plus testing if it really
 helps. So a lot of work.

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


More information about the wp-trac mailing list