This is a method to reduce the number of duplicated strings kept in
memory. It's pretty common for the same strings to be dynamically
allocated repeatedly between applications and libraries, especially in
circumstances where you could have multiple copies of a structure that
allocates the string. So rather than duplicating and freeing these
strings, you request a read-only pointer to an existing string and
only incur the overhead of a hash lookup.

It sounds like micro-optimizing, but profiling has shown this can have
a significant impact as you scale the number of copies up. It improves
string creation/destruction speed, reduces memory use and decreases
memory fragmentation, so a win all-around.

Nathan

On 8/1/07, Ross Vandegrift <[EMAIL PROTECTED]> wrote:
> Hey everyone,
>
> I'm a bit confused as to the point of Ecore_String.  It seems like the
> only thing one can do with an Ecore_String is fetch a string from the
> hash table of strings... using the string you want to fetch as the
> key.
>
> So uh, if I already have the string I want, why should I fetch an
> instance of it from ecore?
>
>
>
> --
> Ross Vandegrift
> [EMAIL PROTECTED]
>
> "The good Christian should beware of mathematicians, and all those who
> make empty prophecies. The danger already exists that the mathematicians
> have made a covenant with the devil to darken the spirit and to confine
> man in the bonds of Hell."
>         --St. Augustine, De Genesi ad Litteram, Book II, xviii, 37
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems?  Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >>  http://get.splunk.com/
> _______________________________________________
> enlightenment-devel mailing list
> enlightenment-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
>

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to