Re: page sizes
- From: Phlip <phlip2005@xxxxxxxxx>
- Date: Sun, 13 Apr 2008 08:15:58 -0700 (PDT)
copx wrote:
Yes. This optimizes the variables and hardware registers used to manage
the pages. None of their bits are wasted. User-level code doesn't need
these optimizations, so they pick array sizes with different conveniences.
"Doesn't need" is your opinion.
Welcome to USENET.
I am trying to squeeze a few more nanoseconds out of a programming language
interpreter. The documentation of malloc() on one of the platforms I am
targetting explicitly gives the advice to allocate powers of 2 to improve
performance. However, that is only true if the allocated blocks are <=
pagesize. Larger blocks allocate fastest if they are multiples of the page
size.
My opinion is also to not use malloc(). Write a custom allocator that
manages a heap of fixed-sized blocks. These will be several orders of
magnitude more efficient than a generic malloc(). Then, if you also
use block sizes of powers of two, you can manage them with very small
variables. But these will be slow to manipulate (splitting and
shifting), so you only optimize your footprint if you can pack them
all together.
But that's just my opinion, and you might not find it in all the books
and such about optimizing with C-style languages...
- it might vary for any conceivable reason, including odd bus
architectures.
Not on Redhad Linux x86/32. The official documentation specifies the page
size as 4096.
Oh, another of my opinions that was right. Darn!
I guess one could easily hack the system to set another size,
but one can assume that 99,9% of all users won't do this.
Far from "easy"...
--
Phlip
.
- References:
- page sizes
- From: copx
- Re: page sizes
- From: Phlip
- Re: page sizes
- From: copx
- page sizes
- Prev by Date: Re: C++ more efficient than C?
- Next by Date: Re: MurmurHash 2.0 - Over 100% faster than SuperFastHash & Lookup3
- Previous by thread: Re: page sizes
- Next by thread: Re: page sizes
- Index(es):
Relevant Pages
|