-
Notifications
You must be signed in to change notification settings - Fork 207
Performance test process
xuwhale6 edited this page Jan 8, 2020
·
2 revisions
For MLN performance testing, you need to turn off the debug switch and use the compiled Lua binary code. Avoid debugging that affects performance.
To test the "Inspiration Set" secondary page performance, the process is as follows:
- Clone the remote library
git clone https://github.com/momotech/MLN
, and open theMLN/MLN-Android
directory in Android Studio - Find the
sample/src/main/java/com/immomo/demo/App.java
directory, and set the debug parameter to false during MLSEngine initialization - Run the release version of the sample project, as shown below:
- After entering the app, click the "Demo Project" button. Click the cell picture of the "Discovery Page" to enter the secondary page and start the test.
prompt:
* The Meilishuo code in the sample is already a binary .lua file. The directory is: sample/src/main/assets/gallery
* Meilishuo source directory: sample/src/main/assets/gallerySource
- Before testing, slide down the list to load enough data, and then slide back to the top of the list (to avoid loading animation interference)
- Execute the
python sample/src/main/assets/fps.py
command. Runs adb instructions internally. Automatically slide 25 times to print card frame ratio data. As shown below:
- In the sample project, open the LuaViewActivity.java file and add the following code to the first line of the
onCreate()
method:
final long startTime = System.currentTimeMillis();
getWindow().getDecorView().getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
Log.d("MLN test", "onGlobalLayout: " + (System.currentTimeMillis() - startTime));
}
});
- Set the listener for the instance object, the code is as follows:
instance.setScriptStateListener(new ScriptStateListener() {
@Override
public void onSuccess() {
Log.d("MLN test", "onSuccess: " + (System.currentTimeMillis() - startTime));
}
@Override
public void onFailed(Reason reason) {}
});
- The MLN page loading process is: page creation-> MLN virtual machine operation-> window layout is complete. The monitoring time is: after the virtual machine
onSuccess()
callback,onGlobalLayout()
callback. - Tip: In order to avoid the impact of data loading, the data is delayed by 200ms. The test results are shown below:
Test with the profiler tool that comes with Android Studio. Click to view tutorial