[Tutor] Re: Readlines

Derrick 'dman' Hudson dman@dman13.dyndns.org
Thu Jun 26 16:00:03 2003


--cvVnyQ+4j833TQvp
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Sat, Jun 21, 2003 at 05:19:56PM -0230, Adam Vardy wrote:
|=20
| Now I'm trying Read(). I have a couple observations, and wonder what
| you folks think. Take the code below. I notice that Read() is
| apparently incredibly slow! Text appears on screen, cursor slowly
| gliding across. Which surprises as it is only reading a byte at a
| time. On a Gigahertz machine.

CPU clock speed really doesn't matter when it comes to disk I/O.
Perhaps your disk is really slow?  A lot of the inexpensive Pentium 4
machines on the market achieve lost system cost by really skimping on
the disk.  That really defeats the purpose of having the expensive CPU
because it will sit idle most of the time waiting for the disk to feed
it data.  However, marketing tends to focus on a single number rather
than the whole system ....

If you really want to determine why a given piece of code is slow, use
a profiler.  Except in trivial cases a programmer's guess is often
wrong.

-D

--=20
Yes, Java is so bulletproofed that to a C programmer it feels like being in=
 a
straightjacket, but it's a really comfy and warm straightjacket, and the wo=
rld
would be a safer place if everyone was straightjacketed most of the time.
                                                      -- Mark 'Kamikaze' Hu=
ghes
=20
http://dman13.dyndns.org/~dman/

--cvVnyQ+4j833TQvp
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iEYEARECAAYFAj77UKMACgkQiB6vp1xAVUAyngCdGdi0KXyqpHZySTDTjzskAHBc
MYsAnjV/QS6a9DYHvvuxToLO8FyyBrNv
=hxSI
-----END PGP SIGNATURE-----

--cvVnyQ+4j833TQvp--