Skip to content

Commit

Permalink
site: Adds first submenu for Community (#557)
Browse files Browse the repository at this point in the history
This adds a submenu for community, filing GH and the history into it.
The same surgery should work for future submenus, for example,
compatibility and docs.

Signed-off-by: Adrian Cole <[email protected]>
  • Loading branch information
codefromthecrypt authored May 13, 2022
1 parent 80da871 commit 5f64ce0
Show file tree
Hide file tree
Showing 4 changed files with 98 additions and 47 deletions.
44 changes: 0 additions & 44 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -305,43 +305,6 @@ your use case (ex which language you are using to compile, a.k.a. target Wasm).
</p>
</details>

## History of wazero

wazero was originally developed by [Takeshi Yoneda][21] as a hobby project in
mid 2020. In late 2021, it was sponsored by Tetrate as a top-level project.
That said, Takeshi's original motivation is as relevant today as when he
started the project, and worthwhile reading:

If you want to provide Wasm host environments in your Go programs, currently
there's no other choice than using CGO leveraging the state-of-the-art
runtimes written in C++/Rust (e.g. V8, Wasmtime, Wasmer, WAVM, etc.), and
there's no pure Go Wasm runtime out there. (There's only one exception named
[wagon][22], but it was archived with the mention to this project.)

First, why do you want to write host environments in Go? You might want to have
plugin systems in your Go project and want these plugin systems to be
safe/fast/flexible, and enable users to write plugins in their favorite
languages. That's where Wasm comes into play. You write your own Wasm host
environments and embed Wasm runtime in your projects, and now users are able to
write plugins in their own favorite languages (AssemblyScript, C, C++, Rust,
Zig, etc.). As a specific example, you maybe write proxy severs in Go and want
to allow users to extend the proxy via [Proxy-Wasm ABI][23]. Maybe you are
writing server-side rendering applications via Wasm, or [OpenPolicyAgent][24]
is using Wasm for plugin system.

However, experienced Golang developers often avoid using CGO because it
introduces complexity. For example, CGO projects are larger and complicated to
consume due to their libc + shared library dependency. Debugging is more
difficult for Go developers when most of a library is written in Rustlang.
[_CGO is not Go_][25] [ -- _Rob_ _Pike_][26] dives in deeper. In short, the
primary motivation to start wazero was to avoid CGO.

wazero compiles WebAssembly modules into native assembly (JIT) by default. You
may be surprised to find equal or better performance vs mature JIT-style
runtimes because [CGO is slow][27]. More specifically, if you make large amount
of CGO calls which cross the boundary between Go and C (stack) space, then the
usage of CGO could be a bottleneck.

-----
wazero is a registered trademark of Tetrate.io, Inc. in the United States and/or other countries

Expand All @@ -365,10 +328,3 @@ wazero is a registered trademark of Tetrate.io, Inc. in the United States and/or
[18]: https://pkg.go.dev/github.com/tetratelabs/wazero#RuntimeConfig
[19]: https://www.w3.org/community/webassembly/
[20]: https://github.com/WebAssembly/WASI/issues/469#issuecomment-1045251844
[21]: https://github.com/mathetake
[22]: https://github.com/go-interpreter/wagon
[23]: https://github.com/proxy-wasm/spec
[24]: https://www.openpolicyagent.org/docs/latest/wasm/
[25]: https://dave.cheney.net/2016/01/18/cgo-is-not-go
[26]: https://www.youtube.com/watch?v=PAAkCSZUG1c&t=757s
[27]: https://github.com/golang/go/issues/19574
17 changes: 14 additions & 3 deletions site/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,23 @@ theme = "hello-friend"
[[languages.en.menu.main]]
url = "https://pkg.go.dev/github.com/tetratelabs/wazero"
name = "API"
weight = 10
weight = 1
[[languages.en.menu.main]]
url = "https://github.com/tetratelabs/wazero/blob/main/examples"
name = "Examples"
weight = 10
weight = 2
[[languages.en.menu.main]]
identifier = "community"
name = "Community"
weight = 3
[[languages.en.menu.main]]
parent = "community"
url = "https://github.com/tetratelabs/wazero"
name = "GitHub"
weight = 20
weight = 1
[[languages.en.menu.main]]
parent = "community"
url = "/history/"
identifier = "history"
name = "History"
weight = 2
46 changes: 46 additions & 0 deletions site/content/history.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
+++
title = "History of wazero"
+++

