3 ms·
But then, even numbers will have the worst possible performance.
by majkinetor 10mo ago
But then, even numbers will have the worst possible performance.
- IncreasePosts 10mo agoGood point. Have two programs - one checking every even number and returning odd of not even. And then have a program checking every odd number and returning even if not. Then, a simple program to dispatch to either program randomly, so you end up in the long term with good performance for each.
- rdiddly 10mo agoYeeessss! Microservices!
- chihuahua 10mo agoYour mention of Microservices opened up my mind to additional possibilities. How about we create a microservice for each integer, then deploy 4 billion of them. Send a request to all of them simultaneously. Only one of them will respond with the answer. We still need to decide how to deploy those microservices - one per machine, or multiple per machine?
- colejohnson66 10mo agoCould try 1 per IPv4 address? There’s just barely enough!
- hybridtupel 10mo agoWhy not run both and use the result retrieved the fastest.
- blauditore 10mo agoThat sounds kinda stupid, it would completely destroy the original space savings. Unless the sharding makes it fit within compiler limits.
- bobbylarrybobby 10mo agoYou brought up an important opportunity for optimization. If you know the distribution of your data, it may make more sense to implement it in terms of the odd numbers and leave even numbers as the fallback. It's important to profile with a realistic distribution of data to make sure you're targeting the correct parity of numbers.
- deleted 10mo ago[deleted]