pressing green flag will trigger the benchmark which will run the xor on every pair of integers 1 to 500 the script ignores the fractional portion of nonintegers and treats negative inputs like 0
i saw another implementation of xor someplace on this website and i thought "oh waow this thing sure looks slow" so i made this and yeah i was right. anyways this one's alright. i came up with it myself the arcane magic just checks whether the current bit in each input is set and adds those results together and checks if the sum is 1. adding the results of logical operations and checking for =1 is equivalent to doing logical xor and it's pretty efficient. without checking i doubt there's a more efficient way to do logical xor since javascript type coercion is cheap relative to running additional blocks and, starting from boolean values, this solution only costs 2 blocks and a constant the log bit determines an upper bound for the number of iterations. the magic constant is 1/log(2). due to using a + instead of determining the maximum, it sometimes does an extra iteration. i decided the performance impact of this is smaller than trying to figure out the max value. scratch seems to recalculate the counter of the repeat block every time it runs even though the value will never change so it's faster to pull it into a variable. this upsets me