top | item 46244332

(no title)

majkinetor | 2 months ago

But then, even numbers will have the worst possible performance.

discuss

order

IncreasePosts|2 months ago

Good 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.

hybridtupel|2 months ago

Why not run both and use the result retrieved the fastest.

rdiddly|2 months ago

Yeeessss! Microservices!

blauditore|2 months ago

That sounds kinda stupid, it would completely destroy the original space savings. Unless the sharding makes it fit within compiler limits.

bobbylarrybobby|2 months ago

You 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.