CIFS vs. NFS and other filesystems (was Client for Samba Networks)

Michael B Allen mballen at
Tue Dec 18 13:43:02 GMT 2001

On Tue, 18 Dec 2001 11:30:10 -0800
jra at (Jeremy Allison) wrote:

> On Tue, Dec 18, 2001 at 02:24:15PM -0500, Michael Sweet wrote:
> > What *really* sucks is the 2x (or 4x) overhead you pay for with UCS-2
> > and UCS-4 - it impacts the amount of memory that applications need
> > (bloat bloat bloat), the amount of bandwidth used, all of the
> > standard functions people use, etc.  UTF-8 (and other variable-length
> > encodings) can support Unicode > 64k, too, which is a big reason
> > why the IETF is pushing UTF-8 instead of UCS-2 to support Unicode.

The size and number of strings in SMB messages is rather small compared
to the rest of what is happening inside an SMB server. Even if you used
UCS-4 you could counter the perfomance impact looking elsewhere like in
the transport layer by taking advantage of some kind to asynchronous IO,
fancy locking techniques, or caching, etc.

> I still maintain that it's easy to make mistakes programming with
> multi-length characters. I should know, I've made most of them :-).

Agreed. If I were doing this kind of work I would definately explore a
fixed width encoding at the API level and then funneled all strings into
two sets of encoding/decoding functions one for the platform encoding
and the other to/from UCS-2. If you're carfull about it, you can just
specify what the API level fixed width character encoding type is with
a typedef. If you choose UCS-2 then your one set of conversion functions
incurs no overhead. So you can do all of your string ops in UCS-4 or UCS-2
or ISO-8859-3 of cp1252 ...etc. You make it a compile time option. If
you use wchar (on my Linux machine wchar is 4 btyes) you are provided
with a good array of mbs functions already. I'm willing to bet using a
variable length encoding would end up being more costy performace wise
as well as in bugs.

Of course all of this encoding stuff is highly opinionated. I doubt you
can really tell for sure how somthing will perform until you just do it
and look at the numbers.


May The Source be with you.

More information about the samba-technical mailing list