🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #4553

Re: Faster FILE subroutines in standard C?

#4553
From: Kenneth Kafieh
Date: Thu, 04 Jan 1996 04:48
32 lines
1511 bytes

--
I had to resort to drastic mesures inorder to put this message here.
You are currently reading my signature file.
Does anybody know why the @#$! that every time 
I try to post on this board, the only thing
that gets posted is my @$%! sig file ?!?!
while we're here I might as well post my message:

I found that I was able to get 3-4 time faster performance by using good 
old ANSI C file accessing routines (like  fgets, fseek, ftell, ...etc.)
instead of C++ streams (like ifstream::getline, fstream::seekg, ...etc.)
I wrote the program originally in C++ (a simple little phonebook for my
own use) and it took about 9 seconds to scan a 100Kb file for a 3 byte
string!!!  Fed up, I rewrote it in C and voila! Now it takes 2 secs!
I'm using Borland C++ v2.0.

Does that sound right?  Maybe my code was inefficiently written?
I know C++ is generally slower than C but I didn't think that 
file stuff would be too.   What did I do wrong? Am I missing
something.  Maybe I'll post the code too, later. Has anyone
else noticed this too?

Come to think of it, the coding in
C was cleaner looking, too.  


And So Until Next Time...

                I'm Ken
 
Technical Details
Message-ID: <4cfm7c$dot@sunburst.ccs.yorku.ca>
Path: arc1-ca.pugleaf.net!afep.yorku.ca!ken

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!afep.yorku.ca!ken
From: ken@yorku.ca (Kenneth Kafieh)
Newsgroups: comp.std.c
Subject: Re: Faster FILE subroutines in standard C?
Date: 4 Jan 1996 04:48:44 GMT
Organization: York University
Message-ID: <4cfm7c$dot@sunburst.ccs.yorku.ca>
NNTP-Posting-Host: afep.yorku.ca
X-Newsreader: TIN [version 1.2 PL2]