Easy way to check the speed of your function

private long start, stop, diff; private void startSpeedChk() { start = System.currentTimeMillis(); } private void stopSpeedChk(String functionName){ stop = System.currentTimeMillis(); diff = stop - start; System.out.println(functionName + " took " + diff + " ms"); start=0;stop=0;diff=0; } //usage private void someFunc(){ startSpeedChk(); yourFunction(); stopSpeedChk("yourFunctionName"); }

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.