Re: execution time becomes unpredictable?!
- From: CBFalconer <cbfalconer@xxxxxxxxx>
- Date: Thu, 31 Mar 2005 23:43:39 GMT
websnarf@xxxxxxxxx wrote:
>
.... snip ...
>
> Basically the C language standard does not mandate anything about
> performance and real implementations of memory heaps *really do*
> execute in unpredictable amounts of time. That said, there certainly
> do exist O(1) implementations of malloc/free (and realloc, if we ignore
> the memcpy overhead.) So malloc() is only slow on *some* systems --
> but it may be hard to know which such systems. As far as I know, gcc,
> because its open source and "Lea" malloc implementation is reasonably
> documented, we know that its memory allocation scheme is fairly
> reasonable. OTOH, I've measured MSVC's memory allocation speed, and
> its *MUCH* faster than gcc, but since its closed source, I can't sit
> here and tell you that its even O(1) in all cases.
Do try to be reasonably accurate. malloc is a part of the library,
so it has nothing to do with either gcc or MSVC, but everything to
do with the runtime library. Both sources (many in the case of
gcc) are available, but the MSVC stuff cannot be published without
permission. gcc operates on many systems with different
libraries. MSVC operates on an x86 under Windoze only. Depending
on where malloc gets the memory to hand out, the execution time can
be perfectly predictable, or at least have an upper bound put to
it. The time binds appear during free.
In practice you can often play implementor and link in a new malloc
package before linking the runtime library. There are no
guarantees once you do this.
--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
.
- References:
- execution time becomes unpredictable?!
- From: vashwath
- Re: execution time becomes unpredictable?!
- From: websnarf
- execution time becomes unpredictable?!
- Prev by Date: Re: type of array index?
- Next by Date: Re: need help..
- Previous by thread: Re: execution time becomes unpredictable?!
- Next by thread: Re: execution time becomes unpredictable?!
- Index(es):
Relevant Pages
|