Now, normally you have to worry about increasing clockspeeds having diminishing returns, since memory latency remains constant despite a faster CPU clock. But anything that could run on the amount of RAM the 6502 could handle would fit in a modern processor's L1 cache, and the scheduler is perfectly able to hide L1 latency so I think ignoring this factor is fair in this case.
This all gets a bit complicated in modern days because of memory access costs and caches which try to alleviate the costs, but the idea is that modern CPUs are likely to be around 10 times as fast per-clock as 6502 and because of multiple cores and threads that value goes to something like 40-60. Add the huge increase in clock speed and you're a bit south from x100_000 in optimal case.
I would hope every programmer would write some core on a C64 to really learn how much RAM the 64 KB really is. You can actually waste some of it and in some cases it really is "enough so that I don't have to optimize". :) Real hard-core people would go with VIC-20 which as only 5120 bytes of RAM, or Atari 2600 with 128 bytes of RAM. One could imagine there's nothing you can do with them but oh boy how wrong one would be! Heck, a single tweet is 140 characters. And you can fit that in 128 bytes. You really can... :)
CLC ; 2
LDA&70 ADC&74 STA&70 ; 3 3 3 = 9
LDA&71 ADC&75 STA&71 ; 3 3 3 = 9
LDA&72 ADC&76 STA&72 ; 3 3 3 = 9
LDA&73 ADC&77 STA&73 ; 3 3 3 = 9
That's for a total of 38 cycles. So on the computer I started programming on, you could do ~52,000 32-bit adds per second.By comparison, for a modern Pentium, according to Intel's docs, a 32-bit add (again, on data you're using) takes 1 cycle, end to end.
ADD ESI,EDX
So on the laptop that's in front of me, which is a crap one, you could do 2,530,000,000 32-bit adds per second. A 48,000-fold performance increase. Maybe 96,000 times, if you have no dependency chain (ADD throughput is 2 per cycle).This ignores the fact my modern computer has 2 cores.
But, "ADD ESI,EDX" is adding two registers isn't it? So I think you need to include the loading/storing of those registers back to memory for a more fair comparison.
I haven't touched 6502 assembly in over 20 years. Brings back memories. :-)
CLC ; 2
ADC #b1 STA&70 ; 0 2 3 = 5
LDA #a2 ADC #b2 TAY ; 2 2 2 = 6
LDA #a3 ADC #b3 TAX ; 2 2 2 = 6
LDA #a4 ADC #b4 ; 2 2 = 4
; total 23 cyclesPerhaps the code is intended to be modified at runtime, but then you'd then still want one of the operands loaded from memory, I think (otherwise why not just precalculate the results?), and I've generally found the (fairly substantial) fixed expense not to be worth it anyway.
Anyway, overall I think you're being a bit unfair to the x86 with this comparison.
You're even playing nice against the 6502, you're using a simple add, now compare with SIMD instructions
Things felt faster in the 80's than they did now, even doing the same tasks.
Waiting a few seconds every time I hit save was fun. Didn't stop me from developing a ferocious ^S reflex. Fortunately, save is fast enough not to be noticeable these days, to the extent that it usually happens automatically now.
Watching a WYSIWYG font menu draw each individual entry was fun. We certainly don't get that pleasure now.
But yes, things certainly felt faster in the 80s.... /s
One order of magnitude: 10x
Two orders of magnitude: 100x
Three orders of magnitude: 1000x
[0] Of course, that's ignoring multiple cores, better microcode, caches, etc.