I just call that method in a for, after a HTTP GET (i get JSON that 
contains some exerciseTemplates), 

NSURLSessionDataTask *exerciseTask = [[SessionManager sharedSessionManager] 
GET:EXERCISE_LIST_PATH parameters:params success:^(NSURLSessionDataTask *
task, id responseObject) {

            NSDictionary *JSON = (NSDictionary *)responseObject;

            [self parseExercises:JSON];

        } failure:^(NSURLSessionDataTask *task, NSError *error) {

            DDLogError(@"Could not load exercises!");

        }];

and here the parsing method: 

- (void)parseExercises:(NSDictionary *)JSON {

    NSArray *tempArray = [JSON valueForKey:@"exercises"];


  for (NSDictionary *dict in tempArray) {

ExerciseTemplate *template = [[ExerciseTemplate alloc] init];

           

            NSString *exerciseName = [dict valueForKey:@"name"];

            NSString *exercise_id = [dict valueForKey:@"id"];

            NSNumber *dynamic = [dict valueForKey:@"dynamic"];

            NSNumber *uniateral = [dict valueForKey:@"unilateral"];

            NSString *content = [dict valueForKey:@"content"];

            NSNumber *repetitionMaximum = [dict valueForKey:@
"repetition_maximum"];

            NSDictionary *thresholdDict = [dict valueForKey:@"thresholds"];

            NSDictionary *polygonDict = [dict valueForKey:@"polygon"];

            

            template.name = exerciseName;

            template.template_id = exercise_id;

            template.dynamic = dynamic.boolValue;

            template.unilateral = uniateral.boolValue;

            template.content = content;

            template.repetitionMaximum = repetitionMaximum.floatValue;

            template.thresholdDict = thresholdDict;

            template.polygonExplosiveness = [polygonDict objectForKey:@"ex"
];

            template.polygonPower = [polygonDict objectForKey:@"po"];

            template.polygonResistance = [polygonDict objectForKey:@"re"];

            template.polygonStrength = [polygonDict objectForKey:@"st"];

            template.polygonVelocity = [polygonDict objectForKey:@"sp"];

        

            //[transaction setObject:template forKey:template.template_id   
                   inCollection:EXERCISE_TEMPLATE_COLLECTION];

            

            [[TPADatabaseManager sharedManager] saveExeciseTemplate:template
];

        //}];

    }

}

Yes, i know, i can just skip the "parsing"/allocation/init of an 
exerciseTemplate, and put in DB value from Dictionary, that i do in for's 
body but i do not think is that my problem. Am i right?

I'm currently trying some other strategies to lighten the algorithm.

Thank you for the help.

Il giorno giovedì 16 luglio 2015 17:59:33 UTC+2, Jens Alfke ha scritto:
>
>
> On Jul 16, 2015, at 12:59 AM, Daniel Sonny Agliardi <[email protected] 
> <javascript:>> wrote:
>
> This "issue" happens when i do about 30 UPDATE queries in a for.
>
>
> Can you show what your code looks like? I’m not sure exactly what you’re 
> calling because there’s nothing in Couchbase Lite called literally “UPDATE”.
>
> Also, are you saying it takes 12 seconds (the time shown in the profile) 
> to do 30 document updates? That’s way off from our benchmarks; you should 
> be able to update something like 1,000 docs a second (depending on the 
> device and the size of the docs of course.)
>
> —Jens
>

-- 
You received this message because you are subscribed to the Google Groups 
"Couchbase Mobile" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/mobile-couchbase/0bd9386e-4010-420a-8fc0-4f3cfb3ae7e8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to