mastercake10 / CustomOreGen

A simple yet powerful, fully customizable cobblestone generator for Bukkit
GNU General Public License v3.0
11 stars 11 forks source link

performance improvement. #31

Closed ismail0234 closed 4 years ago

mastercake10 commented 4 years ago

How should this improve the performance?

ismail0234 commented 4 years ago

You do 1 time instead of 2 times. Even fools understand that

mastercake10 commented 4 years ago

That's naive to think. It might look to be more performant to you, but actually, after compilation both versions are equal regarding its execution time.

You can read more about this here: https://softwareengineering.stackexchange.com/questions/358685/using-local-variables-vs-making-multiple-function-method-calls

ismail0234 commented 4 years ago

Read the text well.

There is a performance difference. Integer.toHexString(memory.read(_)) is called 2 times in the first example, and 4 times in the second example.

Apply your own knowledge anyway, goodbye.

mastercake10 commented 4 years ago

I run a test, comparing both versions, and they have the same performance. I gave you a chance to explain why you think that this will improve performance, and you obviously have no arguments.