https://peter.bourgon.org/go-for-industrial-programming/
future := make(chan int, 1)
go func() { future <- process() }()
result := <- future
#![allow(unused)] | |
use std::fmt; | |
#[derive(Copy, Clone)] | |
pub struct Type<'a> { | |
mime_type: &'a str, | |
} | |
impl<'a> Type<'a> { |
func TestRunReflection(t *testing.T) { | |
var cc *grpc.ClientConn | |
var opts []grpc.DialOption | |
var mtd *desc.MethodDescriptor | |
opts = append(opts, grpc.WithInsecure()) | |
dialCtx := context.Background() | |
cc, err = grpc.DialContext(dialCtx, "host", opts...) | |
if err != nil { |
package main | |
import ( | |
"fmt" | |
"time" | |
) | |
type Config struct { | |
Secure bool | |
Timeout time.Duration |
https://peter.bourgon.org/go-for-industrial-programming/
future := make(chan int, 1)
go func() { future <- process() }()
result := <- future
package main | |
import ( | |
"fmt" | |
"strings" | |
"time" | |
) | |
func upper(input string) string { | |
fmt.Println("upper " + input) |
Simple, quick performance demo / test comparing JavaScript and WebAssembly. Uses fibonacci (n = 40) with 31 runs.
Convert fib.wat
to wasm
using wat2wasm tool and download as fib.wasm
.
Use Node.js 10.
Run:
node index.js
package main | |
import ( | |
"encoding/json" | |
"fmt" | |
) | |
type User struct { | |
ID int `json:"id"` | |
Name string `json:"name"` |
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<title>Apex chart test</title> | |
<script src="https://cdn.jsdelivr.net/npm/apexcharts"></script> |
Microbenchmarks like this should always be taken with a grain of salt; but it's interesting to do a comparison.
Source code for the server implementations
Using: