All Projects → lukechampine → Uint128

lukechampine / Uint128

Licence: mit
uint128 for Go

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to Uint128

Nodebb
Node.js based forum software built for the modern web
Stars: ✭ 12,303 (+7786.54%)
Mutual labels:  hacktoberfest
Photos
📸 Your memories under your control
Stars: ✭ 157 (+0.64%)
Mutual labels:  hacktoberfest
Fselect
Find files with SQL-like queries
Stars: ✭ 3,103 (+1889.1%)
Mutual labels:  hacktoberfest
Brain.js
brain.js is a GPU accelerated library for Neural Networks written in JavaScript.
Stars: ✭ 12,358 (+7821.79%)
Mutual labels:  hacktoberfest
Eleventy Garden
🌱 A starter site for building a mind garden with eleventy
Stars: ✭ 157 (+0.64%)
Mutual labels:  hacktoberfest
Jsx Pragmatic
Build JSX structures, then decide at runtime which pragma you want to use to render them.
Stars: ✭ 157 (+0.64%)
Mutual labels:  hacktoberfest
Nginxconfig.io
⚙️ NGINX config generator on steroids 💉
Stars: ✭ 14,983 (+9504.49%)
Mutual labels:  hacktoberfest
Ajari Koding
📚 Kumpulan berbagai sumber daya untuk belajar koding dari hasil karya para kreator lokal yang terpercaya dan telah dikurasi oleh komunitas PHPID
Stars: ✭ 156 (+0%)
Mutual labels:  hacktoberfest
Resources
Resources on various topics being worked on at IvLabs
Stars: ✭ 158 (+1.28%)
Mutual labels:  hacktoberfest
Osbrain
osBrain - A general-purpose multi-agent system module written in Python
Stars: ✭ 157 (+0.64%)
Mutual labels:  hacktoberfest
Documentation
Pantheon Docs
Stars: ✭ 157 (+0.64%)
Mutual labels:  hacktoberfest
Products.cmfplone
The core of the Plone content management system
Stars: ✭ 157 (+0.64%)
Mutual labels:  hacktoberfest
Creative Computing Society.github.io
This is the Hacktoberfest first contribution website of CCS
Stars: ✭ 158 (+1.28%)
Mutual labels:  hacktoberfest
Playframework
Play Framework
Stars: ✭ 12,041 (+7618.59%)
Mutual labels:  hacktoberfest
Relm
Idiomatic, GTK+-based, GUI library, inspired by Elm, written in Rust
Stars: ✭ 2,063 (+1222.44%)
Mutual labels:  hacktoberfest
K6
A modern load testing tool, using Go and JavaScript - https://k6.io
Stars: ✭ 14,829 (+9405.77%)
Mutual labels:  hacktoberfest
Go Appimage
Go implementation of AppImage tools. Still experimental
Stars: ✭ 156 (+0%)
Mutual labels:  hacktoberfest
Notas De Aula
Reunião de anotações sobre conteúdos aprendidos por mim.
Stars: ✭ 159 (+1.92%)
Mutual labels:  hacktoberfest
Camunda Bpm Platform
Flexible framework for workflow and decision automation with BPMN and DMN. Integration with Spring, Spring Boot, CDI.
Stars: ✭ 2,390 (+1432.05%)
Mutual labels:  hacktoberfest
Sampleapis
This repository is a playground for API's. These are just a collection of items that you can utilize for learning purposes.
Stars: ✭ 157 (+0.64%)
Mutual labels:  hacktoberfest

uint128

GoDoc Go Report Card

go get lukechampine.com/uint128

uint128 provides a high-performance Uint128 type that supports standard arithmetic operations. Unlike math/big, operations on Uint128 values always produce new values instead of modifying a pointer receiver. A Uint128 value is therefore immutable, just like uint64 and friends.

The name uint128.Uint128 stutters, so I recommend either using a "dot import" or aliasing uint128.Uint128 to give it a project-specific name. Embedding the type is not recommended, because methods will still return uint128.Uint128; this means that, if you want to extend the type with new methods, your best bet is probably to copy the source code wholesale and rename the identifier. ¯\_(ツ)_/¯

Benchmarks

Addition, multiplication, and subtraction are on par with their native 64-bit equivalents. Division is slower: ~20x slower when dividing a Uint128 by a uint64, and ~100x slower when dividing by a Uint128. However, division is still faster than with big.Int (for the same operands), especially when dividing by a uint64.

BenchmarkArithmetic/Add-4              2000000000    0.45 ns/op    0 B/op      0 allocs/op
BenchmarkArithmetic/Sub-4              2000000000    0.67 ns/op    0 B/op      0 allocs/op
BenchmarkArithmetic/Mul-4              2000000000    0.42 ns/op    0 B/op      0 allocs/op
BenchmarkArithmetic/Lsh-4              2000000000    1.06 ns/op    0 B/op      0 allocs/op
BenchmarkArithmetic/Rsh-4              2000000000    1.06 ns/op    0 B/op      0 allocs/op

BenchmarkDivision/native_64/64-4       2000000000    0.39 ns/op    0 B/op      0 allocs/op
BenchmarkDivision/Div_128/64-4         2000000000    6.28 ns/op    0 B/op      0 allocs/op
BenchmarkDivision/Div_128/128-4        30000000      45.2 ns/op    0 B/op      0 allocs/op
BenchmarkDivision/big.Int_128/64-4     20000000      98.2 ns/op    8 B/op      1 allocs/op
BenchmarkDivision/big.Int_128/128-4    30000000      53.4 ns/op    48 B/op     1 allocs/op

BenchmarkString/Uint128-4              10000000      173 ns/op     48 B/op     1 allocs/op
BenchmarkString/big.Int-4              5000000       350 ns/op     144 B/op    3 allocs/op
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].