It has been said a gazillion times before that slow code is the result of short development time. However I think slow code has more to do with programmer's style more than his time constraints.
Here is an example of slow code:
lda #$00
sta $2115
lda #$11
sta $2116 ;; load v-ram address port with some random number
lda #$22
sta $2117
lda #$33 ;; set up the DMA registers with random shit
sta $4300
lda #$44
sta $4301
lda #$55
sta $4302
lda #$66
sta $4303
lda #$77
sta $4304
lda #$88
sta $4305
lda #$99
sta $4306
lda #$01
sta $420b
Now here is a faster version of the same code
rep #$20
ldx #$00
stx $2115
lda #$2211
sta $2116 ;; load v-ram address port with some random number
lda #$4433
sta $4300 ;; set up the DMA registers with random shit
lda #$6655
sta $4302
ldx #$77
stx $4304
lda #$9988
sta $4305
ldx #$01
stx $420b
Okay, which looks like it takes longer to write? The faster one? If developers were concerned about taking the least amount of time writing codes, why did a lot of them choose the first method? Probably because it was just their style and didn't pay attention to it.
Your probably thinking, "Oh that is just a little piece of code, that can't possibly cause slowdown by itself." Yes, your right, it is a little piece of code and it isn't contributing very much to slowdown.
The thing is, when you have millions and millions of little pieces of slow code, it causes slowdown, and you can't fix it by optimizing any single one of those million little pieces of slow code by itself. You'd have to fix all of them. That takes forever and you wouldn't have had that problem if you'd just programmed fast the first time around.
If anybody here ever runs into that problem, instead of waiting till the end to nitpick millions of lines of code, a better way is making a habbit of optimizing your code as your writing it. It's good to optimize code by auto-pilot, so you don't have to intentionally think about it.
Here is an example of slow code:
lda #$00
sta $2115
lda #$11
sta $2116 ;; load v-ram address port with some random number
lda #$22
sta $2117
lda #$33 ;; set up the DMA registers with random shit
sta $4300
lda #$44
sta $4301
lda #$55
sta $4302
lda #$66
sta $4303
lda #$77
sta $4304
lda #$88
sta $4305
lda #$99
sta $4306
lda #$01
sta $420b
Now here is a faster version of the same code
rep #$20
ldx #$00
stx $2115
lda #$2211
sta $2116 ;; load v-ram address port with some random number
lda #$4433
sta $4300 ;; set up the DMA registers with random shit
lda #$6655
sta $4302
ldx #$77
stx $4304
lda #$9988
sta $4305
ldx #$01
stx $420b
Okay, which looks like it takes longer to write? The faster one? If developers were concerned about taking the least amount of time writing codes, why did a lot of them choose the first method? Probably because it was just their style and didn't pay attention to it.
Your probably thinking, "Oh that is just a little piece of code, that can't possibly cause slowdown by itself." Yes, your right, it is a little piece of code and it isn't contributing very much to slowdown.
The thing is, when you have millions and millions of little pieces of slow code, it causes slowdown, and you can't fix it by optimizing any single one of those million little pieces of slow code by itself. You'd have to fix all of them. That takes forever and you wouldn't have had that problem if you'd just programmed fast the first time around.
If anybody here ever runs into that problem, instead of waiting till the end to nitpick millions of lines of code, a better way is making a habbit of optimizing your code as your writing it. It's good to optimize code by auto-pilot, so you don't have to intentionally think about it.