Skip to content

iOS: Object Pinning takes too much time #318

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

Closed
Mohd-Aamir-M opened this issue Sep 24, 2015 · 5 comments
Closed

iOS: Object Pinning takes too much time #318

Mohd-Aamir-M opened this issue Sep 24, 2015 · 5 comments
Labels
state:duplicate Duplicate of already reported issue

Comments

@Mohd-Aamir-M
Copy link

Below is the simple code i have, after few hundreds of pinned objects, new object take more than 12 seconds to pin.

-(void)saveToparse{
PFQuery query= [PFQuery queryWithClassName:@"register"];
[query fromPinWithName:self.registerId];
[query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
if (objects.count==1) {
PFObject *object = [objects objectAtIndex:0];
[self setvalue:object];
[object saveEventually];
[object pinInBackgroundWithName:self.registerId];
}
else{
PFObject
object = [PFObject objectWithClassName:@"register"];
[self setvalue:object];
[object saveEventually];
[object pinInBackgroundWithName:self.registerId];
}
}
];
}

-(void)setvalue:(PFObject *)object{
[object setObject:self.registerId forKey:@"register_id"];
[object setObject:[NSNumber numberWithFloat:self.amountIn] forKey:@"field1"];
[object setObject:[NSNumber numberWithFloat:self.amountOut] forKey:@"field2"];
[object setObject:[NSNumber numberWithInt:self.transactionType] forKey:@"trans_type"];
[object setObject:[NSNumber numberWithFloat:self.total] forKey:@"total"];
[object setObject:self.date forKey:@"date"];
[object setObject:self.username forKey:@"username"];
}

@nlutsenko
Copy link
Contributor

Hey @psiphone, this sounds about right.
A general recommendation - use smaller pins, since there is no limit on the total pin count.

We are also tracking overall LDS (local datastore) performance improvements in #32, and there is some information there around this.

@nlutsenko nlutsenko added the state:duplicate Duplicate of already reported issue label Sep 24, 2015
@nlutsenko nlutsenko self-assigned this Sep 24, 2015
@Mohd-Aamir-M
Copy link
Author

Ohh, so if my rows in a table is 10k then will it increase time to pin an object?

@nlutsenko
Copy link
Contributor

Yup. We have a somewhat linear dependency on number of objects in a pin, so yes - 10k objects will slow things down.

@Mohd-Aamir-M
Copy link
Author

How much time it will take to pin an object if i have 10k rows in a customer table with 2 pointers and 5 string fields?

@Mohd-Aamir-M
Copy link
Author

Hope this fixes in 1.9.0 else i will have to drop parse.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
state:duplicate Duplicate of already reported issue
Projects
None yet
Development

No branches or pull requests

2 participants