On Sat, Mar 12, 2011 at 2:18 PM, WoodHacker <ramsa...@comcast.net> wrote:
> We create a reference
> to the block's height and use it throughout the program.   But there
> are many cases where we have to know HALF the height of the block.
> My question is, is it more efficient to create another reference for
> half the block's height or to calculate the half height value every
> time it is needed?

I think this is the same for every other programming language. It
depends on how expensive calculating the half height is and if you
want to make your code possibly less readable by introducing an extra
variable.

If there is no real performance gain by calculating the height only
once, I would recommend just to calculate the half height every time
it is needed. But adding a variable could also improve your code, if
your code is littered with "height / 2" statements it would be sane to
just put it in a variable.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to