SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Member
    Join Date
    Jan 2012
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    PHP Master SplFixedArray

    The PHP Master book claims significant performance benefits for SplFixedArray over conventional arrays, ranging from 4.3x for large arrays up to 20x for very small ones (p.350).

    I've been benchmarking the functions with the intention of using them, but I'm not seeing anywhere near this level of performance enhancement. Indeed for smaller arrays (up to 16 entires) the cycles needed to instantiate the class makes the approach less efficient. Even for larger arrays (32k+ entries) the benefit seems to level out at between 20-40% improvement, rather than the 300-400% claimed.

    I'm wondering how the quoted benchmarked figures were compiled. And also whether anybody else has experience of using these functions and has managed to achieve the performance gains suggested.

  2. #2
    SitePoint Member
    Join Date
    Jan 2012
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ah. Found benchmarking code used in the book's code archive, and the results are consist with those quoted in the book.

    Alas, the code has an error - the timer is restarted after the fixed array has been loaded, so the comparisons between normal and fixed arrays are invalid. Correcting the error confirms that the benefits of using fixed arrays is way less than the book suggests.

  3. #3
    #titanic {float:none} silver trophy
    molona's Avatar
    Join Date
    Feb 2005
    Location
    from Madrid to Heaven
    Posts
    8,246
    Mentioned
    240 Post(s)
    Tagged
    1 Thread(s)
    Maybe you should write to post-sales dept. to inform them of the errata... that would be great

  4. #4
    SitePoint Member
    Join Date
    Jan 2012
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I emailed details of the error immediately after posting it here, but only got a canned (and inappropriate) response. I also tracked down the github repo and added a correction there, but the only response there was to refresh the repo wiping out the correction (so I put it back again). Five week's later and the book's errata hasn't been updated - so I'm getting the sense that Sitepoint have sadly become more interested in selling books than ensuring that they're accurate. A shame, because they used to take way more care.

  5. #5
    Galactic Overlord gold trophysilver trophybronze trophy
    HAWK's Avatar
    Join Date
    Aug 2003
    Location
    New Zealand
    Posts
    12,555
    Mentioned
    961 Post(s)
    Tagged
    14 Thread(s)
    Quote Originally Posted by kanjimaster View Post
    I emailed details of the error immediately after posting it here, but only got a canned (and inappropriate) response. I also tracked down the github repo and added a correction there, but the only response there was to refresh the repo wiping out the correction (so I put it back again). Five week's later and the book's errata hasn't been updated - so I'm getting the sense that Sitepoint have sadly become more interested in selling books than ensuring that they're accurate. A shame, because they used to take way more care.
    Hi there, sorry about this. Did you sent the details to errata@sitepoint.com or to another address? I'd like to get to the bottom of it for you.

  6. #6
    SitePoint Member
    Join Date
    Jan 2012
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I followed the link on the book's corrections page. That led to me a contact form where I selected "Report a bug or typo in a Sitepoint book" as the reason for contact. The canned response came from editor@sitpoint.com and was timestamped Wed, 25 Jan 2012 22:57:08 +1100. Hope that helps.

  7. #7
    Galactic Overlord gold trophysilver trophybronze trophy
    HAWK's Avatar
    Join Date
    Aug 2003
    Location
    New Zealand
    Posts
    12,555
    Mentioned
    961 Post(s)
    Tagged
    14 Thread(s)
    Quote Originally Posted by kanjimaster View Post
    I followed the link on the book's corrections page. That led to me a contact form where I selected "Report a bug or typo in a Sitepoint book" as the reason for contact. The canned response came from editor@sitpoint.com and was timestamped Wed, 25 Jan 2012 22:57:08 +1100. Hope that helps.
    I'll point an editor in this direction for a response.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •