Latest 1.0.1
License MIT
Platforms ios 5.0, requires ARC
Frameworks Foundation

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:

AG_BENCHMARK(@"Sort algorithm") {
    [arr sortUsingSelector:@selector(compare:)];

AG_BENCHMARK("Sort algorithm") {
[arr sortUsingSelector:@selector(compare:)];

###### Swift
AGBenchmarkBlock("Sort algorithm") {

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

[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;


Alexandr Graschenkov: [email protected]


AGBenchmark is available under the MIT license.

Copyright © 2015 Alexandr Graschenkov.

Latest podspec

    "name": "AGBenchmark",
    "version": "1.0.1",
    "summary": "Small library for easy benchmark your ObjC, Swift and C++ code",
    "description": "I use it for benchmark part of algorithm writed on C++. Unforteniatly did't find any library for this purpose. Hope thap library will help somebody.",
    "homepage": "",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    "authors": {
        "Alexandr Graschenkov": "[email protected]"
    "platforms": {
        "ios": "5.0"
    "source": {
        "git": "",
        "tag": "v1.0.1"
    "source_files": "AGBenchmark/**/*.{h,m,mm}",
    "requires_arc": true,
    "frameworks": "Foundation",
    "libraries": "c++"

Pin It on Pinterest

Share This