wazero was originally developed by [Takeshi Yoneda][1] as a hobby project in
mid 2020. In late 2021, it was sponsored by Tetrate as a top-level project.
That said, Takeshi's original motivation is as relevant today as when he
started the project, and worthwhile reading:

If you want to provide Wasm host environments in your Go programs, currently
there's no other choice than using CGO leveraging the state-of-the-art
runtimes written in C++/Rust (e.g. V8, Wasmtime, Wasmer, WAVM, etc.), and
there's no pure Go Wasm runtime out there. (There's only one exception named
[wagon][2], but it was archived with the mention to this project.)

First, why do you want to write host environments in Go? You might want to have
plugin systems in your Go project and want these plugin systems to be
safe/fast/flexible, and enable users to write plugins in their favorite
languages. That's where Wasm comes into play. You write your own Wasm host
environments and embed Wasm runtime in your projects, and now users are able to
write plugins in their own favorite languages (AssemblyScript, C, C++, Rust,
Zig, etc.). As a specific example, you maybe write proxy severs in Go and want
to allow users to extend the proxy via [Proxy-Wasm ABI][3]. Maybe you are
writing server-side rendering applications via Wasm, or [OpenPolicyAgent][4]
is using Wasm for plugin system.

However, experienced Golang developers often avoid using CGO because it
introduces complexity. For example, CGO projects are larger and complicated to
consume due to their libc + shared library dependency. Debugging is more
difficult for Go developers when most of a library is written in Rustlang.
[_CGO is not Go_][5] [ -- _Rob_ _Pike_][6] dives in deeper. In short, the
primary motivation to start wazero was to avoid CGO.

wazero compiles WebAssembly modules into native assembly (JIT) by default. You
may be surprised to find equal or better performance vs mature JIT-style
runtimes because [CGO is slow][7]. More specifically, if you make large amount
of CGO calls which cross the boundary between Go and C (stack) space, then the
usage of CGO could be a bottleneck.

[1]: https://github.com/mathetake
[2]: https://github.com/go-interpreter/wagon
[3]: https://github.com/proxy-wasm/spec
[4]: https://www.openpolicyagent.org/docs/latest/wasm/
[5]: https://dave.cheney.net/2016/01/18/cgo-is-not-go
[6]: https://www.youtube.com/watch?v=PAAkCSZUG1c&t=757s
[7]: https://github.com/golang/go/issues/19574
38 changes: 38 additions & 0 deletions site/layouts/partials/menu.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<nav class="menu">
<ul class="menu__inner menu__inner--desktop">
{{ range $.Site.Menus.main }}
{{ if not .HasChildren }}
<li><a href="{{ .URL }}">{{ .Name }}</a></li>
<!-- The default theme supports a drop-down for showMenuItems > 0. We re-use this class
for child menus instead. -->
{{ else }}
<ul class="menu__sub-inner">
<li class="menu__sub-inner-more-trigger">
{{ .Name }}
<span class="menu__sub-inner-more-trigger-icon">{{ partial "greater-icon.html" . }}</span>
</li>
<ul class="menu__sub-inner-more hidden">
{{ range .Children }}
<li><a href="{{ .URL }}">{{ .Name }}</a></li>
{{ end }}
</ul>
</ul>
{{ end }}
{{ end }}
</ul>

<!-- Handle mobile -->
<ul class="menu__inner menu__inner--mobile">
{{ range $.Site.Menus.main }}
{{ if not .HasChildren }}
<li><a href="{{ .URL }}">{{ .Name }}</a></li>
{{ else }}
<!-- TODO: At some point, this will get too long, and also this loses
categorization. Implement CSS like desktop for sub-menus -->
{{ range .Children }}
<li><a href="{{ .URL }}">{{ .Name }}</a></li>
{{ end }}
{{ end }}
{{ end }}
</ul>
</nav>

0 comments on commit 5f64ce0

Please sign in to comment.