Skip to content

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.

Testing process

To test the "Inspiration Set" secondary page performance, the process is as follows:

  1. Clone the remote library git clone https://github.com/momotech/MLN, and open the MLN/MLN-Android directory in Android Studio
  2. Find the sample/src/main/java/com/immomo/demo/App.java directory, and set the debug parameter to false during MLSEngine initialization
  3. Run the release version of the sample project, as shown below:
  4. 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

FPS test

  1. 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)
  2. 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:

Load speed test

  1. 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));
    }
});
  1. 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) {}
});
  1. 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.
  2. Tip: In order to avoid the impact of data loading, the data is delayed by 200ms. The test results are shown below:

Memory test

Test with the profiler tool that comes with Android Studio. Click to view tutorial

Clone this wiki locally