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


Groups > comp.os.linux.development.apps > #630

Re: memory use

Path csiph.com!eeepc.pasdenom.info!news.pasdenom.info!news.dougwise.org!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!weretis.net!feeder4.news.weretis.net!news.albasani.net!not-for-mail
From Bob Tennent <BobT@cs.queensu.ca>
Newsgroups comp.os.linux.development.apps
Subject Re: memory use
Date Wed, 2 Feb 2011 21:16:51 +0000 (UTC)
Organization albasani.net
Lines 45
Message-ID <slrnikjie3.bk0.BobT@linus.cs.queensu.ca> (permalink)
References <slrnikj71n.9i7.BobT@linus.cs.queensu.ca> <iicg34$lr8$1@news.eternal-september.org>
Reply-To rdtennent@gmail.com
X-Trace news.albasani.net PzMHKPyQwZxb+SKBipeK6iPk7Br1nI8ayAwtKzk8m7hTL+mlVkBXofChRHGcuMfdQrKEoasio0mZO2FaGby6Rg==
NNTP-Posting-Date Wed, 2 Feb 2011 21:16:51 +0000 (UTC)
Cancel-Lock sha1:5gg+NhC6KC2ZFTzi95l/Vy2vPd4=
User-Agent slrn/0.9.8.1pl1 (Linux)
Injection-Info news.albasani.net; logging-data="H1UfPHZ1plBLie2pMmuv7jq9oaTLljFry6VAAuQvL7/lFNkvyZjV850JnplskLdGNKk/n4MUv34knbieFB+JCQkC3OuyBrjjRSLjVNfPwP7nuP9JjNZS3y00BzAoHF0p"; mail-complaints-to="abuse@albasani.net"
Xref csiph.com comp.os.linux.development.apps:630

Show key headers only | View raw


On Wed, 2 Feb 2011 20:50:45 +0000 (UTC), James Waldby wrote:
 > On Wed, 02 Feb 2011 18:02:31 +0000, Bob Tennent wrote:
 >
 >> A C program called musixflx is used as the second pass of a three-pass
 >> TeX-based system called musixtex.  The program was the first C program
 >> written by a Fortran programmer.  It has definitions as follows:
 >> 
 >>   # define MAX_BARS    2048  /* max number of bars */
 >> 
 >>   int zbar[MAX_BARS], lr_repeat[MAX_BARS], raggedline[MAX_BARS],
 >>       l_repeat[MAX_BARS], barno[MAX_BARS], ...
 >> 
 >>   double hardbarlength[MAX_BARS], softbarlength[MAX_BARS],
 >>          width_leftrightrepeat[MAX_BARS], width_leftrepeat[MAX_BARS],
 >>          ...
 >> Typically the number of bars in a piece is much smaller than MAX_BARS.
 >> 
 >> Would it be best to
 >> 
 >>  + leave the code alone and let the virtual-memory functions of the
 >>    operating system manage the memory
 >
 > Trying to reduce the 26KB used by those arrays probably is not 
 > worthwhile.
 >
 >>  + use "extensible" arrays (i.e., use realloc to copy small arrays to
 >>    larger ones when necessary)
 >
 > If scores are running up against the 2048-bar limit, just double or
 > quadruple MAX_BARS.[1]  The simplicity of fixed-size allocation is a
 > positive feature.  However, if these arrays were fixed at megabyte 
 > sizes and performance problems were occurring, allocating and 
 > reallocating might be worth considering, to reduce cache line refilling.
 >  
 >> And would there be any benefit to using a single array of structures
 >> instead of many parallel arrays?
 >
 > It looks like the code should have used structs when 
 > it was written, but unless for some reason you want to rewrite the whole
 > program it probably would not make sense to change from using parallel 
 > arrays to using structs.  

Thanks.

Bob T.

Back to comp.os.linux.development.apps | Previous | NextPrevious in thread | Find similar


Thread

Re: memory use James Waldby <not@valid.invalid> - 2011-02-02 20:50 +0000
  Re: memory use Bob Tennent <BobT@cs.queensu.ca> - 2011-02-02 21:16 +0000

csiph-web