News for hackers. Stuff that matters.
Re:The 6502 CPU's overflow flag explained at the silicon level by Breakthrough on Tuesday January 15, 2013 @09:30AM (#5060216)
Not to mention further performance advancements in processor design since then (pipelining, SIMD, etc...), further increasing throughput above the 1000x threshold. One should also consider the increases in word length, adding the ability to process more data in less time.
Re:The 6502 CPU's overflow flag explained at the silicon level by to3m on Tuesday January 15, 2013 @11:24AM (#5060969)
If you want to add 2 32-bit integers, on 6502 you'll need something like the following, assuming this is a 32-bit integer you're actively working with and are probably about to use again fairly soon:

    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.

Re:The 6502 CPU's overflow flag explained at the silicon level by js2 on Tuesday January 15, 2013 @11:35AM (#5061053)
And that's loading/storing to/from the zero page (the first 256 bytes of memory). Loading/storing from higher addresses requires 4 cycles.

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. :-)

Re:The 6502 CPU's overflow flag explained at the silicon level by to3m on Tuesday January 15, 2013 @12:13PM (#5061334)
This is working data, so you'd keep it in a register if possible. Sadly that just happens not to be possible on the 6502 :)
Re:The 6502 CPU's overflow flag explained at the silicon level by mmphosis on Tuesday January 15, 2013 @07:45PM (#5064270)
Two bytes can be kept in the X and Y registers. Immediate load and add instructions only use two cycles.

    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 cycles
Re:The 6502 CPU's overflow flag explained at the silicon level by to3m on Wednesday January 16, 2013 @07:51AM (#5066574)
If you're adding constants, you might as well load each byte of the result directly, when you need it. (I can't tell where the LSB is coming from in this code - perhaps it isn't a constant? - this example doesn't resemble any code I've ever had to write.)

Perhaps 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.

Re:The 6502 CPU's overflow flag explained at the silicon level by raverbashing on Tuesday January 15, 2013 @01:16PM (#5061759)
Yes, the comparison is relative, it may as well be 10000x better (in orders of magnitude)

You're even playing nice against the 6502, you're using a simple add, now compare with SIMD instructions

Re:The 6502 CPU's overflow flag explained at the silicon level by meaty on Tuesday January 15, 2013 @10:01AM (#5060386)
Yet it's a shame that we seem to piss that extra performance away instantly in software.

Things felt faster in the 80's than they did now, even doing the same tasks.

Re:The 6502 CPU's overflow flag explained at the silicon level by mikeash on Tuesday January 15, 2013 @10:49AM (#5060684)
I recall waiting a couple of minutes for my computer to just boot in the 80s. When I want to use my phone, it becomes usable in well under a second.

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

Re:The 6502 CPU's overflow flag explained at the silicon level by meaty on Tuesday January 15, 2013 @10:55AM (#5060718)
I don't know what you were using but I was booted and operational in under 3-4 seconds on everything I used in the 80s (BBC Master, Acorn A310)
Re:The 6502 CPU's overflow flag explained at the silicon level by mikeash on Tuesday January 15, 2013 @11:39AM (#5061079)
My Apple IIGS could be "operational" pretty fast if all you were after was a BASIC prompt with no disk access. If you wanted a BASIC prompt with disk access, that took some seconds. If you want to actually load useful software, it took quite a while.