https://github.com/daskol/spinlock

Spinlock implementation in Go and inline assembler.

https://github.com/daskol/spinlock

Science Score: 13.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (4.0%) to scientific vocabulary

Keywords

amd64 assembler assembly cas golang spinlock
Last synced: 5 months ago · JSON representation

Repository

Spinlock implementation in Go and inline assembler.

Basic Info
  • Host: GitHub
  • Owner: daskol
  • License: bsd-3-clause
  • Language: Go
  • Default Branch: master
  • Size: 5.86 KB
Statistics
  • Stars: 8
  • Watchers: 1
  • Forks: 0
  • Open Issues: 0
  • Releases: 0
Topics
amd64 assembler assembly cas golang spinlock
Created over 7 years ago · Last pushed over 7 years ago
Metadata Files
Readme License

README.md

Spinlock

Spinlock implementation in Go and inline assembler.

Overview

Package spinlock provides a low level implementation of spinlock in assembly. Also, it provides fallback to implementation based on built-in atomics.

On my private laptop benchmark results are the following. Measured time is wall time.

goos: linux goarch: amd64 pkg: github.com/daskol/spinlock BenchmarkMutex/1-4 50000000 37.7 ns/op BenchmarkMutex/2-4 30000000 52.4 ns/op BenchmarkMutex/4-4 20000000 64.4 ns/op BenchmarkMutex/8-4 20000000 83.8 ns/op BenchmarkMutex/16-4 20000000 91.2 ns/op BenchmarkSpinlockInAsm/1-4 100000000 22.1 ns/op BenchmarkSpinlockInAsm/2-4 100000000 22.1 ns/op BenchmarkSpinlockInAsm/4-4 100000000 22.1 ns/op BenchmarkSpinlockInAsm/8-4 100000000 22.8 ns/op BenchmarkSpinlockInAsm/16-4 100000000 23.6 ns/op BenchmarkSpinlockInGo/1-4 50000000 28.0 ns/op BenchmarkSpinlockInGo/2-4 50000000 27.8 ns/op BenchmarkSpinlockInGo/4-4 50000000 28.1 ns/op BenchmarkSpinlockInGo/8-4 50000000 28.7 ns/op BenchmarkSpinlockInGo/16-4 50000000 29.5 ns/op BenchmarkSpinlockThin/1-4 100000000 17.8 ns/op BenchmarkSpinlockThin/2-4 100000000 17.5 ns/op BenchmarkSpinlockThin/4-4 100000000 17.6 ns/op BenchmarkSpinlockThin/8-4 100000000 18.0 ns/op BenchmarkSpinlockThin/16-4 100000000 18.4 ns/op PASS ok github.com/daskol/spinlock 39.539s

The fastest implementation based on free function Lock()/Unlock(). However, it is two times slower than spinlock implemented in modern C++.

Run on (4 X 3400 MHz CPU s) CPU Caches: L1 Data 32K (x2) L1 Instruction 32K (x2) L2 Unified 256K (x2) L3 Unified 4096K (x1) --------------------------------------------------------------- Benchmark Time CPU Iterations --------------------------------------------------------------- run/real_time/threads:1 9 ns 9 ns 74377642 run/real_time/threads:2 9 ns 19 ns 74705518 run/real_time/threads:4 11 ns 44 ns 64348172 run/real_time/threads:8 10 ns 43 ns 7931257

Owner

  • Name: Daniel Bershatsky
  • Login: daskol
  • Kind: user
  • Location: Russia, Moscow
  • Company: @skoltech-ai

GitHub Events

Total
  • Watch event: 1
Last Year
  • Watch event: 1

Committers

Last synced: over 1 year ago

All Time
  • Total Commits: 5
  • Total Committers: 2
  • Avg Commits per committer: 2.5
  • Development Distribution Score (DDS): 0.2
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Daniel Bershatsky d****y@s****u 4
Daniel Bershatsky d****l 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 0
  • Total pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Total issue authors: 0
  • Total pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads: unknown
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 1
proxy.golang.org: github.com/daskol/spinlock

Package spinlock provides a low level implementation of spinlock in assembly. Also, it provides fallback to implementation based on built-in atomics. On my private laptop benchmark results are the following. Measured time is wall time. The fastest implementation based on free function Lock()/Unlock(). However it is two times slower than spinlock implemented in modern C++.

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 7.0%
Average: 8.2%
Dependent repos count: 9.3%
Last synced: 5 months ago