3 ms·
If I were writing this language, I'd probably just compile it to Go, although that means Rust extensions would either incur cgo costs or have to be replaced wit
by platinumrad 4mo ago
If I were writing this language, I'd probably just compile it to Go, although that means Rust extensions would either incur cgo costs or have to be replaced with Go extensions.
- phplovesong 4mo agoYou just described http://www.lisette.run http://www.lisette.run
- mappu 4mo agoCgo is cheap these days, don't worry about it. It's barely more expensive than a direct function call but, not so you'd notice unless it's in a hot loop. At which point the lack of cross-language inlining is your real problem.
- throwaway17_17 4mo agoDo you know of any articles, tests, or implementation breakdowns that show this. I don’t have the personal experience to agree, but if that’s the case Inwould really like to know how the improvements were achieved.
- mappu 4mo agoIt was somewhat slow about a decade ago - you can see - (2015, Go 1.5) Calls cost about 170ns https://www.cockroachlabs.com/blog/the-cost-and-complexity-of-cgo/ https://www.cockroachlabs.com/blog/the-cost-and-complexity-o... - (2017, Go 1.8) Cgo speedup by 50% https://go.dev/doc/go1.8#cgoperf https://go.dev/doc/go1.8#cgoperf - (2023, Go 1.21) Calls cost about 40ns https://shane.ai/posts/cgo-performance-in-go1.21/ https://shane.ai/posts/cgo-performance-in-go1.21/ - (2026, Go 1.26) Cgo speedup by another 30% https://go.dev/doc/go1.26#faster-cgo-calls https://go.dev/doc/go1.26#faster-cgo-calls A current benchmark shows a Cgo function call as costing about 25 ns. https://gist.github.com/DeedleFake/2f50b02c0708484c66d18253302c4fd6 https://gist.github.com/DeedleFake/2f50b02c0708484c66d182533...