# Re-coding and Optimizing Cocos2d-x Games for 64-bit ARM Processors (PART 3)

Datetime:2016-08-23 04:31:42         Topic: Cocos2d-X          Share        Original >>

## 5. Obtaining Performance value¶

In this chapter, we mainly explain the meaning of performance parameters and how to obtain those value.

## 5.1 Performance parameter¶

Select the following five parameters to show the difference of performance between platforms:

• FPS : Frame Per Second
• CPU% : CPU utilization
• SPF : Time interval between the rendering frame
• GL verts : The amount of data in every frame
• GL calls : The number of perform rendering instructions

## 5.2 How to do Performance Testing¶

Install the game app on juno board to obtain performance parameter values about FPS, CPU% and SPF etc.; Compare the performance parameter value and get the conclusion:

Juno 64-bit VS Juno 32-bit.

### Install apps:¶

`# adb install -r Cpptests-debug.apk`

### Running the apps and select the test case:¶

Cpp-tests：cpp-test ----> Performance Test ----> Math Perf Test

### Obtain performance parameters¶

Cpp-tests: The initial value of calculation is 100000, and obtain 50 sets of data by increasing 10000 every time.

### Get the cpu utilization¶

Connect phone via USB and debug phone from adb:

`# adb shell`

Or

In the screen shot, the third column is the cpu percentage: 1% and 4%.

## 6. Comparison Performance value¶

In this chapter mainly analysis and compare the performance data obtaining on 32b-bit and 64-bit juno environment, get the conclusion and draw performance comparison chart.

## 6.1 Math library based on Neon instruction set¶

The red curve: The Juno 64-bit based on neon instruction setThe blue curve: The Juno 32-bit based on neon instruction set

FIG. 1 The Tendency of FPS

Comparison results: Under the same number of matrix operations, the fps of ARM 64bit is more 5 frames than ARM 32bit.

FIG. 2 The Tendency of CPU

Comparison results: Under the same number of matrix operations, the CPU utilization on ARM 64bit is lower about 15% than it on ARM 32bit.

FIG. 3 The Tendency of SPF

Comparison results: The time of calculating 4X4 matrix is lower about 15% on ARM 64bit than ARM 32bit.

## 6.2 Math library based on C language¶

The red curve: The Juno 64-bit based on C languageThe blue curve: The Juno 32-bit based on C language

FIG. 1 The Tendency of FPS

Comparison results: Under the same number of matrix operations, the fps of ARM 64bit is more 12 frames than ARM 32bit.

FIG. 2 The Tendency of CPU

Comparison results: Due to the cpu utilization fast up to the maximum, so that the performance improved is not obvious.

FIG. 3 The Tendency of SPF

Comparison results: The time of calculating matrix is lower about 50% on ARM 64bit than ARM 32bit.

## 7. Conclusion¶

This paper mainly includes that the cocos2d-x`s develop, debug and install on 32-bit and 64-bit, and the step of porting 32-bit apps to 64-bit juno board. About the porting and optimizing apps, we obtained performance data and compared these data between 32-bit and 64-bit running mode of ARM processors.

Due to the improved 64-bit ARM processors, 64-bit application execution speed should be faster than 32-bit. From comparison about performance data, we can see that the performance on 64-bit juno environment is higher 15% than which on 32-bit (P.S. math operations benchmark, built via Android NDK r9d+). The code developed on 32-bit platform has some improvement in performance when transplant it to 64-bit platforms.

This article shares some content about porting and optimizing cocos2d-x engine and apps, which have a certain guidance.