aboutsummaryrefslogtreecommitdiff
path: root/starlark/int_generic.go
AgeCommit message (Collapse)Author
2021-04-09Allow Soongs/blueprint's microfactory build starlark-goandroid-s-beta-2android-s-beta-1Sasha Smundak
Change build directives to avoids additional external dependency (golang.org/x/sys/unix) at the cost of small performance degradation when handling integers. Bug: 172923994 Test: treehugger Change-Id: I11aa727031a523a309ba9372300e6d413847e02d
2020-07-06starlark: use syscall.Mmap to avoid golang.org/x/sys dependency (#287)alandonovan
Also, enable the optimization on other POSIX platforms.
2020-07-06starlark: disable int optimization in iOS, which doesn't support mmap (#291)alandonovan
Fixes #290
2020-06-19starlark: fix tests for 386 (#283)alandonovan
The recent int change didn't compile on 386. Fixed. Thanks to user @anyktx for pointing this out. Also, tests of string * int and tuple * int printed a bad error message containing an integer overflow. Now fixed.
2020-06-17int: reduce allocation by representing small ints as pointers (#280)alandonovan
* int: consolidate field accessors This change defines low-level accessors for the small and big arms of the int union so that the representation can be easily changed in a follow-up. Change-Id: I7c4ae279a6d2e7b76e102ba5d01a3cd1c56fb368 * int: improve performance by avoiding allocation This change defines a new representation for Int on 64-bit machines running a POSIX operating system, by reserving a 4GB portion of the address space. Pointers to addresses in this region represent int32 values, and are disjoint from all *big.Int pointers, allowing us to represent the union in a single pointer. This means the conversion from Int to Value does not allocate. The gauss benchmark (added in this CL) shows -40% ns, -48% bytes, -63% allocs: Benchmark/bench_gauss-12 84 13648744 ns/op 3175816 B/op 105862 allocs/op (before) Benchmark/bench_gauss-12 55 24283703 ns/op 6119844 B/op 289862 allocs/op (after) On 32-bit machines, or those running a non-POSIX system, we continue to use the old representation.