Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #4517

Re: size_t in a struct

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail
From Uncle Steve <stevet810@gmail.com>
Newsgroups comp.lang.c
Subject Re: size_t in a struct
Date Sun, 22 May 2011 14:18:02 -0400
Organization Friends of the Galactic Collective
Lines 25
Message-ID <4a6cf09b75bf326-61191@gmail.com> (permalink)
References <ir6bhi$fcu$1@speranza.aioe.org> <ir6d98$e50$1@dont-email.me> <ir6mjl$d08$1@speranza.aioe.org> <lntycpyp2p.fsf@nuthaus.mib.org> <ir8uj5$gq1$1@speranza.aioe.org> <lnhb8nzl47.fsf@nuthaus.mib.org> <877h9j6r29.fsf@temporary-address.org.uk> <irbgt8$9md$1@dont-email.me> <8762p2ljpl.fsf@blp.benpfaff.org>
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Transfer-Encoding 8bit
Injection-Info mx04.eternal-september.org; posting-host="job9yP/rmK/fxQbJrcqEcA"; logging-data="31120"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+nH0v4KtHd55snPwlJDmmZ"
User-Agent nn 6.7.3
Content-Length 786
Cancel-Lock sha1:cX+cXj7MoCINRSSwGZUN21gVR5Y=
Xref x330-a1.tempe.blueboxinc.net comp.lang.c:4517

Show key headers only | View raw


On Sun, May 22, 2011 at 10:37:58AM -0700, Ben Pfaff wrote:
> Shao Miller <sha0.miller@gmail.com> writes:
> 
> > On 5/22/2011 4:08 AM, Dr Nick wrote:
> > I guess a code generator could potentially accomplish something close
> > to this.  I'd be interested in an algorithm which figures out the most
> > size-efficient ordering of the members, if anyone has one (or some
> > ideas for one).
> 
> Just sort the members into descending order of size.

Another way is to put the structure member most likely to be accessed
first at the start of the struct.  Prefetching should have the rest of
the struct in-cache shortly after the first access.



Regards,

Uncle Steve

-- 
Should a professional politician be charged with molestation if he
kisses babies while attending political rallies?

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

size_t in a struct Edward Rutherford <edward.p.rutherford79@REMOVETHIS.gmail.com> - 2011-05-20 18:22 +0000
  Re: size_t in a struct Shao Miller <sha0.miller@gmail.com> - 2011-05-20 14:52 -0400
    Re: size_t in a struct Edward Rutherford <edward.p.rutherford79@REMOVETHIS.gmail.com> - 2011-05-20 21:31 +0000
      Re: size_t in a struct Ian Collins <ian-news@hotmail.com> - 2011-05-21 09:51 +1200
        Re: size_t in a struct Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2011-05-24 21:34 +0300
          Re: size_t in a struct Ian Collins <ian-news@hotmail.com> - 2011-05-25 07:54 +1200
      Re: size_t in a struct "[the China Blue] Drill Baby Drill" <chine.bleu@yahoo.com> - 2011-05-20 15:06 -0700
        Re: size_t in a struct Angel <angel+news@spamcop.net> - 2011-05-20 22:51 +0000
      Re: size_t in a struct Keith Thompson <kst-u@mib.org> - 2011-05-20 15:39 -0700
        Re: size_t in a struct Edward Rutherford <edward.p.rutherford79@REMOVETHIS.gmail.com> - 2011-05-21 18:00 +0000
          Re: size_t in a struct Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2011-05-21 14:12 -0600
          Re: size_t in a struct Keith Thompson <kst-u@mib.org> - 2011-05-21 16:31 -0700
            Re: size_t in a struct Dr Nick <3-nospam@temporary-address.org.uk> - 2011-05-22 10:08 +0100
              Re: size_t in a struct Shao Miller <sha0.miller@gmail.com> - 2011-05-22 13:24 -0500
                Re: size_t in a struct Ben Pfaff <blp@cs.stanford.edu> - 2011-05-22 10:37 -0700
                Re: size_t in a struct Uncle Steve <stevet810@gmail.com> - 2011-05-22 14:18 -0400
                Re: size_t in a struct Keith Thompson <kst-u@mib.org> - 2011-05-22 12:17 -0700
                Re: size_t in a struct David Thompson <dave.thompson2@verizon.net> - 2011-06-01 16:33 -0400
                Re: size_t in a struct Shao Miller <sha0.miller@gmail.com> - 2011-05-23 02:05 -0500
                Re: size_t in a struct Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-05-23 11:21 +0100
                Re: size_t in a struct Shao Miller <sha0.miller@gmail.com> - 2011-05-23 19:40 -0500
                Re: size_t in a struct Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-05-24 01:25 +0100
                Re: size_t in a struct Shao Miller <sha0.miller@gmail.com> - 2011-05-23 20:43 -0500
          Re: size_t in a struct gordonb.d6jvy@burditt.org (Gordon Burditt) - 2011-05-22 17:48 -0500
      Re: size_t in a struct Jorgen Grahn <grahn+nntp@snipabacken.se> - 2011-05-21 15:43 +0000
  Re: size_t in a struct Keith Thompson <kst-u@mib.org> - 2011-05-20 11:59 -0700
  Re: size_t in a struct Nobody <nobody@nowhere.com> - 2011-05-20 22:24 +0100

csiph-web