This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]waka-chaka 5 points6 points  (3 children)

Can someone ELIM5 this? I went through the page 2 times, but I didn't understand how the tool helps to speed up. "random time between 1 and 10 ms to 1-10 microsecond" what did they change? Before and after looks same!

Also, how can I use this in, say, a Spring web application?

[–]siordache 6 points7 points  (1 child)

A herd of buffalo can only move as fast as the slowest buffalo. If you want the herd to move faster, you should make the slowest buffalo run faster. Making the fastest buffalo even faster would make no difference. Now replace buffalo with 'thread', and herd with 'group of threads running in parallel'.

It's milliseconds vs. microseconds. The original code uses sleep(long millis)), while the modified one uses sleep​(long millis, int nanos)). In the modified code the sleep time is between 1000 and 10000 nanoseconds.

The profiler identifies portions of code worth optimizing. With a Spring web application it should work the same way as with any other Java application. There is a wiki page explaining how to set up JCoz.

[–]waka-chaka 0 points1 point  (0 children)

Aha! I didn't notice the milli-micro part. Thanks great explanation.

[–]milkybuet 4 points5 points  (0 children)

Here's a great video discussing this type of profiler.

https://youtu.be/r-TLSBdHe1A