google / starlark-go

Starlark in Go: the Starlark configuration language, implemented in Go
BSD 3-Clause "New" or "Revised" License
2.26k stars 204 forks source link

starlark: optimize TestProfile #456

Closed adonovan closed 1 year ago

adonovan commented 1 year ago

Previously, the test would compute the first 100,000 elements of the Fibonacci sequence, holding them all in an array. Since elements may have over 20,000 digits, this allocates a lot of memory, which, under tight ulimits of virtual address space, in conjunction with the mmap int optimization, may cause the process to have insufficient virtual address space to allocate the necessary memory.

This change causes it to compute but not retain the elements of the sequence.

Fixes google/starlark-go#455