On 13/06/12 05:26, Morgan L. Owens wrote:
> After reading the performance improvements RFC about interned strings,
> and its passing mention of a "special data structure (e.g.
> zend_string) instead of char*", I've been thinking a little bit about
> this and what such a structure could be.
>
> But rather than interned strings, I thought that _implicit_
> concatenation would be a bigger win in the long term. Like interning,
> it relies on strings being immutable.
>
> This zend_string is a composite type. Leaves are _almost_ identical to
> existing string zvals - char* val, int len - but also an additional
> "child_count" field. For leaves, child_count is zero (not incidentally
> indicating that it _is_ a leaf). For internal nodes, "val" is a list
> of zend_strings (child_count of them). "len" still refers to the total
> string length (the sum of the len fields of its children).
>
> So a string that has been built up through concatenation is
> represented by a tree (actually a dag) of zend_strings. The edges in
> this dag are all properly reference-counted; discarding a string
> decrements the reference counts of its children.
How do you list then? As a single-linked list?
That would avoid reuse of the component strings in different
superstrings except from matching ends...




-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to