Pages

January 1, 2014

Java analyzing thread creation time

In Java, the thread creation time increases with the number of thread that are already created, hence it is advisable to keep the thread count minimal and only create a Thread when actually needed.

The below gist is a minimal piece of java code that helps in proving this


You'll see a output similar to:

1 numbered thread created in 2ms
100 numbered thread created in 6ms
173 numbered thread created in 15ms
1144 numbered thread created in 19ms
1144 numbered thread created in 19ms.
3161 numbered thread created in 22ms.
6486 numbered thread created in 32ms.
7079 numbered thread created in 36ms.




No comments:

Post a Comment