A nanosecond (ns) is one billionth of a second (0.000 000 001 second). One nanosecond is to one second as one second is to 31.7 years. One Gigahertz (GHz) equals 1,000,000,000 Hz. One cycle of a 1 GHz CPU takes 1 nanosecond. Array TestsTesting Cocos2D's CCArray performance against regular NSMutableArray.Name | Each (ns) | NSMutableArray objectAtIndex: | 77 | CCArray objectAtIndex: | 82 | CFArray GetValueAtIndex | 136 | CCArray exchangeObjectAtIndex | 254 | CCArray withCapacity addObject: | 325 | CCArray addObject: | 373 | NSMutableArray insertObject: atIndex:0 | 478 | NSMutableArray withCapacity addObject: | 604 | NSMutableArray addObject: | 622 | CCArray removeLastObject | 664 | NSMutableArray removeLastObject | 1.039 | CCArray removeObjectAtIndex | 1.569 | NSMutableArray removeObjectAtIndex | 1.784 | NSMutableArray exchangeObjectAtIndex | 1.985 | CCArray indexOfObject | 15.309 | CCArray containsObject | 15.506 | CCArray fast enumeration | 22.050 | NSMutableArray fast enumeration | 28.418 | NSMutableArray indexOfObject | 38.334 | NSMutableArray containsObject | 40.514 | CCArray insertObject: atIndex:0 | 56.976 | NSMutableArray enumeration | 84.579 | CCArray enumeration | 88.456 | NSMutableArray makeObjectsPerformSelector withObject | 121.212 | CCArray makeObjectsPerformSelector withObject | 128.970 | NSMutableArray makeObjectsPerformSelector | 183.931 | CCArray makeObjectsPerformSelector | 234.260 | NSMutableArray add/removeObjectsInArray | 883.085 | CCArray add/removeObjectsInArray | 2.398.743 |
Object CreationThese tests tell you how long it takes to allocate memory, initialize the object, and deallocate it. The longer this takes for an object, the higher the chance that doing this during gameplay will negatively affect performance. Note that these tests do not give any indication whatsoever of the runtime/rendering performance of these objects.Name | Each (ns) | NSAutoreleasePool alloc/init/release | 630 | NSObject alloc/init/release | 3.137 | CCNode alloc/init/release | 3.928 | CCMoveTo alloc/init/release | 4.259 | CCSequence alloc/initOne/release | 5.096 | CCSprite alloc/initWithFile/release | 23.554 | CCParticleSystemQuad 25 particles alloc/init/release | 168.798 | CCParticleSystemQuad 250 particles alloc/init/release | 413.338 | CCLabelTTF alloc/initWithString/release | 579.575 | CCLabelBMFont alloc/initWithString/release | 653.608 | CCTMXTiledMap small alloc/init/release | 15.724.142 | CCTMXTiledMap large alloc/init/release | 1.129.904.604 |
Loading TexturesTime it takes to load and unload the same 1024x1024 texture using a variety of different image file formats, compression and color bit depths.Name | Each (ns) | PVRTC4.pvr.ccz | 651.275 | PVRTC2.pvr.ccz | 748.332 | PVRTC2.pvr | 5.574.554 | PVRTC4.pvr | 8.747.835 | PVRTC2.pvr.gz | 12.382.721 | PVRTC4.pvr.gz | 21.729.260 | RGB565.pvr | 28.060.432 | RGBA5551.pvr | 28.422.838 | RGBA4444.pvr | 28.423.882 | RGBA4444.pvr.ccz | 39.611.505 | RGBA5551.pvr.ccz | 41.135.829 | RGB565.pvr.ccz | 41.304.006 | RGBA4444.pvr.gz | 46.920.818 | RGBA5551.pvr.gz | 47.976.535 | RGB565.pvr.gz | 49.175.556 | RGBA8888.pvr | 54.818.895 | RGBA8888.pvr.ccz | 81.683.766 | RGBA8888.pvr.gz | 95.916.186 | RGB565.png | 113.274.316 | RGBA5551.png | 114.599.338 | RGBA4444.png | 115.231.899 | RGBA8888.png | 127.134.580 | RGBA8888.jpg | 851.384.812 | RGBA5551.jpg | 865.443.154 | RGBA4444.jpg | 867.075.779 | RGB565.jpg | 870.333.871 |
Node Hierarchy (children)The performance of functions that act on the node hierarchy (children list) depends heavily on the number of children.Name | Each (ns) | getChildByTag w/ 10 Nodes | 642 | reorderChild w/ 10 Nodes | 3.728 | getChildByTag w/ 100 Nodes | 3.960 | reorderChild w/ 100 Nodes | 9.322 | addChild with tag | 9.903 | getChildByTag w/ 500 Nodes | 20.861 | removeChildByTag | 22.331 | reorderChild w/ 500 Nodes | 33.852 | getChildByTag w/ 2,500 Nodes | 123.275 | reorderChild w/ 2,500 Nodes | 179.381 |
Messaging / Function CallsLow-level overhead for calling C++ functions respectively sending Objective-C messages in various ways.Name | Each (ns) | C++ virtual method call | 13 | IMP-cached message send | 17 | C++ cached virtual method call | 30 | Objective-C message send | 37 | NSInvocation message send | 439 |
Arithmetic TestsSimple calculations done frequently in an app, using various data types.Name | Each (ns) | Integer multiplication | 10 | Float multiplication | 36 | Double multiplication | 47 | Integer division | 48 | Float division with int conversion | 72 | Float division | 73 | Float square root | 106 | Double division | 108 | Double division with int conversion | 111 | Double square root | 148 | Accelerometer Highpass filter | 267 |
Memory TestsAllocating and releasing memory.Name | Each (ns) | 16 byte memcpy | 26 | 16 byte malloc/free | 503 | 16MB malloc/free | 14.629 | 1MB memcpy | 1.087.525 |
File IOName | Each (ns) | Read 16MB file | 121.258 | Read 16-byte file | 124.130 | Write 16-byte file | 499.013 | Write 16-byte file (atomic) | 819.701 | Write 16MB file | 880.762 | Write 16MB file (atomic) | 1.134.361 |
Miscellaneous TestsName | Each (ns) | Zero-second delayed perform | 294 | pthread create/join | 142.973 |
|
A nanosecond (ns) is one billionth of a second (0.000 000 001 second). One nanosecond is to one second as one second is to 31.7 years. One Gigahertz (GHz) equals 1,000,000,000 Hz. One cycle of a 1 GHz CPU takes 1 nanosecond. Array TestsTesting Cocos2D's CCArray performance against regular NSMutableArray.Name | Each (ns) | NSMutableArray objectAtIndex: | 100 | CCArray objectAtIndex: | 105 | CFArray GetValueAtIndex | 176 | CCArray exchangeObjectAtIndex | 324 | CCArray withCapacity addObject: | 416 | CCArray addObject: | 419 | NSMutableArray insertObject: atIndex:0 | 572 | NSMutableArray withCapacity addObject: | 687 | NSMutableArray addObject: | 688 | CCArray removeLastObject | 857 | NSMutableArray removeLastObject | 1.336 | CCArray removeObjectAtIndex | 2.040 | NSMutableArray removeObjectAtIndex | 2.328 | NSMutableArray exchangeObjectAtIndex | 2.592 | CCArray containsObject | 19.886 | CCArray indexOfObject | 19.962 | CCArray fast enumeration | 28.560 | NSMutableArray fast enumeration | 36.668 | NSMutableArray indexOfObject | 49.743 | NSMutableArray containsObject | 52.521 | CCArray insertObject: atIndex:0 | 72.364 | NSMutableArray enumeration | 109.026 | CCArray enumeration | 114.515 | NSMutableArray makeObjectsPerformSelector withObject | 153.813 | CCArray makeObjectsPerformSelector withObject | 167.441 | NSMutableArray makeObjectsPerformSelector | 238.568 | CCArray makeObjectsPerformSelector | 250.246 | NSMutableArray add/removeObjectsInArray | 953.803 | CCArray add/removeObjectsInArray | 3.090.132 |
Object CreationThese tests tell you how long it takes to allocate memory, initialize the object, and deallocate it. The longer this takes for an object, the higher the chance that doing this during gameplay will negatively affect performance. Note that these tests do not give any indication whatsoever of the runtime/rendering performance of these objects.Name | Each (ns) | NSAutoreleasePool alloc/init/release | 892 | NSObject alloc/init/release | 4.050 | CCNode alloc/init/release | 5.099 | CCMoveTo alloc/init/release | 5.504 | CCSequence alloc/initOne/release | 6.680 | CCSprite alloc/initWithFile/release | 29.451 | CCParticleSystemQuad 25 particles alloc/init/release | 154.623 | CCParticleSystemQuad 250 particles alloc/init/release | 508.432 | CCLabelTTF alloc/initWithString/release | 739.952 | CCLabelBMFont alloc/initWithString/release | 847.045 | CCTMXTiledMap small alloc/init/release | 18.578.580 | CCTMXTiledMap large alloc/init/release | 1.438.647.079 |
Loading TexturesTime it takes to load and unload the same 1024x1024 texture using a variety of different image file formats, compression and color bit depths.Name | Each (ns) | PVRTC4.pvr.ccz | 904.563 | PVRTC2.pvr.ccz | 917.834 | PVRTC2.pvr | 6.600.616 | PVRTC4.pvr | 10.321.815 | PVRTC2.pvr.gz | 15.267.200 | PVRTC4.pvr.gz | 27.684.074 | RGB565.pvr | 32.698.952 | RGBA4444.pvr | 32.708.815 | RGBA5551.pvr | 32.889.440 | RGBA4444.pvr.ccz | 47.412.733 | RGBA5551.pvr.ccz | 48.655.328 | RGB565.pvr.ccz | 49.367.906 | RGBA4444.pvr.gz | 58.213.932 | RGBA5551.pvr.gz | 59.741.089 | RGB565.pvr.gz | 60.072.209 | RGBA8888.pvr | 63.956.478 | RGBA8888.pvr.ccz | 97.924.909 | RGBA8888.pvr.gz | 117.333.748 | RGB565.png | 135.442.519 | RGBA5551.png | 137.939.474 | RGBA4444.png | 138.107.768 | RGBA8888.png | 149.741.913 | RGBA8888.jpg | 1.088.439.833 | RGBA5551.jpg | 1.099.894.992 | RGBA4444.jpg | 1.101.358.371 | RGB565.jpg | 1.102.385.583 |
Node Hierarchy (children)The performance of functions that act on the node hierarchy (children list) depends heavily on the number of children.Name | Each (ns) | getChildByTag w/ 10 Nodes | 846 | reorderChild w/ 10 Nodes | 4.799 | getChildByTag w/ 100 Nodes | 5.163 | reorderChild w/ 100 Nodes | 11.768 | addChild with tag | 12.631 | getChildByTag w/ 500 Nodes | 27.561 | removeChildByTag | 29.432 | reorderChild w/ 500 Nodes | 44.279 | getChildByTag w/ 2,500 Nodes | 156.393 | reorderChild w/ 2,500 Nodes | 227.192 |
Messaging / Function CallsLow-level overhead for calling C++ functions respectively sending Objective-C messages in various ways.Name | Each (ns) | C++ virtual method call | 16 | IMP-cached message send | 22 | C++ cached virtual method call | 39 | Objective-C message send | 48 | NSInvocation message send | 569 |
Arithmetic TestsSimple calculations done frequently in an app, using various data types.Name | Each (ns) | Integer multiplication | 12 | Float multiplication | 47 | Double multiplication | 61 | Integer division | 63 | Float division | 93 | Float division with int conversion | 94 | Float square root | 137 | Double division | 140 | Double division with int conversion | 145 | Double square root | 190 | Accelerometer Highpass filter | 346 |
Memory TestsAllocating and releasing memory.Name | Each (ns) | 16 byte memcpy | 34 | 16 byte malloc/free | 649 | 16MB malloc/free | 21.227 | 1MB memcpy | 1.178.374 |
File IOName | Each (ns) | Read 16-byte file | 149.936 | Read 16MB file | 156.952 | Write 16-byte file | 660.388 | Write 16-byte file (atomic) | 943.402 | Write 16MB file (atomic) | 1.043.194 | Write 16MB file | 1.044.325 |
Miscellaneous TestsName | Each (ns) | Zero-second delayed perform | 5 | pthread create/join | 180.477 |
|
A nanosecond (ns) is one billionth of a second (0.000 000 001 second). One nanosecond is to one second as one second is to 31.7 years. One Gigahertz (GHz) equals 1,000,000,000 Hz. One cycle of a 1 GHz CPU takes 1 nanosecond. Array TestsTesting Cocos2D's CCArray performance against regular NSMutableArray.Name | Each (ns) | CCArray objectAtIndex: | 380 | NSMutableArray objectAtIndex: | 460 | CCArray exchangeObjectAtIndex | 1.136 | CFArray GetValueAtIndex | 1.514 | CCArray addObject: | 3.532 | CCArray withCapacity addObject: | 3.562 | NSMutableArray insertObject: atIndex:0 | 5.567 | NSMutableArray withCapacity addObject: | 6.017 | NSMutableArray addObject: | 6.173 | CCArray removeLastObject | 9.820 | NSMutableArray removeLastObject | 10.938 | CCArray removeObjectAtIndex | 27.121 | NSMutableArray removeObjectAtIndex | 32.427 | NSMutableArray exchangeObjectAtIndex | 41.978 | CCArray containsObject | 58.970 | CCArray indexOfObject | 63.629 | CCArray fast enumeration | 84.829 | NSMutableArray fast enumeration | 110.895 | NSMutableArray containsObject | 159.196 | NSMutableArray indexOfObject | 160.993 | CCArray insertObject: atIndex:0 | 360.513 | NSMutableArray enumeration | 463.399 | NSMutableArray makeObjectsPerformSelector | 508.814 | NSMutableArray makeObjectsPerformSelector withObject | 541.626 | CCArray makeObjectsPerformSelector | 681.136 | CCArray makeObjectsPerformSelector withObject | 703.787 | CCArray enumeration | 724.694 | NSMutableArray add/removeObjectsInArray | 6.701.924 | CCArray add/removeObjectsInArray | 9.801.766 |
Object CreationThese tests tell you how long it takes to allocate memory, initialize the object, and deallocate it. The longer this takes for an object, the higher the chance that doing this during gameplay will negatively affect performance. Note that these tests do not give any indication whatsoever of the runtime/rendering performance of these objects.Name | Each (ns) | NSAutoreleasePool alloc/init/release | 10.672 | NSObject alloc/init/release | 19.240 | CCNode alloc/init/release | 25.884 | CCMoveTo alloc/init/release | 26.179 | CCSequence alloc/initOne/release | 41.992 | CCSprite alloc/initWithFile/release | 149.578 | CCParticleSystemQuad 25 particles alloc/init/release | 400.082 | CCParticleSystemQuad 250 particles alloc/init/release | 730.617 | CCLabelTTF alloc/initWithString/release | 3.411.428 | CCLabelBMFont alloc/initWithString/release | 3.792.740 | CCTMXTiledMap small alloc/init/release | 82.298.633 | CCTMXTiledMap large alloc/init/release | 6.078.265.400 |
Loading TexturesTime it takes to load and unload the same 1024x1024 texture using a variety of different image file formats, compression and color bit depths.Name | Each (ns) | PVRTC4.pvr.ccz | 4.932.652 | PVRTC2.pvr.ccz | 5.143.908 | PVRTC2.pvr | 20.710.732 | PVRTC4.pvr | 33.422.953 | PVRTC2.pvr.gz | 46.133.937 | PVRTC4.pvr.gz | 86.878.310 | RGB565.pvr | 132.076.267 | RGBA4444.pvr | 155.906.383 | RGBA5551.pvr | 157.559.150 | RGB565.pvr.ccz | 189.076.883 | RGBA5551.pvr.ccz | 206.933.150 | RGBA4444.pvr.ccz | 208.405.133 | RGB565.pvr.gz | 212.562.350 | RGBA4444.pvr.gz | 226.271.433 | RGBA5551.pvr.gz | 228.623.450 | RGBA8888.pvr | 285.217.617 | RGBA8888.pvr.ccz | 392.353.400 | RGBA8888.pvr.gz | 420.908.317 | RGB565.png | 697.689.750 | RGBA4444.png | 702.992.150 | RGBA5551.png | 704.371.517 | RGBA8888.png | 740.525.900 | RGBA8888.jpg | 4.250.968.067 | RGBA4444.jpg | 4.320.874.967 | RGBA5551.jpg | 4.336.442.100 | RGB565.jpg | 4.377.636.567 |
Node Hierarchy (children)The performance of functions that act on the node hierarchy (children list) depends heavily on the number of children.Name | Each (ns) | getChildByTag w/ 10 Nodes | 3.950 | getChildByTag w/ 100 Nodes | 21.985 | reorderChild w/ 10 Nodes | 22.472 | reorderChild w/ 100 Nodes | 56.199 | addChild with tag | 59.295 | removeChildByTag | 92.136 | getChildByTag w/ 500 Nodes | 157.449 | reorderChild w/ 500 Nodes | 270.803 | getChildByTag w/ 2,500 Nodes | 357.068 | reorderChild w/ 2,500 Nodes | 1.422.534 |
Messaging / Function CallsLow-level overhead for calling C++ functions respectively sending Objective-C messages in various ways.Name | Each (ns) | C++ virtual method call | 62 | IMP-cached message send | 69 | C++ cached virtual method call | 134 | Objective-C message send | 166 | NSInvocation message send | 2.000 |
Arithmetic TestsSimple calculations done frequently in an app, using various data types.Name | Each (ns) | Integer multiplication | 19 | Float multiplication | 41 | Double multiplication | 45 | Float division | 75 | Float division with int conversion | 105 | Double division | 115 | Float square root | 144 | Double division with int conversion | 147 | Double square root | 186 | Integer division | 367 | Accelerometer Highpass filter | 422 |
Memory TestsAllocating and releasing memory.Name | Each (ns) | 16 byte memcpy | 153 | 16 byte malloc/free | 2.747 | 16MB malloc/free | 36.955 | 1MB memcpy | 10.162.236 |
File IOName | Each (ns) | Read 16MB file | 856.130 | Read 16-byte file | 858.290 | Write 16MB file (atomic) | 2.214.739 | Write 16-byte file | 4.794.658 | Write 16-byte file (atomic) | 4.995.794 | Write 16MB file | 8.658.106 |
Miscellaneous TestsName | Each (ns) | Zero-second delayed perform | 335 | pthread create/join | 806.348 |
|