r/AskComputerScience • u/YounisMo • Jan 07 '26
Optimality in computing
So this question is gonna be mouthful but I have geniune curiousity I'm questioning every fundamental concept of computing we know and use everyday like cpu architecture, the use of binary and bytes, the use of ram and all the components that make a up a computer, a phone or whatever Are all these fundamentals optimal? If we could start over and erase all out history and don't care about backward compatibility at all How would an optimal computer look like? Would we use for example ternary instead of binary? Are we mathematically sure that all the fundamentals of computing are optimal or are we just using them because of market, history, compatibility constraints and if not what would be the mathematically and physically and economically optimal computer look like (theoretically of course)
View all comments
Show parent comment
1
u/not-just-yeti Jan 07 '26
You still have to define what range of applications you want to use. I'll use "file compression" as an example.
Consider the following "compression" algorithm: if the item being encoded is the collected works of Shakespeare [Arden Shakespeare editions], emit "1". Otherwise emit "0" followed the the item being encoded. You can say it's not optimal, but I'll point out that if all you're interested in is encoding that one edition of collected Shakespeare, it's quite good!
Moreover: Every lossless compression scheme can't compress its inputs, on average!! (It's a simple proof by pigeon-hole: for inputs of up to 1000 bits, out of all 21001 -1 such bit strings there have to be 21001 -1 unique "compressed" outputs. And so you can't have them all be less than 1000 bits, or even average less than 1000bits. So your average compression is at most 0%, and may be larger.)
But: we don't care how most "nonsense" bit strings get encoded; we tend to only care about (say) English text, or sound files of music [as opposed to total static]. And so we choose compression schemes that work great on those domains, even if they make most inputs larger (since most inputs are garbage, if you just count possible bit-strings).
So the point is: there isn't an optimal compression scheme until you define what inputs you want to consider. Back to /u/AlexTaradov's first sentence: "there is no abstract 'optimal'."
Alternate example: Huffman coding is sometimes called a provably optimal coding scheme. …But it's only optimal in certain pre-defined senses [minimizing over inputs with a certain pre-established distribution of letters], and in practice "optimal" Huffman is used as only one part of a larger scheme that also pays special attention to patterns that come up in human-created contexts.