Page 1 of 1

How fast would be pure-php B-Tree index?

Posted: Thu Dec 15, 2005 7:05 pm
by Gambler
I'm speaking about something like indexes in MySQL. Anyone ever seen implementation of such thing in pure PHP?

Posted: Thu Dec 15, 2005 7:11 pm
by feyd
why wouldn't it be like any other implementation? :?

Posted: Thu Dec 15, 2005 11:07 pm
by Gambler
What do you mean? All B-Tree indexes I know about are written either in C or in Java. PHP performance will be different, because it's a scripting language.

Posted: Fri Dec 16, 2005 6:06 pm
by feyd
that doesn't really change much, just adds some more time..

Posted: Fri Dec 16, 2005 6:19 pm
by Gambler
But that's what I asked: how fast would it be?

Posted: Fri Dec 16, 2005 6:34 pm
by feyd
The speed of a tree varies depending on it's size, partitioning, among other things. It will also depend heavily on your configuration and what version of php you are running. So it's really hard to just say... but it will be slower than C, but may be just as fast or similar to Java, if all have the same size and partitioning... however if you hit the upper level "bug" that php has with very very very very very large numbers of objects, you will get a very different story (php will crash)

Posted: Fri Dec 16, 2005 8:31 pm
by BDKR
Of course, you'll also have to model it somehow using an array. Sterling Hughes wrote an extension to provide these kinds of data structures natively, but then decided he didn't like it. Sorry I can't remember the name.