tengo
tengo copied to clipboard
feat: function/closure with keyword arguments
Hello!
I implement kwargs/keyword arguments for functions and closures. But I'm not very satisfied with the VM performance difference.
Could anyone help me with that?
Original benchmark:
-------------------------------------
fibonacci(35)
-------------------------------------
Result: 9227465
Go: 50.13513ms
Parser: 14.368µs
Compile: 71.829µs
VM: 2.694701467s
-------------------------------------
fibonacci(35) (tail-call #1)
-------------------------------------
Result: 9227465
Go: 67.91345ms
Parser: 18.285µs
Compile: 68.48µs
VM: 2.776874189s
-------------------------------------
fibonacci(35) (tail-call #2)
-------------------------------------
Result: 9227465
Go: 236ns
Parser: 16.982µs
Compile: 55.363µs
VM: 18.95µs
Benchmark after my implementations:
-------------------------------------
fibonacci(35)
-------------------------------------
Result: 9227465
Go: 50.351214ms
Parser: 14.591µs
Compile: 71.252µs
VM: 14.926579001s
-------------------------------------
fibonacci(35) (tail-call #1)
-------------------------------------
Result: 9227465
Go: 74.248173ms
Parser: 19.069µs
Compile: 85.272µs
VM: 19.496196464s
-------------------------------------
fibonacci(35) (tail-call #2)
-------------------------------------
Result: 9227465
Go: 234ns
Parser: 17.122µs
Compile: 56.115µs
VM: 33.158µs
Hopefully these comments will help with a good starting point to optimize the runtime
Hello! Current bachmark results after your comments:
-------------------------------------
fibonacci(35)
-------------------------------------
Result: 9227465
Go: 50.01228ms
Parser: 14.9µs
Compile: 69.707µs
VM: 4.527052515s
-------------------------------------
fibonacci(35) (tail-call #1)
-------------------------------------
Result: 9227465
Go: 68.14745ms
Parser: 21.051µs
Compile: 72.122µs
VM: 5.220183077s
-------------------------------------
fibonacci(35) (tail-call #2)
-------------------------------------
Result: 9227465
Go: 230ns
Parser: 16.992µs
Compile: 55.53µs
VM: 16.023µs
What do you think?
Much better but still quite slow. From a cursory glance not sure if anything else could be improved. Perhaps try profiling the benchmark code to see what the pain points are?