Skip to content

Tag: performance

Measuring time spent on GC

Suppose I am testing a Java server application. I know how much time it takes to finish the test. Now I’d like to know how much was spent on GC during that test. How can I do it? Answer The simplest way is to use the -Xloggc and -XX:-PrintGCTimeStamps options when starting up your JVM. I think it prints…

for-loop very slow on Android device

I just ran into an issue while trying to write an bitmap-manipulating algo for an android device. I have a 1680×128 pixel Bitmap and need to apply a filter on it. But this very simple code-piece actually took almost 15-20 seconds to run on my Android device (xperia ray with a 1Ghz processor). So I tried …

Heap allocation and suitable hardware

For a C# .net 3.5 application which unavoidably creates a lot of data on the heap, in terms of hardware what would I be looking for in terms of memory? Would it just be the largest socket bus width? Or the “bandwidth” of the memory sticks? Or the actual frequency they run at? We have concluded the…

What is more efficient: System.arraycopy or Arrays.copyOf?

The toArray method in ArrayList, Bloch uses both System.arraycopy and Arrays.copyOf to copy an array. How can I compare these two copy methods and when should I use which? Answer The difference is that Arrays.copyOf does not only copy elements, it also creates a new array. System.arraycopy copies into an exis…