GithubHelp home page GithubHelp logo

squint3's Introduction

SQUINT3 Version   PureBasic Version   MIT License  

SQUINT3 (Sparse Quad Union Indexed Nibble Trie)

Squint is a compact prefix Trie indexed by nibbles into a sparse array with performance metrics close to a map

Structure squint_node Align #PB_Structure_AlignC
   *vertex.edge
   StructureUnion
     squint.q
     value.i 
   EndStructureUnion
EndStructure 

It provides O(K) performance with a memory size ~32 times smaller than a 256 node trie

Squint is at worst two times slower than a Map for set operations, look ups are closer to 1:1 or faster

Squint is lexographicaly sorted, sorting is magnitudes faster than what you could achieve with a map list or unsorted array

Squint also supports branches for collections or subtries, which facilitates tasks like in memory DB's and shortcuts for setting and looking up keys

Keys can either be numeric integers, binary, UTF-8 or UCS-2 Unicode strings, default is UCS-2 Unicode.

String key functions supported: Set, Get, Enum, EnumNode, Walk, WalkNode, Delete and Prune with a flag in Delete.

Binary key functions supported: SetBinary, GetBinary, EnumBinary, WalkBinary, DeleteBinary and Prune with a flag in Delete.

Numeric or HAT keys: SetNumeric, GetNumeric, DeleteNumeric, WalkNumeric.

Squint is threadsafe with lock free Sets and Gets.

It runs on x86/x64 with fasm and c backends and also on Arm 32/64, PI3 PI4

A test compared to a map where the map and trie are prefilled with 4,194,304 random keys, String test key length averages 11 bytes and Numeric keys 4 bytes

Processor 11th Gen Intel(R) Core(TM) i5-11500 @ 2.70GHz, 2712 Mhz, 6 Core(s), 12 Logical Processor(s)

Squint Numeric lookup items 94,865,337 p/s avg per thread 8,624,121

lookup rate 723.77 mb p/s

lookup time 10.54 ns

Squint Numeric writes items 1,629,607

Write rate 12.43 mb p/s

num items 4,194,304 mem 148.38mb keysize 16.00 mb

Squint string lookup items 15,463,890 p/s avg per thread 1,405,808

lookup rate 162.22 mb p/s

lookup time 64.67 ns

Squint writes items 926,961

Writes rate 9.72 mb p/s

num items 4,194,304 mem 90.37mb keysize 45.87 mb

Map lookup items 11,191,928 p/s avg per thread 1,017,448

lookup rate 117.41 mb p/s

lookup time 89.35 ns

map writes items 823,271 p/s

Write rate 8.64 mb p/s

num items 4,194,304 mem 109.87mb keysize 45.87 mb

Similar Structures

squint3's People

Contributors

idle-pb avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

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.