Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github.com/yangyunfeng007/linked_list

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/yangyunfeng007/linked_list

  • v0.0.0-20210422134235-982ed0254787
  • Source
  • Go
  • Socket score

Version published
Created
Source

Introduction

intlist is a high-performance concurrent list.

Features

  • Concurrent safe API whit high-performance.
  • Wait-free Contains and Range Operations.
  • Sorted items.

QuickStart

package main

import (
	"fmt"
	"github.com/yangyunfeng007/linked_list"
)

func main() {
	l := linked_list.NewInt()
	for _, v := range []int{10, 12, 15} {
		if l.Insert(v) {
			fmt.Println("int list add", v)
		}
	}
	if l.Contains(10) {
		fmt.Println("int list contains 10")
	}
	l.Range(func(value int) bool {
		fmt.Println("int list find", value)
		return true
	})
	l.Delete(15)
	fmt.Printf("int list contains %d items\r\n", l.Len())
}

Benchmark

$ go test -run=NOTEST -bench=. -benchtime=100000x -benchmem -count=10 -timeout=60m  > x.txt
$ benchstat x.txt
name                                            time/op
Insert/intlist-12                               27.1µs ± 5%
Insert/simpleintlist-12                          271µs ± 3%
Contains100Hits/intlist-12                      48.3ns ± 4%
Contains100Hits/simpleintlist-12                61.2ns ± 3%
Contains50Hits/intlist-12                       49.6ns ± 5%
Contains50Hits/simpleintlist-12                 63.6ns ± 9%
ContainsNoHits/intlist-12                       53.3ns ± 9%
ContainsNoHits/simpleintlist-12                 71.1ns ±11%
50Add50Contains/intlist-12                      12.8µs ± 6%
50Add50Contains/simpleintlist-12                99.4µs ± 2%
30Add70Contains/intlist-12                      6.67µs ± 3%
30Add70Contains/simpleintlist-12                37.2µs ± 1%
1Remove9Add90Contains/intlist-12                1.45µs ± 5%
1Remove9Add90Contains/simpleintlist-12          4.39µs ± 4%
1Range9Remove90Add900Contains/intlist-12        1.43µs ± 6%
1Range9Remove90Add900Contains/simpleintlist-12  4.65µs ± 5%

FAQs

Package last updated on 22 Apr 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc