CPU Resources and Clock Cycles: System.out.println or Flag Increase

To debug our Android code, we put System.out.println(string)in that will tell us how many times the function was called. Another method would be to set the flag and continue to increment it after each function call. And then at the end print the final value of the flag System.out.println(...). (practically in my application the function will be called thousands of times)

My question is: in terms of CPU resources and Clock cycles , which is easier: an increase operation or System.out.println?

+3
source share
2 answers

, - . , System.out.println vs, . , - - , System.out.println . , , , , IMO.

AtomicLong AtomicInteger , .

+3

. , , . , .

, System.out.println . stdout. .. .

, , , - . , /, .

, , ? , , , . , , .

0

All Articles