SCJP2, SCWCD
Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Originally posted by Julia Chen:
Use bulk accessor if you don't like frequent method call
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Originally posted by Eugene Kononov:
Great test, -- yes, if I reverse the order (method invocations first, field references second), then the latter is about 300ms faster than the former. I would guess that it has something to do with run time optimizations.
I didn't look at the byte code yet, but I would bet that it is actually the same for both tests (accessing the filed value directly or by method invocation).
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
"I'm not back." - Bill Harding, Twister
Originally posted by Eugene Kononov:
BTW, why is it the that new lines are not preserved when I post code? I know that it works for majority of the posters, but it never does for me. I use JBuilder for code, is there some option that loses the new lines when I copy from there and paste here?
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Consider Paul's rocket mass heater. |