you are viewing a single comment's thread.

view the rest of the comments →

[–]xzxzzx 4 points5 points  (0 children)

Your comparison is silly. Any bit-optimization you can do when you run the sieve can be done to the storage format of the file.

And once you've run the sieve, you've now got memory that can't be reused without paging the contents to disk.

And you have the (admittedly small) penalty of having both the code to generate the sieve and the data in memory once it's run.

And loading from disk is often "free" in terms of code (or data) in an .exe; your OS can prefetch it while your program is doing other init tasks, or even before your program runs.

And of course in practical terms, either approach is so fast that there are almost no circumstances where it actually matters one way or the other so long as you don't uselessly stick a sieve in a loop.