Quote Originally Posted by Lifepower View Post
Dynamic arrays are reference counted, so you don't need to explicitly call SetLength to zero. They will be released automatically when the variable goes out of the scope.

As long as optimizations are enabled, both versions will have equivalent performance as the compiler replaces 256 multipliers with bit shifts. You can confirm this by turning optimization on and then watching generated assembly code. The only difference in this case will be the second approach being more difficult to understand, so I'd recommend sticking to the first approach.
Thanks for clearing that up Lifepower I always err on the side of caution with things like variable clean up and also whether or not the compiler will optimise such things. I always make the assumption it won't and try and figure out the most efficient way of doing it myself.