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
substring find [message #769] Wed, 01 February 2006 15:10 Go to next message
hojtsy is currently offline  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 #774 is a reply to message #769] Wed, 01 February 2006 17:57 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 14105
Registered: November 2005
Ultimate Member
Yes it is missing. Adding to ToDo... (there will huge String refactoring soon anyway...)

Mirek
Re: substring find [message #783 is a reply to message #774] Thu, 02 February 2006 13:08 Go to previous messageGo to next message
hojtsy is currently offline  hojtsy
Messages: 241
Registered: January 2006
Location: Budapest, Hungary
Experienced Member
What needs to be refactored in String? (Well except adding the substring and regexp find features, which doesn't seem to me as refactoring) Maybe I can help in it.
Re: substring find [message #786 is a reply to message #783] Thu, 02 February 2006 20:28 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 14105
Registered: November 2005
Ultimate Member
Implementation.

Right now, we have pure reference counted string. Not bad, but I now see better performing implementations that can save quite a lot of memory as well (small string optimization).

BTW, it would be interesting to combine substring search with character filter...

Mirek
Re: substring find [message #859 is a reply to message #786] Mon, 06 February 2006 08:20 Go to previous messageGo to next message
hojtsy is currently offline  hojtsy
Messages: 241
Registered: January 2006
Location: Budapest, Hungary
Experienced Member
luzr wrote on Thu, 02 February 2006 14:28

Right now, we have pure reference counted string. Not bad, but I now see better performing implementations that can save quite a lot of memory as well (small string optimization).

Is that small string optimization similar to what the Mitor class does? By the way where is the "Mitor" name coming from? I can't seem to find anything with this name on google.
Re: substring find [message #861 is a reply to message #859] Mon, 06 February 2006 11:28 Go to previous messageGo to next message
mirek is currently offline  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
Re: substring find [message #862 is a reply to message #859] Mon, 06 February 2006 11:30 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 14105
Registered: November 2005
Ultimate Member
Mitor - Mi[niVec]tor Smile

Not being native English speaker, I am sometimes too creative with words Smile

The motivation: Most of Ctrls have just single Frame, but some have more than one. Speed of Mitor is less of concern there.

Mirek
Re: substring find [message #866 is a reply to message #861] Mon, 06 February 2006 11:37 Go to previous messageGo to next message
hojtsy is currently offline  hojtsy
Messages: 241
Registered: January 2006
Location: Budapest, Hungary
Experienced Member
luzr wrote on Mon, 06 February 2006 05:28

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;
}
};
Yes, that was what I thought. And it's similar to how the Mitor works - storing element data in the memory area of the container object itself.
Re: substring find [message #867 is a reply to message #866] Mon, 06 February 2006 11:39 Go to previous message
mirek is currently offline  mirek
Messages: 14105
Registered: November 2005
Ultimate Member
Well, you are right. It was just that final performance characteristics are completely different, anyway, it is true that basic idea is the same.

Mirek
Previous Topic: storing my struct in a Value
Next Topic: bits/atomicity.h
Goto Forum:
  


Current Time: Fri Nov 01 00:01:23 CET 2024

Total time taken to generate the page: 0.01790 seconds