AlexDenisov/iActiveRecord — pull request #31 by mgod (2013-04-24 03:42:18+00:00)
Title: Improve read performance approximately 2x

Minimize expensive calls in tight loops. This may not be worth accepting given the state of development on the sql calls right now. Tested by adding:

@property (nonatomic, readwrite) double doubleProperty;

to DecimalRecord and running this micro-benchmark:

it(@"should run some very basic performance tests", ^{
NSDecimalNumber *acc = [NSDecimalNumber one];
while (acc.floatValue < 10000) {
DecimalRecord *record = [DecimalRecord newRecord];
record.decimal = acc;
record.doubleProperty = acc.doubleValue;
[record save];
acc = [acc decimalNumberByAdding:[NSDecimalNumber one]];
}
for(int i = 0; i < 5; i++) {
NSDate *start = [NSDate date];
[DecimalRecord allRecords];
NSLog(@"Time elapsed: %f", [[NSDate date] timeIntervalSinceDate:start]);
}
});