Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for updating an AutoView's sorting block without updating it's grouping block #485

Merged
merged 2 commits into from
Feb 7, 2019

Conversation

gcox
Copy link
Contributor

@gcox gcox commented Feb 6, 2019

Related #222
Resolves #286

Adds setSorting:versionTag: to YapDatabaseAutoViewTransaction, which allows you to update the sorting block without the overhead of re-grouping all records in the view.

High points:

I don't like the first half of the resortView method where it gathers the row ids. It shouldn't be a problem for most data sets, but loading all rowIds into memory, each boxed in an NSNumber doesn't feel good at all. This should be refactored to use a data structure with a predictable memory footprint, but I wanted to get something working first to make sure I wasn't missing any larger concepts.

The two _handleChangeWithRowid:... methods can also probably be refactored a bit to share some code. Again, want to make sure I haven't missed something important first.

@robbiehanson robbiehanson merged commit 6de0a47 into yapstudios:master Feb 7, 2019
@robbiehanson
Copy link
Contributor

robbiehanson commented Feb 7, 2019

Awesome ! 👍

loading all rowIds into memory, each boxed in an NSNumber doesn't feel good at all

This may not be as much of a problem on 64-bit. If memory serves correctly, the runtime has a special optimization for boxing numbers, which allows it to skip much of the normal object allocation/deallocation routines. There's a good post about it here.

Another option would be to use C++ vectors. In fact, this is the approach I took back in the day when 32-bit was still super common. You can see it in YapDatabaseViewPage.

But everything is functional, so at this point it's just minor performance improvements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants