It's more complex code though that may yield a performance hit as it is summing floats vs. summing ints, and has O(n) hash lookups. I'd argue for the simpler code that is more compact, takes more advantage of the other methods, and may or may not perform better, but don't have a strong opinion.