Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
buffer sizes
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  2 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
bob  
View profile  
 More options Oct 9 2012, 10:50 am
Newsgroups: comp.programming
From: bob <b...@coolfone.comze.com>
Date: Tue, 9 Oct 2012 07:50:00 -0700 (PDT)
Subject: buffer sizes
I noticed that many buffer sizes tend to be powers of two.

Does this really matter that much?

Is a buffer that is 16384 bytes really any better than one that is 16000 bytes?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ant  
View profile  
 More options Oct 9 2012, 12:40 pm
Newsgroups: comp.programming
From: "Ant" <n...@home.today>
Date: Tue, 9 Oct 2012 17:39:12 +0100
Local: Tues, Oct 9 2012 12:39 pm
Subject: Re: buffer sizes

"bob" wrote:
> I noticed that many buffer sizes tend to be powers of two.
> Does this really matter that much?

Obviously it depends on the application, operating system and level
(language, API) at which you are programming. If an algorithm requires
256 bytes of storage then that's what you need. Operating systems tend
to map memory page sizes as powers of 2 (e.g. 4096 bytes) so if you're
working at a low level or within the kernel it may be that multiples
of the page size only are allowed in allocation routines. At a higher
level it won't matter as the memory management will be done for you.

> Is a buffer that is 16384 bytes really any better than one that is 16000 bytes?

It could actually waste memory in a normal application. If you only
need 16000 bytes then that's what you should allocate. If you try to
second-guess what the OS might really allocate internally, given the
page size, you are likely to use more than 16384 (if that's what you
specify) because another page gets allocated for overhead (headers,
etc.) added by the heap allocation routines you're using.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »