Basic data and poor performance

I have been working on this issue for a while and am open to any best practices / tips.

Example

So, I created a sample Core Data application. The app basically mimics the AddressBook app. I have the following persons: group, contact, address, phone, email, web page, dates.

As you probably guessed, a group can have several contacts, and a contact can be in several groups. Contacts can also have multiple addresses, phone numbers, emails, web pages, and dates.

Basically, I imported about 600 contacts into this application from AddressBook. The user interface is relatively simple ... A list of groups / categories on the left and an NSCollectionView or NSTableView on the right, which shows a list of contacts depending on the selected group. (View a collection or view a table ... as you add, the ability to display any kind, both of which are related to NSArrayController)

The elements of the group that I pull through the code, unlike Interface Builder, because I wanted to play with a Thing-like sidebar, and it was much easier to do it this way.

Problem

One category contains all contacts, while the other category contains only 2 contacts. When I select a category that has all the contacts, it takes from 8 to 10 seconds for the information to fill the collection or table. However, doing the same thing in AddressBook itself is very quick, almost instant. I use the SQLLite storage type and try to use several different approaches, including trying to diagnose the problem using tools, but nothing worked.

I tried to set the predicate for the DefaultFetchPredicate parameter of the Contact array controller, and not to set the filter predicate, but this did not work.

I tried preFetching and malfunctioning, but I'm not sure if I am doing it right, and not quite sure how to do this if Interface Builder processes Contact NSArrayController.

Another example

Core Data... , , ( Molecule Atom Atom Element), 65 000 , .

, , -, , // ?

!

+3
1

, NSCollectionView . , x . IKImageBrowserView , , .

, .

!

+1

Source: https://habr.com/ru/post/1748875/


All Articles