Date: Tue, 22 Oct 2002 12:06:00 -0700 From: Brooks Davis <brooks@one-eyed-alien.net> To: Stephen Montgomery-Smith <stephen@math.missouri.edu> Cc: Brooks Davis <brooks@one-eyed-alien.net>, Terry Lambert <tlambert2@mindspring.com>, Danny Braniss <danny@cs.huji.ac.il>, Poul-Henning Kamp <phk@critter.freebsd.dk>, freebsd-hackers@FreeBSD.ORG Subject: Re: malloc Message-ID: <20021022120600.A26767@Odin.AC.HMC.Edu> In-Reply-To: <3DB59E72.2080305@math.missouri.edu>; from stephen@math.missouri.edu on Tue, Oct 22, 2002 at 01:52:34PM -0500 References: <E183u5Y-0003Yc-00@cse.cs.huji.ac.il> <3DB50A5A.F87EDA78@mindspring.com> <20021022110159.A1513@Odin.AC.HMC.Edu> <E183u5Y-0003Yc-00@cse.cs.huji.ac.il> <3DB59E72.2080305@math.missouri.edu>
next in thread | previous in thread | raw e-mail | index | archive | help
--+HP7ph2BbKc20aGI Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Oct 22, 2002 at 01:52:34PM -0500, Stephen Montgomery-Smith wrote: > Brooks Davis wrote: >=20 > > The user may also see a performance gain on Linux if they use a less > > stupid allocation scheme. I ran into some code once that read strings > > one character at a time via getc() and did a realloc for each read. > > Needless to say, performance was truly awful since a typical run > > required parsing over 600MB of text. I saw a better then 50% speedup = on > > Alpha Linux when I fixed that mess. >=20 > As an amateur programmer, I wrote a program something like this. But it= =20 > allocates memory 1000 bytes at a time in order to save some of this=20 > overhead. I would be interested in getting feedback about this little=20 > function I wrote as to whether it could be greatly improved. (It works= =20 > great for me, but probably I haven't really pushed it very hard.) If it performs well enough for your application, there's nothing wrong with it. If you want to speed it up, I'd suggest using the profiler (gprof) to see where you are spending the most time. What makes sense, depends on the layout of the file and how you want to process it. -- Brooks --=20 Any statement of the form "X is the one, true Y" is FALSE. PGP fingerprint 655D 519C 26A7 82E7 2529 9BF0 5D8E 8BE9 F238 1AD4 --+HP7ph2BbKc20aGI 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 iD8DBQE9taGXXY6L6fI4GtQRAjmZAJ94cbBtVhgAZueyn6mYXiQHE5l0igCeOxA5 v/tWJ55yd5Z0v8ieZdoslM0= =eQQN -----END PGP SIGNATURE----- --+HP7ph2BbKc20aGI-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20021022120600.A26767>