Skip to content

Instantly share code, notes, and snippets.

@teraPacket
teraPacket / json_mini_bench.go
Created May 9, 2017 02:42
mini benchmark on extracting field from JSON string
//With the updated json parsing as of May 8, 2017, the speed of extraction from JSON string increased more than twice:
//using old API it took 7.2 seconds, with new API, it took 2.3 sec)
//the new API allows decoding JSON with a sequence of field names to specify the element to be extracted.
package main
import "time"
import (
"fmt"
"github.com/xiaost/jsonport"
)
@teraPacket
teraPacket / tcp_client.c
Created August 16, 2017 03:43
example TCP client using libuv (version 1.0)
#include <stdio.h>
#include <stdlib.h>
#include <uv.h>
//based on https://gist.githubusercontent.com/snatchev/5255976/
//raw/8392c42d719bb775053036e32b21affdf932c1b7/libuv-tcp-client.c
//which was based on libuv 0.1, there is considerable difference there.
static void on_close(uv_handle_t* handle);
static void on_connect(uv_connect_t* req, int status);
static void on_write(uv_write_t* req, int status);