Date: Fri, 16 Jun 1995 15:47:42 +0400 (MSD) From: =?KOI8-R?Q?=E1=CE=C4=D2=C5=CA_=FE=C5=D2=CE=CF=D7?= aka "Andrey A. Chernov, Black Mage" <ache@astral.msk.su> To: hackers@FreeBSD.org, Peter Wemm <peter@haywire.DIALix.COM> Subject: Re: penalty of using off_t for arithmatic with gcc's long longs? Message-ID: <xQUzMulio3@astral.msk.su> In-Reply-To: <Pine.SV4.3.91.950616153207.24890B-100000@haywire.DIALix.COM>; from Peter Wemm at Fri, 16 Jun 1995 15:51:04 %2B0800 (WST) References: <Pine.SV4.3.91.950616153207.24890B-100000@haywire.DIALix.COM>
next in thread | previous in thread | raw e-mail | index | archive | help
In message
<Pine.SV4.3.91.950616153207.24890B-100000@haywire.DIALix.COM> Peter
Wemm writes:
>I was working on my backlog of patches for NN and I just came to ache's
>set that he mailed me (via nn-bugs) Quite Some Time Ago(TM). (I'm
>currently merging in the Tk X11 code)
>One of the things that he did was to substitute many off_t's to longs.
>Now that I think about it, I presume there's a performance penalty for using
>off_t in general arithmatic.. Is this enough to worry about?
>For example, the code that I inherited in nn uses off_t's quite
>extensively for all sorts of things, including (for example) offsets of
>article body text relative to the beginning of headers, and it's
>scattered throughout other data structures.
>I guess it's not too important to be able to read > 2GB news articles,
>but is it worth trading this for speed? How much is there to gain? What
Basic problem isn't performance but several others affected NN:
1) fseek argument: it is "long" per POSIX standard. You can't
read > 2GB in POSIX enviroment in any case with 4bytes longs
using fseek.
NN use fseek(..., (off_t)x, ...), which obviously
miss with "long long", really it becomes fseek(..., 0, garbadge)
when fseek used without prototype.
Really it not hits when prototype exists, but many
of my NN off_t->long casts caused by gcc warning about
mixing types.
2) printf %ld or %d format can't handle off_t correctly
(%qd is correct).
NN hits some times with it printing 0 here and breaks
followed argumens. It cause converting some structure
members from off_t to long in my patch.
>about the implicit casts with passing a smaller type to lseek()?
If you include <unistd.h>, you don't need to cast lseek() argument to off_t.
--
Andrey A. Chernov : And I rest so composedly, /Now, in my bed,
ache@astral.msk.su : That any beholder /Might fancy me dead -
FidoNet: 2:5020/230.3 : Might start at beholding me, /Thinking me dead.
RELCOM Team,FreeBSD Team : E.A.Poe From "For Annie" 1849
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?xQUzMulio3>
