Join our webinar on Wednesday, June 26, at 1pm EDTHow Chia Mitigates Risk in the Crypto Industry.Register
Socket
Socket
Sign inDemoInstall

toni

Package Overview
Dependencies
1
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.6.0 to 0.6.1

2

bench/toni-rank-bitmap-bench.js

@@ -45,2 +45,2 @@ #!/usr/bin/env node

print( etime, k );
print( etime, k );

@@ -19,2 +19,3 @@ /*

, max = Math.max
, min = Math.min
// table of powers

@@ -49,2 +50,3 @@ , bpower = new Buffer( [ 128, 64, 32, 16, 8, 4, 2, 1 ] )

me.bitmap = bitmap;
// bytes needed
me.bmlen = bytes << 3 >>> 0;

@@ -116,8 +118,6 @@ me.items = 0;

// it returns the occurrences of bit 1 until index i
tproto.rank = function ( index ) {
tproto.rank = function ( i ) {
var me = this
, bitmap = me.bitmap
, bmlen = me.bmlen
, range = me.range
// , eoffset = max( range >>> 3, 1 )
, buck = null

@@ -128,2 +128,3 @@ , boff = -1

, bcnt = 0
, index = min( i >>> 0, me.bmlen )
;

@@ -137,27 +138,8 @@ if ( index > bmlen ) return -1;

// log( '\n- index: %d, bucket: %d, remaining bits: %d, max range: %d, BM bits: %d'
// , index, buck, boff, range, bmlen )
if ( buck ) {
// log( ' - bytes to count: %d', buck );
for ( b = 0; b < buck ; ++b ) {
for ( b = 0; b < buck ; ++b )
bcnt += bctable[ bitmap[ b ] ];
// log( ' - current byte index: %d', b );
// log( ' - rank(1) for current byte: %d (%d -> %s)'
// , bctable[ bitmap[ b ] ]
// , bitmap[ b ]
// , bitmap[ b ].toString( 2 )
// );
// log( ' - total bits counted: %d', bcnt );
}
}
bcnt += bctable[ bitmap[ b ] >>> bshift ];
// log( ' - bits remaining to check in the last byte: %d (%s)', boff, bitmap[ b ].toString( 2 ) );
// log( ' - discarding %d bit(s), we obtain: %d (%s)'
// , bshift
// , ( bitmap[ b ] >>> bshift )
// , ( bitmap[ b ] >>> bshift ).toString( 2 )
// );
// log( '- rank(1) for current byte: %d', bctable[ bitmap[ b ] >>> bshift ] );
// log( '- total rank(1, %d): %d', index, bcnt );
return bcnt;

@@ -167,12 +149,10 @@ };

// it returns the position of the i-th occurrence of bit 1
tproto.select = function ( index ) {
var me = this
;
return;
};
// tproto.select = function ( index ) {
// var me = this
// ;
// return;
// };
return Toni;
} )();
exports.Toni.version = require( '../package' ).version;
} )();
{
"name": "toni"
, "version": "0.6.0"
, "version": "0.6.1"
, "description": "Toni, a simple and efficient bitmap implementation for positive integer sets (max 32 bits), with no element repetition, using bitwise operations and a Buffer. Modifying a single bit instead of an entire byte, obviously saves 87.5% of Buffer space, but it also implies a gain greater than 200% in performances, for accessing values, when it was used with big integer ranges."

@@ -5,0 +5,0 @@ , "homepage": "https://github.com/rootslab/toni"

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc