Re: Reading in dictionary from txt file: options for speed
Re: Reading in dictionary from txt file: options for speed
- Subject: Re: Reading in dictionary from txt file: options for speed
- From: Miles <email@hidden>
- Date: Tue, 14 Apr 2009 16:23:58 -0700
You guys are awesome!
*1) *I've been trying Kyle's suggestion for a few hours and I can't get it
working right. I broke it into this simple example, and it's not able to
convert it to the 'word' struct.
NSMutableData *data1;
NSString *myString = @"\\x06hello\\x00";
const char *utfMyString = [myString UTF8String];
data1 = [NSMutableData dataWithBytes:utfMyString
length:strlen(utfMyString)];
unsigned char buffer[20];
[data1 getBytes:buffer];
NSLog(@"data1 before: \"%s\"\n", (char *)buffer);
[data1 getBytes:buffer];
word *w = (word *)utfMyString;
NSLog(@"data1: \"%s\"\n", w->text);
*2)* Wagner, thanks for that test, that's great to know! I'll check it out
in a bit, right now I'm focusing on saving time getting the data into an
array or some other format to suit my needs.
*3)* The problem with the SQLite route is that the database size becomes
more than twice the size of the dictionary in a text file. So that just
trades one problem for another.
There are a handful of games out there that are small in size, have fast
loading times, and quick dictionary checking. If only I knew how they did
it!
On Tue, Apr 14, 2009 at 4:09 PM, Michael Ash <email@hidden> wrote:
> On Tue, Apr 14, 2009 at 3:03 PM, Kyle Sluder <email@hidden>
> wrote:
> > 2) Pointer access needs to be 4-byte aligned (on PC, don't know about
> > iPhone);
>
> This is not so. It's extremely rare to find a platform which
> *requires* aligned access, and you certainly won't find one running OS
> X. What's more common is finding a platform which *prefers* aligned
> access, punishing misaligned access with significantly slower
> operation. Even in those cases, "misaligned" means using an address
> that isn't a multiple of your data type's size. Since char is always
> one byte by definition, it is impossible to have a misaligned char
> pointer.
>
> Mike
> _______________________________________________
>
> 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
>
_______________________________________________
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