Home » U++ Library support » U++ Core » substring find
substring find [message #769] |
Wed, 01 February 2006 15:10 |
hojtsy
Messages: 241 Registered: January 2006 Location: Budapest, Hungary
|
Experienced Member |
|
|
I can not seem to find any String::Find(String) method. Is it possible that this is missing? Then please add it to the wishlist.
|
|
|
|
|
|
|
Re: substring find [message #861 is a reply to message #859] |
Mon, 06 February 2006 11:28 |
|
mirek
Messages: 14105 Registered: November 2005
|
Ultimate Member |
|
|
No, small string optimization means that for small strings, you keep data inside String object, something like:
String {
struct Large {
const char *ptr;
....
}
union {
char data[16]
Large large_string;
}
};
If you think about the issue, unshared reference counted string (and per my research, most reference counted strings are unshared) has 16 bytes overhead (4 bytes for pointer in String, 4 bytes reference count, 4 bytes length of string, 4 bytes allocation length). Then 70% of Strings has len < 15. Means, in 70% cases SSO will store the String "for free" when compared to current implementation. In remaining 30%, SSO will just use those 16 bytes to store pointer/length/alloc previously stored in shared string (storing there just reference count). Also, you will avoid alloc/free, interlocked increment/decrement etc...
Mirek
|
|
|
|
|
|
Goto Forum:
Current Time: Fri Nov 01 00:01:23 CET 2024
Total time taken to generate the page: 0.01790 seconds
|