BLUE
Profile banner
F
FrankieWilson
@frankiewilson.bsky.social
A s.e
2 followers4 following33 posts
Ffrankiewilson.bsky.social

Lols 😆 Same here as well 🤣

0
Ffrankiewilson.bsky.social

Fb bro

0
Ffrankiewilson.bsky.social

I see. Without that, the bit manipulation would have won

0
Ffrankiewilson.bsky.social

Try with larger input.. just trying out

1
Ffrankiewilson.bsky.social

That's right Over 100 ms.. c'mon

1
Ffrankiewilson.bsky.social

Well.. what can I say 🤷 👍

0
Ffrankiewilson.bsky.social

Nope, I didn't benchmark... I'm just saying based on the nature of their operations. Though they are almost the same , the bit manipulation tends to perform better under a higher magnitude of data input

1
Ffrankiewilson.bsky.social

def reversed(x: int) -> int: num = 0 for _ in range (512): num = (num << 1) | (x & 1) x >>= 1 return num though, it is longer but is faster than having to convert num to binary string and then reverse it becs it directly manipulates the individual bits. I may be wrong

1
Ffrankiewilson.bsky.social

There's absolutely a faster way of doing this using bit manipulation. I'll write a simple function to prove it, although I'm busy now but will definitely show u why I said bit manipulation is faster

3
Ffrankiewilson.bsky.social

I don't agree with you sir. Python built in l support for bit manipulation is way much faster than the string manipulation Especially working with large amount of data

1
Profile banner
F
FrankieWilson
@frankiewilson.bsky.social
A s.e
2 followers4 following33 posts