Comments (4)
I believe the Android build file text might be much larger(?)
Some numbers:
aosp-main$ du -h out/build-sdk_phone64_x86_64.ninja
935M out/build-sdk_phone64_x86_64.ninja
aosp-main$ du -h out/soong/build.sdk_phone64_x86_64.ninja
2.3G out/soong/build.sdk_phone64_x86_64.ninja
internal-main$ du -h out/build-sdk_phone64_x86_64.ninja
1.3G out/build-sdk_phone64_x86_64.ninja
internal-main$ du -h out/soong/build.sdk_phone64_x86_64.ninja
3.9G out/soong/build.sdk_phone64_x86_64.ninja
So yeah, it would be quite a bit of memory used just for line numbers...
from n2.
I was about to say that's a convincing argument for not keeping the files in memory, but I guess if we mmap'd the files the memory use of keeping them around is "free", in that the memory backing of the mmap could be paged out by the OS under memory pressure... I think(?)
(I had thought that we only used line numbers in error messages, which would mean we'd only ever need to reread a file once. But looking now we also use them in -d explain
mode to print which builds are out of date...)
Just to write it down, the full LLVM trick is: map each input file to an integer (e.g. put them in a Vec), and then pack that integer and the file offset together. So you only need to store a single integer per thing you want to annotate with a file location. This matters more for LLVM because I think they store the file location of every AST node (for compiler diagnostics etc.)
In n2's case we only store one of these per build statement. Currently it's a not especially efficient Rc+usize so 16 bytes per Build in memory. For a big Android build that's probably only still costing a few megabytes so probably not worth worrying about too much.
from n2.
Note to self, to find all the places we use line numbers, the trick is to comment out the impl std::fmt::Display for FileLoc
and see where the errors are.
from n2.
After #112, I tried disabling the line counting and wasn't able to observe a noticeable speedup.
from n2.
Related Issues (20)
- Does it need sh? HOT 2
- Variable expansion missing global reference
- Difference in behavior with ninja when not specifying a target
- Inconsistent handling of newline escapes HOT 2
- Variable references in build inputs don't take into account the build's bindings HOT 5
- Oversized WriteBuf panic HOT 3
- Validation mode HOT 3
- proper `console` pool support
- better control over subcommand output HOT 2
- `e2e::validations::build_starts_before_validation_finishes` fails every so often HOT 2
- Tag a release (candidate)? HOT 1
- Difficulties with git-lfs HOT 4
- Give priority to slow actions HOT 2
- Add multithreaded parsing HOT 5
- mmap input files rather than reading HOT 5
- dry-run mode
- mutable reference to mutable static detected bu rustc HOT 1
- Segmentfault when building fastfetch HOT 5
- Shell-escape $in, $in_newline, $out, and $out_newline
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from n2.