Re: sorting large tables

2008-03-14 Thread Daniel Child
Actually, since I've parsed the data successfully, I suppose I could store it and reopen in Core Data. Since I am new to Cocoa and have a limited programming background, I thought I should keep things basic,. Will give it a try as well (once I've tried the merge sort). But since I will have

Re: sorting large tables

2008-03-14 Thread Daniel Child
Great suggestion. Thanks. On Mar 13, 2008, at 5:00 PM, Ben Trumbull wrote: One nice thing about sorting, is that this is easy to do: merge sort. You can break up the problem as much as you want, and use any handy sort function, and then merge the pieces together. Algorithms for merging are

Re: sorting large tables

2008-03-13 Thread Jens Alfke
On 13 Mar '08, at 8:34 PM, Daniel Child wrote: It sounds like my program shouldn't be freezing in the first place, since my files are not THAT big. Here are the details. The most useful details would involve a sample* of what your program's doing. My guess is that it's just taking an extre

Re: sorting large tables

2008-03-13 Thread Nir Soffer
On Mar 14, 2008, at 05:34, Daniel Child wrote: @interface GenericRecord : NSObject { NSMutableArray *record; ... plus a couple ivars not used for the sort } Field access is slower because you have to call two methods instead of one - one of the generic recorder, and then the array ob

Re: sorting large tables

2008-03-13 Thread Dave Hersey
For one thing: // in GenericRecord implementation int sortGenericRecord (GenericRecord *rec1, GenericRecord *rec2, void *fieldNum) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; int *columnPtr = (int *) fieldNum; int column = *columnPtr; NSString *rec1Fi

Re: sorting large tables

2008-03-13 Thread Daniel Child
On Mar 13, 2008, at 6:24 PM, Jens Alfke wrote: You don't necessarily need to sort all of it at once. You just need to find the first few items, to display in your table view. If the user scrolls past those, you need to find more. You can do this by streaming the data from a file, keeping on

Re: sorting large tables

2008-03-13 Thread Ben Trumbull
oops, lost the list on the cc: At 2:55 PM -0700 3/13/08, [EMAIL PROTECTED] wrote: In answer to your question, each record is a "GenericRecord" which contains an array of fields and a numfields count (which varies by record). The table is a "GenericTable" that has an ivar that holds an array of

Re: sorting large tables

2008-03-13 Thread Jens Alfke
On 13 Mar '08, at 1:42 PM, Daniel Child wrote: That makes a lot of sense to me, and that's the situation I'm trying to get to. But right now all I have is the original (unsorted) raw data. So I need to load it into memory and sort it. You don't necessarily need to sort all of it at once. Y

re: sorting large tables

2008-03-13 Thread Ben Trumbull
Unfortunately, the table is not KVO-compliant so I cannot use NSSortDescriptor. And I need to pass the primary and secondary sort fields at runtime, so I cannot use sortUsingSelector since it takes no parameters. NSSortDescriptor requires an object be *KVC* compliant. It does not use KVO. S

Re: sorting large tables

2008-03-13 Thread Daniel Child
That makes a lot of sense to me, and that's the situation I'm trying to get to. But right now all I have is the original (unsorted) raw data. So I need to load it into memory and sort it. Since the sorting operation hangs some kazillion compare:s into the process, I can't exactly trace my w

Re: sorting large tables

2008-03-13 Thread Keary Suska
on 3/13/08 9:52 AM, [EMAIL PROTECTED] purportedly said: > Unfortunately, the table is not KVO-compliant so I cannot use > NSSortDescriptor. And I need to pass the primary and secondary sort > fields at runtime, so I cannot use sortUsingSelector since it takes > no parameters. -sortUsingSelector t

Re: sorting large tables

2008-03-13 Thread Jens Alfke
On 13 Mar '08, at 8:52 AM, Daniel Child wrote: I am using sortArrayUsingFunction: context: to sort a fairly large table (100k recs). Judging from the readout of comparisons being made the sort appears to be about 80% done when everything comes to a halt. No message, no nothing. It just sto

sorting large tables

2008-03-13 Thread Daniel Child
Hi, I am using sortArrayUsingFunction: context: to sort a fairly large table (100k recs). Judging from the readout of comparisons being made the sort appears to be about 80% done when everything comes to a halt. No message, no nothing. It just stops. The exact same function works if the t