phpperf icon indicating copy to clipboard operation
phpperf copied to clipboard

It would be great to have some numbers for array lookup performance.

Open doug65536 opened this issue 10 years ago • 1 comments

It would be great to have some timings for lookups on empty, small (16 entry), medium sized (perhaps 64 entry), large (perhaps 1000 entry), very large (perhaps 50,000 entry), and huge (500,000 entry) arrays. By array I mean this type: array('foo' => 123, 'bar' => 345).

Insertion, and unset timings would be terrific to see as well.

It would also be very enlightening to see whether integer keys are significantly faster than string keys.

I have always assumed that php's associative arrays would be fast, but it has been a curiosity of mine for a while just how fast. Maybe they're not fast! Maybe they suck! But probably not. Having numbers you generated alongside the existing stuff you test would be excellent.

Are they red black trees? Are they vectors that are binary searched (causing awful insertion performance, but amazing iteration performance)? Are they a vector of values with a hash table "key index"? Does array_splice renumbering of indices kill performance? Are they linear searched (doubtful). Knowing lookup and insertion numbers would make it possible to determine what's behind it.

Thanks!

doug65536 avatar Sep 02 '13 11:09 doug65536

Great idea; as you can see this project is sorely neglected but if you'd like to submit a PR you're more than welcome - otherwise I'll try and find some time (somewhere!) to get the project back on track a bit :)

makeusabrew avatar Oct 01 '13 13:10 makeusabrew