How much faster are register based architectures than stack architectures?

Posted by drozzy on Stack Overflow See other posts from Stack Overflow or by drozzy
Published on 2010-03-11T16:24:37Z Indexed on 2010/03/11 18:09 UTC
Read the original article Hit count: 184

Filed under:

Studying compilers course, I am left wondering why use registers at all. It is often the case that the caller or callee must save the register value and then restore it.

In a way they always end up using the stack anyway. Is creating additional complexity by using registers really worth it?

Excuse my ignorance.

Update: Please, I know that registers are faster than RAM and other types of cache. My main concern is that one has to "save" the value that is in the register and the "restore" it to. In both cases we are accessing some kind of cache. Would it not be better to use cache in the first place?

© Stack Overflow or respective owner

Related posts about compiler