Skip to content

Instantly share code, notes, and snippets.

View wathenjiang's full-sized avatar
🎯
Focusing

Weijia Jiang wathenjiang

🎯
Focusing
View GitHub Profile
@wathenjiang
wathenjiang / random_access.md
Last active December 2, 2023 04:12
random_access

The test code:

use rand::Rng;
use std::{
    sync::{Arc, Mutex},
    thread,
    time::Instant,
    vec,
};
const INT_SIZE: usize = 8; // in 64 machine
@wathenjiang
wathenjiang / gnet_client_main_test.go
Created December 31, 2021 03:07
gnet_client_main_test
package main
import (
"flag"
"fmt"
"github.com/panjf2000/gnet"
"github.com/panjf2000/gnet/test/protocol"
"sync"
"time"
)
@wathenjiang
wathenjiang / gnet_client_nodelay_test.go
Last active December 31, 2021 02:56
gnet_client_nodelay_test
// Dial is like net.Dial().
func (cli *Client) Dial(network, address string) (Conn, error) {
c, err := net.Dial(network, address)
if err != nil {
return nil, err
}
defer c.Close()
sc, ok := c.(syscall.Conn)
if !ok {
return nil, errors.New("failed to convert net.Conn to syscall.Conn")