Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

using wait - does this affect system performance? <---- gurus please

 
byronc Ozzie
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

we use wait (5000) a lot in our threaded systems. (we have our own object queues)

in jprofiler this comes up as a hotspot - this is not a bottle neck though right?

thanks


 
Martin Vanyavchich
Ranch Hand
Posts: 241
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not a guru, but I don't see how this could affect performance ... unless you get stuck with a lot of threads in the waiting pool. Even then, they get released in about 5000 miliseconds.
 
Nitesh Kant
Bartender
Posts: 1638
IntelliJ IDE Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
(I feel this question is more appropriate for our performance forum)

Its very hard to point out whether it is a bottleneck or not unless you give us a clue about where it is used.
A simple i++ can also become a performance bottleneck if you do it a million times in the code path. In such a case, it will not be that i++ is non-performant but it is the code that uses it, is the problem.

For example if you have this wait for threads in a receiver thread pool in a server, you might as well looking at very low throughputs. So, without the context/code it is very hard to tell whether it actually is a problem or not.
 
Mike Peters
Ranch Hand
Posts: 67
Debian Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is just a wild guess, but it might be so, that your profiler prefers a call to wait() over a call to wait(timeout).
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic