Art: check X took Y ms

I have a warning in my logcat:

W/art: Verification of void com.myapp.LoginFragment$override.lambda$logIn$5(com.myapp.LoginFragment, java.lang.Throwable) took 217.578ms 

Here is the code:

 subscription = viewModel.logIn() .observeOn(AndroidSchedulers.mainThread()) .subscribe( this::showStudioSelection, error -> { ErrorResponse errorResponse = ErrorResponseFactory.create(error); if (errorResponse.code() == ApiResult.BAD_REQUEST) { Snackbar.make(getView(), R.string.login_bad_credentials, Snackbar.LENGTH_LONG) .setAction(android.R.string.ok, v -> {}) .show(); } else { Snackbar.make(getView(), "Unknown error " + errorResponse.code(), Snackbar.LENGTH_LONG) .setAction(android.R.string.ok, v -> {}) .show(); } viewModel.updateLoginButtonState(); } ); 

220 ms is quite a lot (and I feel that I notice lagging behind the launch of this fragment).

I use RxJava and retrolambda, but this is not the only place this message appears, so I don’t think it is directly connected.

How can I affect the scan time? Is it worth it?

This seems to be due to cyclical complexity, since I could get rid of waring by deleting the calls to Snackbar.make in if with even drier code:

 String errorMessage; if (errorResponse.code() == ApiResult.BAD_REQUEST) { errorMessage = getString(R.string.login_bad_credentials); } else { errorMessage = "Unknown error " + errorResponse.code(); } 
+7
performance android android-runtime
source share
1 answer

This seems to be part of the backward compatibility requirement for the newer ART environment. That is, applications created using DALVIK should also work on ART .

If you run the DVM application in the ART system, you will see this message at the first start, when dex2oat converts the application. If you target the ART application, the application will no longer be able to run on DVM , but OAT conversion will occur during installation and will not be displayed at run time.

Source: Art of Art Please note that this is part three of the ART study, and you may need to check the details two and three.

+5
source share

All Articles