AGBenchmark 1.0.1

AGBenchmark 1.0.1

TestsTested
LangLanguage Objective C++Objective C++
License MIT
ReleasedLast Release Sep 2015

Maintained by Alexandr Graschenkov.



  • By
  • Alexandr Graschenkov

This is simple library for benchmark your ObjC, Swift and C++ code. You can watch how much time your code is spend. Some times algorithms begin work longer during the time. AGBenchmark also records this information.

For check how long the part of your code is executed, simple call:

Obj-C
AG_BENCHMARK(@"Sort algorithm") {
    [arr sortUsingSelector:@selector(compare:)];
}
C++
AG_BENCHMARK("Sort algorithm") {
    [arr sortUsingSelector:@selector(compare:)];
}
Swift
AGBenchmarkBlock("Sort algorithm") {
    arr.sortUsingSelector("compare:")
}

And then call [AGBenchmark logBenchmarkInfo]. Or you can call this method in timer:

ObjC
[NSTimer scheduledTimerWithTimeInterval:5.0 target:[AGBenchmark class] selector:@selector(logBenchmarkInfo) userInfo:nil repeats:YES];

In result you will get in log something like this:

(17:57:53.399) Benchmark:
"Default sort algoritm": total: 2.039; average: 0.005526; last 10 times avg: 0.005344; call times: 369;
"Insertion sort algoritm": total: 1485.237; average: 4.035970; last 10 times avg: 3.960172; call times: 368;

Contact

Alexandr Graschenkov: [email protected]

License

AGBenchmark is available under the MIT license.

Copyright © 2015 Alexandr Graschenkov.