avl_string_cache branch
Vasily Chekalkin
bacek at bacek.com
Thu Apr 1 08:09:15 UTC 2010
On Thu, Apr 1, 2010 at 9:55 AM, chromatic <chromatic at wgz.org> wrote:
> I think that's the source of the slower performance; almost every comparison
> of strings ends up checking the contents of the string with a memcmp. I think
> we need a custom tree traversal function which exploits natural indexing
> characteristics of our strings.
>
> At the topmost level, check by string length. Then check by encoding type.
> Then check by each character in the string, rather than comparing the whole
> string at a time (an inlined comparison of the correct character in the string
> is cheaper than even the memcmp call).
1. I do check length, encoding and charset before falling to memcmp.
2. memcmp on optimized builds should be actually 3 CPU instructions. I
doubt that char-by-char comparison will be faster (due cache pipeline,
etc).
--
Bacek
More information about the parrot-dev
mailing list