Normal quotes
This commit is contained in:
parent
5e10794a24
commit
18011c595a
352 changed files with 6040 additions and 6040 deletions
32
01-06.md
32
01-06.md
|
|
@ -34,7 +34,7 @@
|
|||
_ChecksumChunkprocnear
|
||||
push bp
|
||||
mov bp,sp
|
||||
push si ;save C’s register variable
|
||||
push si ;save C's register variable
|
||||
;
|
||||
cld ;make LODSB increment SI
|
||||
mov si,[bp+Buffer] ;point to buffer
|
||||
|
|
@ -48,7 +48,7 @@
|
|||
loop ChecksumLoop ;continue for all bytes in block
|
||||
mov [bx],dx ;save the new checksum
|
||||
;
|
||||
pop si ;restore C’s register variable
|
||||
pop si ;restore C's register variable
|
||||
pop bp
|
||||
ret
|
||||
_ChecksumChunkendp
|
||||
|
|
@ -58,7 +58,7 @@ Note that in Table 1.1, optimization makes little difference except in
|
|||
the case of Listing 1.5, where the design has been refined considerably.
|
||||
Execution time in the other cases is dominated by time spent in DOS
|
||||
and/or the C library, so optimization of the code you write is pretty
|
||||
much irrelevant. What’s more, while the approximately two-times
|
||||
much irrelevant. What's more, while the approximately two-times
|
||||
improvement we got by optimizing is not to be sneezed at, it pales
|
||||
against the up-to-50-times improvement we got by redesigning.
|
||||
|
||||
|
|
@ -74,41 +74,41 @@ tends to be considerably faster relative to C than it is in this very
|
|||
specific case.
|
||||
|
||||
------------------- -----------------------------------------------------------------------------------------------------------
|
||||
 *Don’t get hung up on optimizing compilers or assembly language—the best optimizer is between your ears.*
|
||||
 *Don't get hung up on optimizing compilers or assembly language—the best optimizer is between your ears.*
|
||||
------------------- -----------------------------------------------------------------------------------------------------------
|
||||
|
||||
All this is basically a way of saying: Know where you’re going, know the
|
||||
All this is basically a way of saying: Know where you're going, know the
|
||||
territory, and know when it matters.
|
||||
|
||||
### Where We’ve Been, What We’ve Seen {#Heading13}
|
||||
### Where We've Been, What We've Seen {#Heading13}
|
||||
|
||||
What have we learned? Don’t let other people’s code—even DOS—do the work
|
||||
What have we learned? Don't let other people's code—even DOS—do the work
|
||||
for you when speed matters, at least not without knowing what that code
|
||||
does and how well it performs.
|
||||
|
||||
Optimization only matters after you’ve done your part on the program
|
||||
Optimization only matters after you've done your part on the program
|
||||
design end. Consider the ratios on the vertical axis of Table 1.1, which
|
||||
show that optimization is almost totally wasted in the checksumming
|
||||
application without an efficient design. Optimization is no panacea.
|
||||
Table 1.1 shows a two-times improvement from optimization—and a
|
||||
50-times-plus improvement from redesign. The longstanding debate about
|
||||
which C compiler optimizes code best doesn’t matter quite so much in
|
||||
which C compiler optimizes code best doesn't matter quite so much in
|
||||
light of Table 1.1, does it? Your organic optimizer matters much more
|
||||
than your compiler’s optimizer, and there’s always assembly for those
|
||||
than your compiler's optimizer, and there's always assembly for those
|
||||
usually small sections of code where performance really matters.
|
||||
|
||||
#### Where We’re Going {#Heading14}
|
||||
#### Where We're Going {#Heading14}
|
||||
|
||||
This chapter has presented a quick step-by-step overview of the design
|
||||
process. I’m not claiming that this is the only way to create
|
||||
high-performance code; it’s just an approach that works for me. Create
|
||||
process. I'm not claiming that this is the only way to create
|
||||
high-performance code; it's just an approach that works for me. Create
|
||||
code however you want, but never forget that design matters more than
|
||||
detailed optimization. Never stop looking for inventive ways to boost
|
||||
performance—and never waste time speeding up code that doesn’t need to
|
||||
performance—and never waste time speeding up code that doesn't need to
|
||||
be sped up.
|
||||
|
||||
I’m going to focus on specific ways to create high-performance code from
|
||||
now on. In Chapter 5, we’ll continue to look at restartable blocks and
|
||||
I'm going to focus on specific ways to create high-performance code from
|
||||
now on. In Chapter 5, we'll continue to look at restartable blocks and
|
||||
internal buffering, in the form of a program that searches files for
|
||||
text strings.
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue