frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

Open in hackernews

For algorithms, a little memory outweighs a lot of time

https://www.quantamagazine.org/for-algorithms-a-little-memory-outweighs-a-lot-of-time-20250521/
211•makira•8h ago

Comments

cperciva•7h ago
Minus the fuzz: A multitape Turing machine running in time t can be simulated using O(sqrt(t log t)) space (and typically more than t time).

https://arxiv.org/abs/2502.17779

LPisGood•7h ago
I think it is very intuitive that more space beats the pants off of more time.

In time O(n) you can use O(n) cells on a tape, but there are O(2^n) possible configurations of symbols on a tape of length n (for an alphabet with 2 symbols), so you can do so much more with n space than with n time.

thatguysaguy•7h ago
Intuitive yes, but since P != PSPACE is still unproven it's clearly hard to demonstrate.
dragontamer•7h ago
The article is about a new proof wherein P == PSPACE.

Something we all intuitively expected but someone finally figured out an obscure way to prove it.

--------

This is a really roundabout article that takes a meandering path to a total bombshell in the field of complexity theory. Sorry for spoiling but uhhh, you'd expect an article about P == PSPACE would get to the point faster....

LPisGood•6h ago
This article is not about a proof that P = PSPACE. That would be way bigger news since it also directly implies P = NP.
LPisGood•6h ago
I think that since many people find it intuitive that P != NP, and PSPACE sits way on top of polynomial hierarchy that it is intuitive even if it’s unproven.
porphyra•5h ago
There's not even a proof that P != EXPTIME haha

EDIT: I am a dumbass and misremembered.

doc_manhat•5h ago
I think there is right? It's been a long time but I seem to remember it following from the time hierarchy theorem
LPisGood•4h ago
I thought there was some simple proof of this, but all I can think of is time hierarchy theorem.
qbane•7h ago
But you also spend time on updating cells, so it is not that intuitive.
LPisGood•7h ago
I’m not sure what you mean here. If you’re in the realm of “more space” than you’re not thinking of the time it takes.

More precisely, I think it is intuitive that the class of problems that can be solved in any time given O(n) space is far larger than the class of problems that can be solved in any space given O(n) time.

