glycerine / zygomys

Zygo is a Lisp interpreter written in 100% Go. Central use case: dynamically compose Go struct trees in a zygo script, then invoke compiled Go functions on those trees. Makes Go reflection easy.
https://github.com/glycerine/zygomys/wiki
BSD 2-Clause "Simplified" License
1.71k stars 81 forks source link

Delay allocating stacktrace buffer until necessary #49

Closed DianeLooney closed 4 years ago

DianeLooney commented 4 years ago

Right now CallUserFunction will always allocate a byte slice to store stack traces. Delaying the allocation of the byte slice until it is absolutely necessary drastically increases the performance of this method (~3x on my machine).

Potential downside of this is that we might be unable to allocate memory when the panic occurs. However, I think go will still give us a pretty solid error message in that case.

glycerine commented 4 years ago

Love it. Thanks @DianeLooney.