1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-11 13:06:01 +01:00
nix/src/libexpr
Jörg Thalheim cbcb434cb3 libexpr: Convert Symbol comparisons to switch statements
Now that Symbols are statically allocated at compile time with known IDs,
we can use switch statements instead of if-else chains for Symbol comparisons.
This provides better performance through compiler optimizations like jump tables.

Changes:
- Add public getId() method to Symbol class to access the internal ID
- Convert if-else chains comparing Symbol values to switch statements
  in primops.cc's derivationStrictInternal function
- Simplify control flow by removing the 'handled' flag and moving the
  default attribute handling into the switch's default case

The static and runtime Symbol IDs are guaranteed to match by the
copyIntoSymbolTable implementation which asserts this invariant.

Co-authored-by: John Ericson <git@JohnEricson.me>
2025-09-03 10:13:12 +02:00
..
include/nix/expr libexpr: Convert Symbol comparisons to switch statements 2025-09-03 10:13:12 +02:00
pch libexpr: Speed up builds by using precompiled headers 2025-07-20 22:01:56 +03:00
primops libexpr: Statically allocate commonly used symbols 2025-08-31 13:24:06 +02:00
value Apply clang-format universally. 2025-07-18 12:47:27 -04:00
.version Meson build for libexpr and libflake 2024-07-02 09:23:24 -04:00
attr-path.cc Apply clang-format universally. 2025-07-18 12:47:27 -04:00
attr-set.cc Apply clang-format universally. 2025-07-18 12:47:27 -04:00
eval-cache.cc libexpr: Statically allocate commonly used symbols 2025-08-31 13:24:06 +02:00
eval-error.cc Apply clang-format universally. 2025-07-18 12:47:27 -04:00
eval-gc.cc Revert "Merge pull request #13709 from NixOS/boehm-coroutines-sp" 2025-08-11 19:18:04 +02:00
eval-profiler-settings.cc libutil: Include necessary headers in config-impl.hh 2025-08-11 20:44:27 +03:00
eval-profiler.cc libexpr: Statically allocate commonly used symbols 2025-08-31 13:24:06 +02:00
eval-settings.cc Apply clang-format universally. 2025-07-18 12:47:27 -04:00
eval.cc libexpr: Statically allocate commonly used symbols 2025-08-31 13:24:06 +02:00
fetchurl.nix Format .nix files 2025-01-24 17:04:02 +01:00
function-trace.cc Apply clang-format universally. 2025-07-18 12:47:27 -04:00
get-drvs.cc libexpr: Statically allocate commonly used symbols 2025-08-31 13:24:06 +02:00
imported-drv-to-derivation.nix Format .nix files 2025-01-24 17:04:02 +01:00
json-to-value.cc Apply clang-format universally. 2025-07-18 12:47:27 -04:00
lexer-helpers.cc Make lexer-helpers.hh internal to fix a clang-tidy error 2025-04-07 18:21:08 +02:00
lexer-helpers.hh Apply clang-format universally. 2025-07-18 12:47:27 -04:00
lexer.l libexpr: Improve lexer performance by using full scanner tables (-Cf) 2025-05-01 23:10:04 +00:00
meson.build treewide: Bump C++ standard version to C++23 2025-08-19 15:33:27 +03:00
meson.options meson: Apply formatting universally 2025-08-07 02:58:29 +03:00
nix-meson-build-support rename: build-utils-meson -> nix-meson-build-support 2024-12-09 16:54:42 +01:00
nixexpr.cc Apply clang-format universally. 2025-07-18 12:47:27 -04:00
package.nix flake: Apply nixfmt 1.0.0 2025-08-18 20:29:45 +03:00
parser.y libexpr: Statically allocate commonly used symbols 2025-08-31 13:24:06 +02:00
paths.cc Apply clang-format universally. 2025-07-18 12:47:27 -04:00
primops.cc libexpr: Convert Symbol comparisons to switch statements 2025-09-03 10:13:12 +02:00
print-ambiguous.cc Apply clang-format universally. 2025-07-18 12:47:27 -04:00
print.cc libexpr: Statically allocate commonly used symbols 2025-08-31 13:24:06 +02:00
search-path.cc Apply clang-format universally. 2025-07-18 12:47:27 -04:00
value-to-json.cc libexpr: Statically allocate commonly used symbols 2025-08-31 13:24:06 +02:00
value-to-xml.cc libexpr: Statically allocate commonly used symbols 2025-08-31 13:24:06 +02:00