Almondsetat•6h ago
If your program runs in O(n) time, it cannot use more than O(n) memory (upper bound on memory usage.

If your program uses O(n) memory, it must run at least in O(n) time (lower bound on time).

delusional•6h ago
This is obviously demonstrably true. A Turing running in O(n) time must halt. The one in O(n) space is free not to.
thaumasiotes•5h ago
Almondsetat's proof seems more obvious. Given O(n) time, you can only use O(n) space, so you're comparing "O(n) space, any amount of time" with "O(n) space, O(n) time", and it turns out you get more resources the first way.
hn_acc1•6h ago
My intuition: the value of a cell can represent the result of multiple (many) time units used to compute something. If you cannot store enough intermediate results, you may end up needing to recalculate the same / similar results over and over - at least in some algorithms. So one cell can represent the results of hundreds of time units, and being able to store / load that one value to re-use it later can then replace those same hundreds of time units. In effect, space can be used for "time compression" (like a compressed file) when the time is used to compute similar values multiple times.

If intermediate results are entirely uncorrelated, with no overlap in the work at all, that would not hold - space will not help you. Edit: This kind of problem is very rare. Think of a cache with 0 percent hit rate - almost never happens.

And you can't really do it the other way around (at least not in current computing terms / concepts): you cannot use a single unit of time as a standin / proxy for hundreds of cells, since we don't quite have infinitely-broad SIMD architectures.

slt2021•6h ago
I think this theorem applies well for modern LLMs: large language model with pre-computed weights can be used to compute very complex algorithms that approximate human knowledge, that otherwise were impossible or would have required many orders more compute to calculate
frollogaston•5h ago
Also, the O(1) random memory access assumption makes it easy to take memory for granted. Really it's something like O(n^(1/3)) when you're scaling the computer to the size of the problem, and you can see this in practice in datacenters.

I forget the name of the O(1) access model. Not UMA, something else.

cperciva•4h ago
O(n^(1/2)) really, since data centers are 2 dimensional, not 3 dimensional.

(Quite aside from the practical "we build on the surface of the earth" consideration, heat dissipation considerations limit you to a 2 dimensional circuit in 3-space.)

frollogaston•4h ago
If you have rows of racks of machines, isn't that 3 dimensions? A machine can be on top of, behind, or next to another that it's directly connected to. And the components inside have their own non-uniform memory access.

Or if you're saying heat dissipation scales with surface area and is 2D, I don't know. Would think that water cooling makes it more about volume, but I'm not an expert on that.

jvanderbot•3h ago
Spatial position has nothing (ok only a little) to do with topology of connections.
manwe150•1h ago
That example would be two dimensions still in the limit computation, since you can keep building outwards (add buildings) but not scale upwards (add floors)
mpoteat•3h ago
More fundamentally O(n^(1/2)) due to the holographic principle which states that the maximal amount of information encodable in a given region of space scales wrt its surface area, rather than its volume.

(Even more aside to your practical heat dissipation constraint)

LegionMammal978•4h ago
On the other hand, actual computers can work in parallel when you scale the hardware, something that the TM formulation doesn't cover. It can be interesting which algorithms work well with lots of computing power subject to data locality. (Brains being the classic example of this.)
LPisGood•3h ago
Multitape TMs are pretty well studied
undefuser•38m ago
I think it really depends on the task at hand, and not that intuitive. At some point accessing the memory might be slower than repeating the computation, especially when the storage is slow.
whatever1•6h ago
Lookup tables with precalculated things for the win!

In fact I don’t think we would need processors anymore if we were centrally storing all of the operations ever done in our processors.

Now fast retrieval is another problem for another thread.

chowells•5h ago
Oh, that's not a problem. Just cache the retrieval lookups too.
michaelhoney•4h ago
it's pointers all the way down
drob518•2h ago
Just add one more level of indirection, I always say.
EGreg•2h ago
But seriously… the solution is often to cache / shard to a halfway point — the LLM model weights for instance — and then store that to give you a nice approximation of the real problem space! That’s basically what many AI algorithms do, including MCTS and LLMs etc.
crmd•3h ago
Reminds me of when I started working on storage systems as a young man and once suggested pre-computing every 4KB block once and just using pointers to the correct block as data is written, until someone pointed out that the number of unique 4KB blocks (2^32768) far exceeds the number of atoms in the universe.
ww520•2h ago
The idea is not too far off. You could compute a hash on an existing data block. Store the hash and data block mapping. Now you can use the hash in anywhere that data block resides, i.e. any duplicate data blocks can use the same hash. That's how storage deduplication works in the nutshell.
valenterry•2h ago
Except that there are collisions...
datameta•2h ago
This might be completely naive but can a reversible time component be incorporated into distinguishing two hash calculations? Meaning when unpacked/extrapolated it is a unique signifier but when decomposed it folds back into the standard calculation - is this feasible?
makmanalp•2h ago
In some contexts, dictionary encoding (which is what you're suggesting, approximately) can actually work great. For example common values or null values (which is a common type of common value). It's just less efficient to try to do it with /every/ block. You have to make it "worth it", which is a factor of the frequency of occurrence of the value. Shorter values give you a worse compression ratio on one hand, but on the other hand it's often likelier that you'll find it in the data so it makes up for it, to a point.

There are other similar lightweight encoding schemes like RLE and delta and frame of reference encoding which all are good for different data distributions.

manwe150•1h ago
It seems like you weren’t really that far off from implementing it, you just need a 4 KB pointer to point to the right block. And in fact, that is what all storage systems do!
jodrellblank•1h ago
Reminds me of when I imagined brute-forcing every possible small picture as simply 256 shades of gray for each pixel x (640 x 480 = 307200 pixels) = 78 million possible pictures.

Actually I don't have any intuition for why that's wrong, except that if we catenate the rows into one long row then the picture can be considered as a number 307200 digits long in base 256, and then I see that it could represent 256^307200 possible different values. Which is a lot: https://www.wolframalpha.com/input?i=256%5E307200

p1necone•42m ago
78 million is how many pixels would be in 256 different pictures with 307200 pixels each. You're only counting each pixel once for each possible value, but you actually need to count each possible value on each pixel once per possible combinations of all of the other pixels.

The number of possible pictures is indeed 256^307200, which is an unfathomably larger number than 78 million. (256 possible values for the first pixel * 256 possible values for the second pixel * 256 possi...).

mncharity•3h ago
> if we were centrally storing all of the operations

Community-scale caching? That's basically what pre-compiled software distributions are. And one idea for addressing the programming language design balk "that would be a nice feature, but it's not known how to compile it efficiently, so you can't have it", is highly-parallel cloud compilation, paired with a community-scale compiler cache. You might not mind if something takes say a day to resolve, if the community only needs it run once per release.

20after4•12m ago
Community scale cache, sounds like a library (the bricks and mortar kind)
EGreg•2h ago
You’re not wrong

Using an LLM and caching eg FAQs can save a lot of token credits

AI is basically solving a search problem and the models are just approximations of the data - like linear regression or fourier transforms.

The training is basically your precalculation. The key is that it precalculates a model with billions of parameters, not overfitting with an exact random set of answers hehe

jsnider3•56m ago
> In fact I don’t think we would need processors anymore if we were centrally storing all of the operations ever done in our processors.

On my way to memoize your search history.

IvanK_net•4h ago
I am confused. If a single-tape turing machine receives a digit N in binary, and is supposed to write N ones on the tape, on the right side of the digit N, it performs N steps.

If you expect N ones at the output, how can this machine be simulated in the space smaller than N?

This machine must decrement the digit N at the beginning of the tape, and move to the end of the tape to write "1", so it runs in time O(N^2), not O(N)? (as it takes N "trips" to the end of the tape, and each "trip" takes 1, 2, 3 .. N steps)

Since turing machines can not jump to any place on a tape in constant time (like computers can), does it have any impact on real computers?

cperciva•4h ago
Multitape Turing machines are far more powerful (in terms of how fast they can run, not computability) than single-tape machines.

But to answer your question: "space" here refers to working space, excluding the input and output.

willmarquis•3h ago
This is just a reminder that memory isn’t just a constraint, it’s a resource.
michaelsbradley•1h ago
What resources are available (or not) and in what quantities are the most basic constraints for solving a problem/s with a computer.
felineflock•3h ago
Ryan Williams lecture (how he started): https://www.youtube.com/live/0DrFB2Cp7tg

And paper: https://people.csail.mit.edu/rrw/time-vs-space.pdf

Gemini Diffusion

https://simonwillison.net/2025/May/21/gemini-diffusion/
218•mdp2021•2h ago•36 comments

Getting a paper accepted

https://maxwellforbes.com/posts/how-to-get-a-paper-accepted/
30•stefanpie•2h ago•1 comments

For algorithms, a little memory outweighs a lot of time

https://www.quantamagazine.org/for-algorithms-a-little-memory-outweighs-a-lot-of-time-20250521/
211•makira•8h ago•47 comments

Show HN: Display any CSV file as a searchable, filterable, pretty HTML table

https://github.com/derekeder/csv-to-html-table
75•indigodaddy•3h ago•13 comments

Google releases Material 3 Expressive, a more emotional UI design system

https://m3.material.io/blog/building-with-m3-expressive
13•nativeforks•2d ago•7 comments

Devstral

https://mistral.ai/news/devstral
399•mfiguiere•13h ago•86 comments

ITXPlus: A ITX Sized Macintosh Plus Logicboard Reproduction

https://68kmla.org/bb/index.php?threads/itxplus-a-itx-sized-macintosh-plus-logicboard-reproduction.49715/
59•zdw•5h ago•12 comments

Tales from Mainframe Modernization

https://oppi.li/posts/tales_from_mainframe_modernization/
35•todsacerdoti•3h ago•8 comments

Gemini figured out my nephew’s name

https://blog.nawaz.org/posts/2025/May/gemini-figured-out-my-nephews-name/
49•BeetleB•3d ago•18 comments

CERN gears up to ship antimatter across Europe

https://arstechnica.com/science/2025/05/cern-gears-up-to-ship-antimatter-across-europe/
77•ben_w•2d ago•28 comments

Rocky Linux 10 Will Support RISC-V

https://rockylinux.org/news/rockylinux-support-for-riscv
95•fork-bomber•7h ago•32 comments

Collaborative Text Editing Without CRDTs or OT

https://mattweidner.com/2025/05/21/text-without-crdts.html
199•samwillis•10h ago•54 comments

OpenAI to buy AI startup from Jony Ive

https://www.bloomberg.com/news/articles/2025-05-21/openai-to-buy-apple-veteran-jony-ive-s-ai-device-startup-in-6-5-billion-deal
658•minimaxir•10h ago•896 comments

Show HN: Confidential computing for high-assurance RISC-V embedded systems

https://github.com/IBM/ACE-RISCV
76•mrnoone•7h ago•5 comments

Animated Factorization (2012)

http://www.datapointed.net/visualizations/math/factorization/animated-diagrams/
234•miniBill•13h ago•53 comments

The curious tale of Bhutan's playable record postage stamps (2015)

https://thevinylfactory.com/features/the-curious-tale-of-bhutans-playable-record-postage-stamps/
91•ohjeez•8h ago•6 comments

Possible new dwarf planet found in our solar system

https://www.minorplanetcenter.net/mpec/K25/K25K47.html
116•ddahlen•9h ago•74 comments

How AppHarvest’s indoor farming scheme imploded (2023)

https://www.lpm.org/investigate/2023-11-16/a-celebrated-startup-promised-kentuckians-green-jobs-it-gave-them-a-grueling-hell-on-earth
18•andrewrn•2h ago•4 comments

Sorcerer (YC S24) Is Hiring a Lead Hardware Design Engineer

https://jobs.ashbyhq.com/sorcerer/6beb70de-9956-49b7-8e28-f48ea39efac6
1•maxmclau•6h ago

The Machine Stops (1909)

https://standardebooks.org/ebooks/e-m-forster/short-fiction/text/the-machine-stops
59•xeonmc•6h ago•14 comments

LLM function calls don't scale; code orchestration is simpler, more effective

https://jngiam.bearblog.dev/mcp-large-data/
181•jngiam1•10h ago•70 comments

Show HN: ClipJS – Edit your videos from a PC or phone

https://clipjs.vercel.app/
96•mohyware•7h ago•41 comments

An upgraded dev experience in Google AI Studio

https://developers.googleblog.com/en/google-ai-studio-native-code-generation-agentic-tools-upgrade/
115•meetpateltech•9h ago•66 comments

Storefront Web Components

https://shopify.dev/docs/api/storefront-web-components
130•maltenuhn•10h ago•38 comments

Did Akira Nishitani Lie in the 1994 Capcom vs. Data East Lawsuit?

https://www.thrillingtalesofoldvideogames.com/blog/akira-nishitani-capcom-data-east-lawsuit
25•danso•2d ago•1 comments

ZEUS – A new two-petawatt laser facility at the University of Michigan

https://news.engin.umich.edu/2025/05/the-us-has-a-new-most-powerful-laser/
96•voxadam•12h ago•96 comments

I have tinnitus. I don't recommend it

https://blog.greg.technology/2025/05/20/tinnitus.html
85•gregsadetsky•4h ago•80 comments

Introducing the Llama Startup Program

https://ai.meta.com/blog/llama-startup-program/?_fb_noscript=1
160•mayalilpony10•11h ago•61 comments

Understanding the Go Scheduler

https://nghiant3223.github.io/2025/04/15/go-scheduler.html
114•gnabgib•3d ago•19 comments

London’s water pumps: Where strange history flows freely (2024)

https://londonist.com/london/features/london-s-water-pump
17•joebig•3d ago•0 comments