yznts / kyoto

Asynchronous frontends with Go
https://pkg.go.dev/github.com/yznts/kyoto/v3
MIT License
651 stars 28 forks source link

Support `tinygo` compiler #80

Closed yznts closed 2 years ago

yznts commented 2 years ago

tinygo may provide a lot of benefits to the project, like compiling to smaller wasm payload and using in places where payload size is critical. I also consider as an option using kyoto for creating frontend, rendered on the Edge Network (f.e. Cloudflare Workers). Workers have a lot of limitations and tinygo may satisfy them.

gedw99 commented 2 years ago

Its way smaller. I go from 1 MB to 30 KB with it.

The main thing is to get rid of reflection. Many gophers use this: github.com/buger/jsonparser

Example:

https://github.com/genjidb/genji is a golang DB that can run Server side and client side. Its like MongoDB but in golang.

You can compile it using tinygo for clientside ... https://github.com/genjidb/genji.js/blob/master/scripts/buildgo.sh#L27

yznts commented 2 years ago

Seems to be no reasonable solution for this.

Initially main idea was to use kyoto in Cloudflare Workers. But the "price" of the solution and refactor is much higher than the potential profit.

gedw99 commented 2 years ago

I get your point about the pain

there are other golang template engines that don’t use reflection i think.

the go routines might still work in tinygo. I remember reading sone progress on this in tinygo recently . Can fin link right now.