Core Data, SQLLITE, and slow Array Operators

  • I have a relatively simple Core Data application that stores data in
    SQLLite format.  Bindings are also used.  Everything works fine
    except when I use any array operators on the data after the data have
    been read from disk.  If I start with an empty data store, and
    populate it with about 1,000 records using NSEntityDescription
    insertNewObjectForEntityForName, the array operator calculations are
    performed almost instantly.  If I then quit the app and reopen it so
    that the data are read back in, the same array operators on the same
    data takes about 45 minutes (yes, minutes) to calculate the same
    values.  Why could possibly be slowing down the calculations of the
    array operators working on the exact same data?  Any help would be
    appreciated.
    Thanks,
    Bill
  • Bill,

    If you switch SQLLite debugging on ("-com.apple.CoreData.SQLDebug 1"
    argument on the executable) what queries give you the performance
    hit? Is it just one query or does the system tries to do 10,000 fetches?

    Diederik

    On 26-okt-2006, at 19:41, <cocoalist...> wrote:

    > I have a relatively simple Core Data application that stores data
    > in SQLLite format.  Bindings are also used.  Everything works fine
    > except when I use any array operators on the data after the data
    > have been read from disk.  If I start with an empty data store,
    > and populate it with about 1,000 records using NSEntityDescription
    > insertNewObjectForEntityForName, the array operator calculations
    > are performed almost instantly.  If I then quit the app and reopen
    > it so that the data are read back in, the same array operators on
    > the same data takes about 45 minutes (yes, minutes) to calculate
    > the same values.  Why could possibly be slowing down the
    > calculations of the array operators working on the exact same
    > data?  Any help would be appreciated.
    > Thanks,
    > Bill
    >
    > _______________________________________________
    > Do not post admin requests to the list. They will be ignored.
    > Cocoa-dev mailing list      (<Cocoa-dev...>)
    > Help/Unsubscribe/Update your Subscription:
    > http://lists.apple.com/mailman/options/cocoa-dev/mailings%
    > 40obviousmatter.com
    >
    > This email sent to <mailings...>
  • Diederik,

    I did something similar.  For an entity property, there are two methods:
    - (long long)elapsedTime
    - (void)setElapsedTime:(long long)value
    Within elapsedTime, I added these two lines of code:
    static unsigned i = 0;
    NSLog( @"i = %d", i++ );
    And then I ran my app.  With no data in the store, and when I import
    data and use insertNewObjectForEntityForName, i goes up to 56.  If I
    quit the app and restart it, i continues past 10,000 and does not
    stop; I have to eventually abort it.  Same data, same array operator
    for a binding value: <arrangedObjects....>.  It is very
    strange.

    Thanks for your help.  I'll try your suggestion also, but it'll
    probably show the same results.

    I posted a copy of the app (it's free), along with sample data and a
    read me file.  Feel free to give it a try <www.modesittsoftware.com/
    temp/TimeSliceDB.zip>.  I'd really like to know what's going on.

    Thanks.
    -Bill

    On Oct 27, 2006, at 12:08 AM, Diederik Hoogenboom wrote:
    > Bill,
    >
    > If you switch SQLLite debugging on ("-com.apple.CoreData.SQLDebug
    > 1" argument on the executable) what queries give you the
    > performance hit? Is it just one query or does the system tries to
    > do 10,000 fetches?
    >
    > Diederik
    >
    > On 26-okt-2006, at 19:41, <cocoalist...> wrote:
    >
    >> I have a relatively simple Core Data application that stores data
    >> in SQLLite format.  Bindings are also used.  Everything works
    >> fine  except when I use any array operators on the data after the
    >> data have been read from disk.  If I start with an empty data
    >> store, and populate it with about 1,000 records using
    >> NSEntityDescription insertNewObjectForEntityForName, the array
    >> operator calculations are performed almost instantly.  If I then
    >> quit the app and reopen it so that the data are read back in, the
    >> same array operators on the same data takes about 45 minutes (yes,
    >> minutes) to calculate the same values.  Why could possibly be
    >> slowing down the calculations of the array operators working on
    >> the exact same data?  Any help would be appreciated.
    >> Thanks,
    >> Bill
previous month october 2006 next month
MTWTFSS
            1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31          
Go to today