Open Zyko0 opened 12 months ago
is this plan or only example and hypotetical idea?
is this plan or only example and hypotetical idea?
It is just a suggestion to improve performance. There is currently no plans to integrate the ideas in this PR. However that could change in the future
Not meant as a merge candidate, just a PoC
Context: ebitengine#purego (discord server)
This is a proof of concept of a generic alternative for
RegisterFunc
as functions ranging fromRegisterFunc0_0
(0 input, 0 output) toRegisterFunc9_1
(9 inputs, 1 output). The goal is to remove a good amount of reflection where it's not needed, but also to remove the need ofreflect.MakeFunc
which returns a heavy function that has plenty of overhead at runtime.There are tests and benchmarks for a few functions of the libc in func_test.go
Difference for
strlen
:Notes:
syscallStack
types are really weird in their implementations, but can be swapped for something else implementing the same interfacepurego.Symbol
should probably be named differently or not be exposed this waynewSyscallStack()
causes an allocation everytime in each runtime function as it escapes, couldn't find a way to remove it so farruntime.KeepAlive
stuff because I couldn't find a proper way to test their needBenchmark results on my machine (Windows)