[Citadel Development] Re: Citadel commit log: revision 8275

2010-02-06 Thread dothebart



Sa Feb 06 2010 12:39:18 EST von   IGnatius T Foobar @ Uncensored  Betreff: Re: Citadel commit log: revision 8275

Fair enough.  Is it portable? 


don't know whether it'll work in cygwin, but all unix like os'es should support it.
the manpage tells that some flags and giving the target pointer in isn't portable, which I didn't use.





[Citadel Development] Re: Citadel commit log: revision 8275

2010-02-06 Thread IGnatius T Foobar
Fair enough.  Is it portable? 
  


[Citadel Development] Re: Citadel commit log: revision 8275

2010-02-06 Thread dothebart


 

Sa Feb 06 2010 10:33:05 EST von   IGnatius T Foobar @ Uncensored  Betreff: Re: Citadel commit log: revision 8275


* use mmap to read the download file for output; this way we don't need to copy
it into memory first and can let the kernel do  >this job   Does mmap() read the whole file into memory at the kernel level?  Or does it merely provide userspace with the illusion that this has happened?  Obviously if there are big files out there we don't want to load the whole file image into main memory...  


the kernel will do mmap() automagicaly in malloc if the desired size outdoes a certain ammount of memory.
mmap gives you the illusion of what you got on that pointer being memory, but its pointing to the disk.
since we're doing a linear read on it here, its probably the OS to choose what to cache.
we got two uses here:
* the static pictures and files which probably where on disk for quiet a while
* the temporary written attachment
so... why "read" it into memory if it can be done in place?
And... If citadel forces the os to use 4k buffers, how's one to know that this is what the kernel wants to send? Just pointing it to a blob and doing the select/write loop is the best whats to be done to give the kernel as much control over it as possible, which means less context switches -> faster




[Citadel Development] Re: Citadel commit log: revision 8275

2010-02-06 Thread IGnatius T Foobar
 >* use mmap to read the download file for output; this way we don't need to 
 >copy
it into memory first and can let the kernel do  >this job  
   
  Does mmap() read the whole file into memory at the kernel level?  Or does it
merely provide userspace with the illusion that this has happened?  Obviously if
there are big files out there we don't want to load the whole file image into
main memory...