This trades off some executable size for measurable lexer performance improvements. Note on the explicitly enabling 8bit scanner. This is needed due to the default behavior of flex (excerpt from the manual [1]): > Flex’s default behavior is to generate an 8-bit scanner unless you > use the ‘-Cf’ or ‘-CF’, in which case flex defaults to generating > 7-bit scanners unless your site was always configured to generate 8-bit > scanners. Some quantifyable metrics: Nixpkgs revision: a6e3f45acf4e817532a861ab0eda4ab5485fecc1 Parsing the largest file in nixpkgs: pkgs/development/haskell-modules/hackage-packages.nix. (Before this patch) ``` $ nix build github:nixos/nix/9fe3077d4#nix-expr $ du --apparent-size result/lib/libnixexpr.so 2518 result/lib/libnixexpr.so $ nix build github:nixos/nix/9fe3077d4#nix-cli $ taskset -c 2,3 hyperfine "GC_INITIAL_HEAP_SIZE=16g \ result/bin/nix-instantiate --parse \ ../nixpkgs/pkgs/development/haskell-modules/hackage-packages.nix > /dev/null" Time (mean ± σ): 375.5 ms ± 6.3 ms [User: 316.9 ms, System: 56.7 ms] Range (min … max): 368.5 ms … 388.3 ms 10 runs ``` (After the patch) ``` $ nix build .#nix-expr $ du --apparent-size result/lib/libnixexpr.so 2685 result/lib/libnixexpr.so $ nix build .#nix-cli $ taskset -c 2,3 hyperfine "GC_INITIAL_HEAP_SIZE=16g \ result/bin/nix-instantiate --parse \ ../nixpkgs/pkgs/development/haskell-modules/hackage-packages.nix > /dev/null" Time (mean ± σ): 326.8 ms ± 4.9 ms [User: 269.5 ms, System: 55.3 ms] Range (min … max): 319.7 ms … 335.5 ms 10 runs ``` Overall, the change is roughly: - 2518KiB -> 2685KiB ~ 150 KiB of machine code - 375ms -> 325ms ~ 50ms The perf uplift for eval-heavy test cases is obviously less noticeable, but it doesn't make sense not to take this free perf win. [1]: https://westes.github.io/flex/manual/Options-Affecting-Scanner-Behavior.html#Options-Affecting-Scanner-Behavior |
||
---|---|---|
.github | ||
contrib | ||
doc/manual | ||
maintainers | ||
misc | ||
nix-meson-build-support | ||
packaging | ||
scripts | ||
src | ||
tests | ||
.clang-format | ||
.clang-tidy | ||
.dir-locals.el | ||
.editorconfig | ||
.gitignore | ||
.mergify.yml | ||
.shellcheckrc | ||
.version | ||
CITATION.cff | ||
CONTRIBUTING.md | ||
COPYING | ||
default.nix | ||
docker.nix | ||
flake.lock | ||
flake.nix | ||
HACKING.md | ||
meson.build | ||
meson.options | ||
precompiled-headers.h | ||
README.md | ||
shell.nix |
Nix
Nix is a powerful package manager for Linux and other Unix systems that makes package management reliable and reproducible. Please refer to the Nix manual for more details.
Installation and first steps
Visit nix.dev for installation instructions and beginner tutorials.
Full reference documentation can be found in the Nix manual.
Building and developing
Follow instructions in the Nix reference manual to set up a development environment and build Nix from source.
Contributing
Check the contributing guide if you want to get involved with developing Nix.
Additional resources
Nix was created by Eelco Dolstra and developed as the subject of his PhD thesis The Purely Functional Software Deployment Model, published 2006. Today, a world-wide developer community contributes to Nix and the ecosystem that has grown around it.
- The Nix, Nixpkgs, NixOS Community on nixos.org
- Official documentation on nix.dev
- Nixpkgs is the largest, most up-to-date free software repository in the world
- NixOS is a Linux distribution that can be configured fully declaratively
- Discourse
- Matrix
License
Nix is released under the LGPL v2.1.