Re: No need to optimize in assembly anymore
From: Ivan Korotkov (koroNOSPAMtkov2_at_ztelDOT.ru)
Date: 05/23/04
- Next message: Profetas: "Re: Project Idea."
- Previous message: Bill Marcum: "Re: A question regarding illegal Opcodes."
- In reply to: Bryan Parkoff: "Re: No need to optimize in assembly anymore"
- Next in thread: Matt Taylor: "Re: No need to optimize in assembly anymore"
- Reply: Matt Taylor: "Re: No need to optimize in assembly anymore"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sun, 23 May 2004 18:04:05 +0000 (UTC)
> Okay, do you claim that variables and functions inside classes are
> better than container classes and STL? You would want to avoid malloc or
> new function if it is less than 1MB.
He didn't tell this exact value.
> It is not really necessary to use
> malloc or new functions if memory is not very big.
> What is the minimum MB that malloc or new function should be used? I
> suspect 10MB.?????
What's the minimum number of hairs to form a beard? I would stop at few
kilobytes (of memory, not of hairs :)). Allocating more than 4KB on stack
cannot be done by just substracting from esp (on Windows at least, don't
know how *nix organizes stack). Otherwise, stack pointer will bypass the
guardian page and fall into reserved memory space. Compiler calls a special
function (_chkstk, IIRC) which allocates memory on stack page-by-page. This
will cause as many page faults and transitions as many pages you allocate.
Thus, the efficiency of stack allocations is limited not by the memory waste
but by the time that PF handler requires to handle so many page faults.
Let's imagine that you allocate 10MB of memory (it is 10 times more than the
default stack reserve, but you have set it to 15MB). That will cause 2560
page faults. P4 @ 2.4GHz needs about 0.9ms to call the interrupt handler so
many times. And the handler itself requires some time. So it will take about
a few milliseconds. I think it's *much* slower then calling malloc.
> Is it true that malloc or new function is never used if segments are
> used instead of flat model under 640KB?
Who - told - you - that?
> It sounds like malloc or new
> function uses to allocate virtual memory,
Under Windows.
> but below 640KB does not.
Does. Under DOS.
Ivan
- Next message: Profetas: "Re: Project Idea."
- Previous message: Bill Marcum: "Re: A question regarding illegal Opcodes."
- In reply to: Bryan Parkoff: "Re: No need to optimize in assembly anymore"
- Next in thread: Matt Taylor: "Re: No need to optimize in assembly anymore"
- Reply: Matt Taylor: "Re: No need to optimize in assembly anymore"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|