Coder Social home page Coder Social logo

heiyeluren / xds Goto Github PK

View Code? Open in Web Editor NEW
164.0 164.0 22.0 711 KB

A third-party extensible collection of high-performance data structures and data types in Go. 第三方可扩展的Go语言中高性能数据结构和数据类型合集

License: Apache License 2.0

Go 100.00%

xds's People

Contributors

dropfan avatar guojun6-tal avatar heiyeluren avatar houseme avatar stitch-june avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

xds's Issues

XMap为啥性能比标准库的低呢?是我的测试方式有问题吗

`package main

import (
"math/rand"
"strconv"
"sync"
"testing"

"github.com/heiyeluren/xds"
xmap "github.com/heiyeluren/xds/xmap"
xmm "github.com/heiyeluren/xmm"

)

var keys = make([]string, 10000000)

func init() {
for i := 0; i < 10000000; i++ {
keys[i] = strconv.Itoa(rand.Int())
}
}

// 1000000000
func BenchmarkCHM_Put(b *testing.B) {
f := &xmm.Factory{}
mm, err := f.CreateMemory(0.75)
if err != nil {
b.Fatal(err)
}
chm, err := xmap.NewConcurrentHashMap(mm, 16, 2, 8, xds.String, xds.String)
if err != nil {
b.Fatal(err)
}

length := len(keys)
b.ResetTimer()
for i := 0; i < b.N; i++ {
	key := keys[rand.Int()%length]
	if err := chm.Put(key, key); err != nil {
		b.Error(err)
	}
}

}

func BenchmarkStdmap(b *testing.B) {
m := make(map[string]string)

length := len(keys)
b.ResetTimer()
for i := 0; i < b.N; i++ {
	key := keys[rand.Int()%length]
	m[key] = key
}

}

func BenchmarkSyncmap(b *testing.B) {
m := sync.Map{}

length := len(keys)
b.ResetTimer()
for i := 0; i < b.N; i++ {
	key := keys[rand.Int()%length]
	m.Store(key, key)
}

}
`

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.