makeusabrew / phpperf

PHP Performance Metrics
http://phpperf.com
36 stars 7 forks source link

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

Open doug65536 opened 11 years ago

doug65536 commented 11 years ago

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!

makeusabrew commented 11 years ago

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 :)