Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Core » substring find
Re: substring find [message #861 is a reply to message #859] Mon, 06 February 2006 11:28 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 14267
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
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: storing my struct in a Value
Next Topic: bits/atomicity.h
Goto Forum:
  


Current Time: Thu Sep 18 04:24:06 CEST 2025

Total time taken to generate the page: 0.12527 seconds