Alex Rivera | Logout

How does method call affect the performance in Java?

Asked 2011-08-08T17:36:04.263
12

I do like to write really readable code in Java. For that I use the builder pattern and have a lot of static methods. But at some point I do call or chain a lot of methods, so I came up with this question: Does it have any performance issues calling a lot of methods?

Edit
Report

1 Answer

9

What the method does has a far greater effect than the method call itself. This is a pre-mature optimization that you would be advised to avoid.

You have no idea how runtime optimizations built into the JVM itself will affect performance. They will be much smarter than your attempts.

Write your app, profile it, and see if there are any obvious improvements you can make. Repeat until performance is acceptable.

answered 2011-08-08T17:38:01.180

Your Answer