Re: The cost of using objects rather than plain C variables
Re: The cost of using objects rather than plain C variables
- Subject: Re: The cost of using objects rather than plain C variables
- From: Vincent Habchi <email@hidden>
- Date: Sun, 07 Jul 2013 10:08:01 +0200
Quincey,
> Each NSString has at least 4 bytes of overhead (the 'isa' pointer); each character is UTF-16; each object is a multiple of 16 bytes. Your values may not fit in the remaining 12 bytes of the smallest object (an input format something like '0.xe-nn', which isn't an unlikely format, wouldn't fit in 12 bytes, even with only 1 significant digit in the mantissa).
Well, I store GLshorts, GLfloats and GLints. The GLFloat is formatted like 0.xyztuvw I think, never more than seven digits after the decimal separator. But you’re right: I overlooked the UTF-16 default coding that doubles the size every ascii string.
My initial reasoning was very (too) simple: I have a 20 MB file made up of strings, if I store those strings in objects, even with a small overhead, it should not top 30 or 40 MB. It turned out I was plainly wrong, at least the way I implemented it.
> Actually, that's not so bad. 33-50MB instead of 20MB, for the objectified vs scalar representation, isn't unbearable, I suspect. However, the C array of scalars is probably the best choice.
Well, the plain C way, I suspect, is also quicker. With the decoding taking around 30 seconds or so, I had better optimizing speed, too!
Cheers and thanks a lot once again!
Vincent
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden