| Deutsch English Français Italiano |
|
<v4roic$1ad0g$1@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Malcolm McLean <malcolm.arthur.mclean@gmail.com>
Newsgroups: comp.lang.c
Subject: Re: realloc() - frequency, conditions, or experiences about
relocation?
Date: Tue, 18 Jun 2024 11:46:36 +0100
Organization: A noiseless patient Spider
Lines: 101
Message-ID: <v4roic$1ad0g$1@dont-email.me>
References: <v4ojs8$gvji$1@dont-email.me> <875xu8vsen.fsf@bsb.me.uk>
<v4ovqf$j5hq$1@dont-email.me> <87zfrjvqp6.fsf@bsb.me.uk>
<v4pb4v$lhgk$1@dont-email.me> <87tthrvdtg.fsf@bsb.me.uk>
<20240617181034.74fb4cca1f4a9a3ea032825e@g{oogle}mail.com>
<86r0cuk9qz.fsf@linuxsc.com> <v4rmv0$19t6u$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 18 Jun 2024 12:46:37 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="cba6eb24be5a0db449e57ccf4e727e7c";
logging-data="1389584"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+xig82jv+nLSfger+LqjX8rHju0/1maNQ="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:I0P4GNBviDuYPLQ7koFSqlYSQdg=
Content-Language: en-GB
In-Reply-To: <v4rmv0$19t6u$1@dont-email.me>
Bytes: 5836
On 18/06/2024 11:19, Malcolm McLean wrote:
> On 18/06/2024 08:09, Tim Rentsch wrote:
>> Anton Shepelev <anton.txt@g{oogle}mail.com> writes:
>>
>>> Ben Bacarisse to Malcolm McLean:
>>>
>>>> [next is a comment from Malcolm]
>>>>
>>>>> Your strategy for avoiding these extremes is exponential
>>>>> growth.
>>>>
>>>> It's odd to call it mine. It's very widely know and used.
>>>> "The one I mentioned" might be less confusing description.
>>>
>>> I think it is a modern English idiom, which I dislike as
>>> well. StackOverflow is full of questions starting like:
>>> "How do you do this?" and "How do I do that?" They are
>>> informal ways of the more literary "How does one do this?"
>>> or "What is the way to do that?"
>>
>> I have a different take here. First the "your" of "your
>> strategy" reads as a definite pronoun, meaning it refers
>> specifically to Ben and not to some unknown other party.
>> (And incidentally is subtly insulting because of that,
>> whether it was meant that way or not.)
>>
>> Second the use of "you" to mean an unspecified other person
>> is not idiom but standard usage. The word "you" is both a
>> definite pronoun and an indefinite pronoun, depending on
>> context. The word "they" also has this property. Consider
>> these two examples:
>>
>> The bank downtown was robbed. They haven't been caught
>> yet.
>>
>> They say the sheriff isn't going to run for re-election.
>>
>> In the first example "they" is a definite pronoun, referring
>> to the people who robbed the bank. In the second example,
>> "they" is an indefinite pronoun, referring to unspecified
>> people in general (perhaps but not necessarily everyone).
>> The word "you" is similar: it can mean specifically the
>> listener, or it can mean generically anyone in a broader
>> audience, even those who never hear or read the statement
>> with "you" in it.
>>
>> The word "one" used as a pronoun is more formal, and to me
>> at least often sounds stilted. In US English "one" is most
>> often an indefinite pronoun, either second person or third
>> person. But "one" can also be used as a first person
>> definite pronoun (referring to the speaker), which an online
>> reference tells me is chiefly British English. (I would
>> guess that this usage predominates in "the Queen's English"
>> dialect of English, but I have very little experience in
>> such things.)
>>
>> Finally I would normally read "I" as a first person definite
>> pronoun, and not an indefinite pronoun. So I don't have any
>> problem with someone saying "how should I ..." when asking
>> for advice. They aren't asking how someone else should ...
>> but how they should ..., and what advice I might give could
>> very well depend on who is doing the asking.
>
> Ben said
> > Restore snipped Ben upthread
> "In practice, the cost is usually
> moderate and can be very effectively managed by using an exponential
> allocation scheme: at every reallocation multiply the storage space by
> some factor greater than 1 (I often use 3/2, but doubling is often used
> as well)."
>
> So it's open and shut, and no two ways about it. Ben's strategy is
> exponential growth. And to be fair I use that strategy myself in
> functions like fslutp(). It's only not Ben's strategy if we mean to
> imply that Ben was the first person to use expoential growth, or the
> first to understand the mathematical implications, and of course that's
> not the case. It was all worked out by Euler long before any of us were
> born.
>
> The question is whether we can be a bit more rigorous than "we need
> exonential growth, let's double on each reallocation. Actually, that
> looks a bit greedy. Try 3/2". And we can do that. We can put it on a
> sounder statistical footing. Whether it actually worth it or not is a
> different matter.
>
Here are some real stats on file sizes, in case anone is interested.
Data set, / OS Log-normal median & mean, Arithmetic mean, 50% occupied by
(< mean)
whole data set, 9.0 KB, 730 KB, 1.5 MB < 5.4 KB
Mac OS 8.0 KB, 533 KB, 1.4 MB < 4.9 KB
Windows 11.5 KB, 1.0 MB, 1.7 MB < 8.3 KB
GNU/Linux 10.8 KB, 1.7MB, 2.2 MB < 4.8 KB
https://www.researchgate.net/publication/353066615_How_Big_Are_Peoples%27_Computer_Files_File_Size_Distributions_Among_User-managed_Collections
--
Check out my hobby project.
http://malcolmmclean.github.io/babyxrc