Get the latest tech news

Rustgo: Calling Rust from Go with near-zero overhead (2017)


[русский [https://habrahabr.ru/post/337348/]] Go has good support for calling into assembly, and a lot of the fast cryptographic code in the stdlib is carefully optimized assembly, bringing speedups of over 20 times. However, writing assembly code is hard, reviewing it is possibly harder, and cryptography is unforgiving

But for what we are doing today we need a language that won't flinch when asked to generate stack-only functions with manually hinted away safety checks. But cgo does a lot of things to enable that bit of Go naturalness it provides: it will setup a whole stack for C to live in, it makes defer calls to prepare for a panic in a Go callback... this could be will be a whole post of its own. I still have no idea why leaving it out would result in that issue, but adding it finally made our rustgo package compile both with external and internal linking, on Linux and macOS, out of the box.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of overhead

overhead

Photo of Rustgo

Rustgo

Related news:

News photo

Is Modern Software Development Mostly 'Junky Overhead'?