Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unsafe cgo (fastcgo) #47687

Closed
MatejMagat305 opened this issue Aug 13, 2021 · 2 comments
Closed

unsafe cgo (fastcgo) #47687

MatejMagat305 opened this issue Aug 13, 2021 · 2 comments

Comments

@MatejMagat305
Copy link

MatejMagat305 commented Aug 13, 2021

there is any plan to make oficial "unsafe cgo" (fastgo) like https://github.com/petermattis/fastcgo (which is much faster then normal cgo and more like call native go function) like tool or package or additon to unsafe package?
(maybe similar unsafe.fastCgo(c.somefn, ...args) or fastcgo.Call1Arg(c.somefn1, arg); fastcgo.Call2Arg(c.somefn2, arg1, arg2); ....)
I know it wil be unsafe and maybe sometime risk but it would be very usefull in some case when people need realy fast call cgo.

@mvdan
Copy link
Member

mvdan commented Aug 13, 2021

It seems to be faster due to severe tradeoffs:

WARNING: No attempt is made to play nice with the Go scheduler or GC. The goroutine executing a fastcgo call will never be interrupted and will delay the starting or completion of GC until it finishes.

I think you should just follow #19574, as I don't think splitting the discussion in two is worthwhile.

it would be very usefull in some case

Also see https://golang.org/doc/faq#x_in_std.

@mdlayher
Copy link
Member

See above, closing.

@golang golang locked and limited conversation to collaborators Aug 13, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants