Skip to content

mmap input files rather than reading #109

@evmar

Description

@evmar

[Consolidating some comments from #107 and #108]

Currently we read input files into a local buffer. I had thought this was better than mmap because:

  1. we need a trailing nul bye on the file for parser reasons
  2. performance -- I can't remember where I had read it, but I recall the argument that mmap can be costlier than reading when it's a large file you're reading sequentially, due to some kernel overhead related to setting up all the memory mapping data structures(?)

However, it turns out that you can just mmap a private page at the end of the file to write the nul, and @Colecf says "Judging based on n2's tracing output, just reading the file into memory takes over twice as long as the android fork's entire ninja invocation".

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions