[wp-trac] [WordPress Trac] #14429: Faster is_serialized

WordPress Trac wp-trac at lists.automattic.com
Tue Sep 21 09:53:57 UTC 2010

#14429: Faster is_serialized
 Reporter:  sambauers     |       Owner:           
     Type:  enhancement   |      Status:  new      
 Priority:  normal        |   Milestone:  3.1      
Component:  Optimization  |     Version:  3.0      
 Severity:  minor         |    Keywords:  has-patch

Comment(by hakre):

 I suggest an overload strategy to re-define the function based on
 function_exists() to reduce it to one call per request instead of 188 - if
 you're really in for the speed.


 Replying to [comment:10 Denis-de-Bernardy]:
 > It's like... there's absolutely no point in a) calculating the length of
 a 1MB string to verifying that its second char is set,
 PHP does not need to calculate the length of strings, it always know it,
 so this is not bold.

 > b) doing some complex comparison involving strpbrk() (which could
 potentially amount to finding the first of these chars at the very end of
 a 1MB string) and c) only *then* verifying that the second character works
 for our sake.

 That's a very valid point.

 > Better: a) check that the second character exists at all, b) verify that
 it works, and c) finally look at the first chars to see if it works...


 As I understood Rasums talk he just wanted to show how fast things can be
 made more easy (e.g. by replacing the whole function with an existing
 function). It's not making them perfect. So it's Rasmus, it's Feedback,
 but it should not be blindly adopted. I think that wouldn't be in Rasmus
 interest as well.

 My 2 cents.

Ticket URL: <http://core.trac.wordpress.org/ticket/14429#comment:11>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software

More information about the wp-trac mailing list