Home » Developing U++ » U++ Developers corner » Value size ?
Value size ? [message #42904] |
Sun, 13 April 2014 23:43 |
mingodad
Messages: 53 Registered: February 2008 Location: Spain
|
Member |
|
|
I saw in several places talking about efficiency but when I look at sizeof(Value) == 48 (64bits) I'm not sure about it.
I saw that Value has a String member called "data" and also an Atomic member called "refcount" to be used in special cases, but String also has the same "refcount" for special cases, isn't it a repetition ?
I was looking at sizeof(boost::any) == 8 (64bits) and sizeof(cdiggins::any) == 16 (64bits) ( http://www.codeproject.com/Articles/11250/High-Performance-D ynamic-Typing-in-C-using-a-Repla) and wondering why we need so much memory for Value ?
It's used on collections and this size adds to the end, also I saw on database examples using ValueMap inside ValueArray.
Why construct individual maps with lots of duplicated string keys ?
Wouldn't be more efficient to have only one set of keys and an Vector<ArrayValue> let's call it ValueTable ?
Renderer& Renderer::operator()(const char *id, const SqlSelect& sel)
{
ValueArray list;
ValueMap vm;
SqlR sql;
sql * sel;
while(sql.Fetch(vm))
list.Add(vm);
return operator()(id, list);
}
|
|
|
|
Re: Value size ? [message #42909 is a reply to message #42907] |
Mon, 14 April 2014 10:00 |
mingodad
Messages: 53 Registered: February 2008 Location: Spain
|
Member |
|
|
Thanks again for the explanation !
Yes you are right I was measuring then in debug mode and otherwise it's sizeof(Value) == 16 (64bits).
And yes the "refcount" is in an internal class declaration only, the String "data" member is the real storage.
Thanks again for your time, attention and great work !
[Updated on: Mon, 14 April 2014 10:03] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Fri Sep 20 18:06:53 CEST 2024
Total time taken to generate the page: 0.03446 seconds
|