lix/src
aszlig 0ad643ed5c
libexpr: Use int64_t for NixInt
Using a 64bit integer on 32bit systems will come with a bit of a
performance overhead, but given that Nix doesn't use a lot of integers
compared to other types, I think the overhead is negligible also
considering that 32bit systems are in decline.

The biggest advantage however is that when we use a consistent integer
size across all platforms it's less likely that we miss things that we
break due to that. One example would be:

https://github.com/NixOS/nixpkgs/pull/44233

On Hydra it will evaluate, because the evaluator runs on a 64bit
machine, but when evaluating the same on a 32bit machine it will fail,
so using 64bit integers should make that consistent.

While the change of the type in value.hh is rather easy to do, we have a
few more options available for doing the conversion in the lexer:

  * Via an #ifdef on the architecture and using strtol() or strtoll()
    accordingly depending on which architecture we are. For the #ifdef
    we would need another AX_COMPILE_CHECK_SIZEOF in configure.ac.
  * Using istringstream, which would involve copying the value.
  * As we're already using boost, lexical_cast might be a good idea.

Spoiler: I went for the latter, first of all because lexical_cast does
have an overload for const char* and second of all, because it doesn't
involve copying around the input string. Also, because istringstream
seems to come with a bigger overhead than boost::lexical_cast:

https://www.boost.org/doc/libs/release/doc/html/boost_lexical_cast/performance.html

The first method (still using strtol/strtoll) also wasn't something I
pursued further, because it is also locale-aware which I doubt is what
we want, given that the regex for int is [0-9]+.

Signed-off-by: aszlig <aszlig@nix.build>
Fixes: #2339
2018-08-29 01:05:52 +02:00
..
build-remote Merge branch 'aarch64-armv7' of git://github.com/lheckemann/nix 2018-04-23 08:48:22 -04:00
cpptoml Include cpptoml for build simplicity 2018-07-03 18:39:36 +02:00
libexpr libexpr: Use int64_t for NixInt 2018-08-29 01:05:52 +02:00
libmain Modularize config settings 2018-05-30 13:28:01 +02:00
libstore Improve 'coroutine has finished' error message 2018-08-21 15:22:04 +02:00
libutil Improve 'coroutine has finished' error message 2018-08-21 15:22:04 +02:00
linenoise linenoise.cpp: allow completions from empty input 2017-12-19 12:52:10 -06:00
nix nix run: Restore CPU affinity 2018-08-19 12:05:08 +02:00
nix-build Drop all references to NIX_INDENT_MAKE 2018-08-20 02:01:59 +03:00
nix-channel make sure not to use cached channels for nix-channel --update 2018-05-09 16:18:20 +02:00
nix-collect-garbage Add plugins to make Nix more extensible. 2018-02-08 12:44:37 -05:00
nix-copy-closure Fix library ordering in Makefiles 2018-04-21 21:10:52 -07:00
nix-daemon Make adding paths via nix-store --serve run in constant memory 2018-08-03 21:21:16 +02:00
nix-env Merge pull request #767 from mogorman/garbage_collect_keep_last_few 2018-05-31 10:00:21 +02:00
nix-instantiate Move EvalState from the stack to the heap 2018-06-12 17:49:55 +02:00
nix-prefetch-url nix-prefetch-url: Download file in constant memory 2018-07-12 18:48:41 +02:00
nix-store Make adding paths via nix-store --serve run in constant memory 2018-08-03 21:21:16 +02:00
nlohmann nlohmann-json: 2.1.1 -> 3.0.1 2018-01-22 12:19:50 -06:00
resolve-system-dependencies Replace Unicode quotes in user-facing strings by ASCII 2017-07-30 12:32:45 +01:00