Ad
  • Custom User Avatar

    Actually [+] is faster for values in range [129, 255] and [-] is faster for values in range [1, 127].
    0 and 128 are indifferent. So you can prefer one over the other only if you have an idea of your values' distribution. In real cases, [-] seems better in most cases, as all ASCII characters are in range [0, 127].

  • Default User Avatar

    Yup. Did the same but replacing the "-" by a "+", as I had thought in this particular case, going "upwards" would be "slightly faster" (like "254 max length instead of 255")...
    ...But now I'm thinking of it, it isn't, as the first bit we start at is not yet incremented; so still 255 max length in both cases...
    ...I guess I should have stayed with "-" as this version looks "cleaner"/"more explicit" ^^
    OH re-wait; in fact, the "+" version might indeed be slightly "faster" after all: like 32386 increments instead of 32640 decrements...
    ...I guess... (Unless I'm wrong?.. I think I need some sleep)