开发者

Android -- can System.out.println() significantly decrease performance like it does on a PC

开发者 https://www.devze.com 2023-03-03 20:34 出处:网络
System calls are 开发者_如何学JAVAvery expensive. System.out.println() can bring an app to its knees if ran inside a loop. Does it affect the console-less android similarly?Ran a quick test for you us

System calls are 开发者_如何学JAVAvery expensive. System.out.println() can bring an app to its knees if ran inside a loop. Does it affect the console-less android similarly?


Ran a quick test for you using a 10000000 iteration loop.

Empty ~ 200ms System.out.println() ~ 5600ms System.out.println("abcdefghijklmnop") ~ 90000ms

Up to you apply that to your situation whether it is acceptable or not.

Btw it doesn't do nothing, it prints to the device log

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号