Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Agree. I see a lot of comments here on Codewars with folk saying "use <xyz> it's faster" where one or more of the following are true:
To that last point I profiled this kumite just for a laugh, running this version and the previous over an array of 10 million random integers. Here's a typical case:
In most cases this new
&
logic was actually a touch slower, almost always within the variance between runs, but the more salient point is that both implementations are far faster than you'll likely ever need, and will both be dwarfed in runtime by any other significant process - an obvious example is the garbage collector.If you find yourself needing this kind of optimisation (you won't) then you're already using the wrong language.
sorry, but this is premature optimization (https://effectiviology.com/premature-optimization)
it's not as readable as the solution you had before and optimitations like this
should be justified not just by saying "it's faster" ... it's very likely
the classic number % 2 == 0 is not your problem if you have to do a performance optimization.