Change bold code snippets to inline code blocks
This commit is contained in:
parent
f658bfbb40
commit
3c76d884ef
185 changed files with 1772 additions and 1772 deletions
10
01-03.md
10
01-03.md
|
|
@ -143,7 +143,7 @@ that, we have to understand what's wrong with the current design.
|
|||
#### Know the Territory {#Heading9}
|
||||
|
||||
Just why is Listing 1.1 so slow? In a word: overhead. The C library
|
||||
implements the **read()** function by calling DOS to read the desired
|
||||
implements the `read()` function by calling DOS to read the desired
|
||||
number of bytes. (I figured this out by watching the code execute with a
|
||||
debugger, but you can buy library source code from both Microsoft and
|
||||
Borland.) That means that Listing 1.1 (and Listing 1.3 as well) executes
|
||||
|
|
@ -158,7 +158,7 @@ if the desired byte has already been read, read it from the disk if not,
|
|||
store the byte in the specified location, and return. All of that takes
|
||||
a *long* time—far, far longer than the rest of the main loop in Listing
|
||||
1.1. In short, Listing 1.1 spends virtually all of its time executing
|
||||
**read(),** and most of that time is spent somewhere down in DOS.
|
||||
`read()`, and most of that time is spent somewhere down in DOS.
|
||||
|
||||
You can verify this for yourself by watching the code with a debugger or
|
||||
using a code profiler, but take my word for it: There's a great deal of
|
||||
|
|
@ -174,13 +174,13 @@ bytes internally, doling them out to the application as needed by
|
|||
reading them from memory rather than calling DOS. Let's try using stream
|
||||
I/O and see what happens.
|
||||
|
||||
Listing 1.4 is similar to Listing 1.1, but uses **fopen()** and
|
||||
**getc()** (rather than **open()** and **read()**) to access the file
|
||||
Listing 1.4 is similar to Listing 1.1, but uses `fopen()` and
|
||||
`getc()` (rather than `open()` and `read()`) to access the file
|
||||
being checksummed. The results confirm our theories splendidly, and
|
||||
validate our new design. As shown in Table 1.1, Listing 1.4 runs more
|
||||
than an order of magnitude faster than even the assembly version of
|
||||
Listing 1.1, *even though Listing 1.1 and Listing 1.4 look almost the
|
||||
same*. To the casual observer, **read()** and **getc()** would seem
|
||||
same*. To the casual observer, `read()` and `getc()` would seem
|
||||
slightly different but pretty much interchangeable, and yet in this
|
||||
application the performance difference between the two is about the same
|
||||
as that between a 4.77 MHz PC and a 16 MHz 386.
|
||||
Loading…
Reference in a new issue