Re: mmap()ing .bse file binary appendixes



On Fri, 30 Jul 2010, Stefan Westerfeld wrote:

  Hi!

Tim, I've been working on the SpectMorph file format in the last days, and
during performance optimization one important improvement is achieved by
mmap()ing the SpectMorph files. Its faster, I assume, because no syscalls need
to be made to parse the file, and reading big chunks of data (such as the
parameters of one SpectMorph Audio object) can be done using memcpy().

So I was wondering if it would be possible for beast to provide a mmap()ed
version of binary appendixes, in case SpectMorph models are included within
.bse files. Of course it would be possible, but not necessarily as efficient,
to fall back to normal read operations in that case.

If you think it should be done using mmap(), I volunteer to provide a merge
request for this.

Yes, .bse files should be mmap()ed when possible as an optimization.
This is why we have padding zeros at the start of the binary appendixes,
so the actual data is 4byte aligned.
We'll have to fallback to normal read()s though if:
- no mmap is available or doesn't succeed (e.g. if address space is used up);
- the binary appendix data isn't 4-byte aligned (e.g. due to manual file
  edits).


Any thoughts welcome.

  Cu... Stefan
--
Stefan Westerfeld, Hamburg/Germany, http://space.twc.de/~stefan



Yours sincerely,
Tim Janik

---
http://lanedo.com/~timj/


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]