I'd like to understand of what types of operations contribute disproportionately to CPU load as well as develop an intuition on relative cost of common operations. To minimize generalizations, please assume Oracle 7 HotSpot JVM.
For example:
Any tips on developing an intuition of relative CPU cost of typical operations?
Any good reads on the subject you could recommend?
thank you,
CLARIFICATION
thanks for early responses, but please note I:
Instead, I am looking for guidance of relative CPU cost, especially w.r.t. above operations (let's assume a 'web-scale' app uses all ops mentioned equal amount - a lot).
For example I already now that:
...but what about instantiating new objects or contenting for a monitor? Would either of these ops be significant (dominant?) contributors to CPU load (let's say I don't care about latency or heap size) at scale?
I think that among you wrote the relative CPU consumption is follows:
1) indexing of an array; it's fast; it's just addressing
2) monitor -- slower; suspended and waiting threads do not consume CPU, switching consumes very little CPU, but more than indexing
3) creating an object may be slow if an object is complex and causes sub-objects creation; creating a single new Object()
just slightly slower than thread switching; but may be I am wrong and it is the same; anyway comparable
4) throwing/catching an exception is VERY slow; it is 10-100 times slower that creating an object