btrask / stronglink

A searchable, syncable, content-addressable notetaking system
Other
1.04k stars 45 forks source link

Use sendfile(2) where supported #70

Open btrask opened 8 years ago

btrask commented 8 years ago

Would cut down copying and syscalls compared to the current system. The main bottleneck is HTTPConnectionWriteChunkFile, which is called once per result by the blog interface. For the best case (files under 8K) it looks like this:

  1. switch to thread pool
  2. open
  3. read (returns <8K)
  4. read (returns 0)
  5. close
  6. return from thread pool
  7. writev

I guess sendfile would only eliminate the writev?

Maybe mmap caching is a better approach after all...