Comparing version 0.0.32 to 0.0.33
@@ -52,9 +52,4 @@ var log = console.log | ||
test( 8, 128 * 1024, 1024 * 1024 + 1 ); | ||
/* | ||
* items = radix(range), then we expect to consume: | ||
* ( ( range + radix(range) ) / 2 ) bytes for every | ||
* value, or >~50% probability >~1/2 ). | ||
*/ | ||
test( 8, 512 * 1024, 1024 * 1024 + 1 ); | ||
log(); |
@@ -23,4 +23,4 @@ /* | ||
, transform = require( './streams/' ) | ||
// change mask for allowing more items (default is max 65535) | ||
, lmask = 0xffff | ||
// mask to appy for restricting items | ||
// , imask = 0xffffffff | ||
; | ||
@@ -35,4 +35,3 @@ return { | ||
; | ||
// items are restricted to max 2^(16) - 1. | ||
i = i & lmask; | ||
// restrict items with mask: i &= imask; | ||
// with no repetition, items should be always <= range | ||
@@ -51,4 +50,3 @@ return seq ? new random.sequence( i, r ) : | ||
; | ||
// for default, items are restricted to max 2^(16) - 1. | ||
i = i & lmask; | ||
// restrict items with mask : i &= imask; | ||
// with no repetition, items should be always <= range | ||
@@ -68,3 +66,12 @@ return seq ? new transform.sequence( i, r, stream_opt ) : | ||
, size = -1 | ||
, prod = i * r | ||
, print = function ( val ) { | ||
var gb = val >>> 30 | ||
, mb = val >>> 20 | ||
, kb = val >>> 10 | ||
; | ||
if ( gb ) return ( val / ( 1024 * 1024 * 1024 ) ).toFixed( 2 ) + ' GB'; | ||
if ( mb ) return ( val / ( 1024 * 1024 ) ).toFixed( 2 ) + ' MB'; | ||
if ( kb ) return ( val / 1024 ).toFixed( 2 ) + ' KB'; | ||
return val + ' bytes'; | ||
} | ||
; | ||
@@ -75,12 +82,2 @@ | ||
// check js limits for numbers | ||
if ( prod === ++prod ) { | ||
log( '- type: unknown' ); | ||
log( '- error:' ); | ||
log( ' - items * range > %d', pow( 2, 53 ) ); | ||
log( ' - js could not handle numbers > 2^53' ); | ||
log( ' - decrease items to get reliable size results!' ); | ||
return; | ||
} | ||
if ( seq ) { | ||
@@ -90,3 +87,3 @@ log( '- type: random sequence' ); | ||
size = i * ibytes; | ||
log( '- size: %d KBytes', ( size >>> 10 ).toFixed( 2 ) ); | ||
log( '- size: ' + print( size ) ); | ||
return; | ||
@@ -108,3 +105,3 @@ } | ||
size = i * ibytes; | ||
log( '- size: %d KBytes', ( size >>> 10 ).toFixed( 2 ) ); | ||
log( '- size: ' + print( size ) ); | ||
} | ||
@@ -116,3 +113,3 @@ | ||
log( '- warning:' ); | ||
log( ' - items >= (range * %d)', ( 2 / 3 ).toFixed( 2 ) ); | ||
log( ' - items >= (range * %d)', ( 2 / 3 ).toFixed( 3 ) ); | ||
log( ' - limit is %d', ceil( range * 2 / 3 ) ); | ||
@@ -123,5 +120,5 @@ log( ' - use a full permutation!' ); | ||
size = i * ibytes; | ||
log( '- size: %d KBytes', ( size >>> 10 ).toFixed( 2 ) ); | ||
log( '- bitmap: %d bytes', size >>> 3 ); | ||
log( '- total size: %d Kbytes', ( ( size + ( size >>> 3 ) ) >>> 10 ).toFixed( 2 ) ); | ||
log( '- size: ' + print( size ) ); | ||
log( '- bitmap: ' + print( size >>> 3 ) ); | ||
log( '- total size: ' + print( size + ( size >>> 3 ) ) ); | ||
} | ||
@@ -128,0 +125,0 @@ |
{ | ||
"name": "brando" | ||
, "version": "0.0.32" | ||
, "version": "0.0.33" | ||
, "description": "Brando." | ||
@@ -5,0 +5,0 @@ , "homepage": "https://github.com/rootslab/brando" |
@@ -62,4 +62,3 @@ ### Brando | ||
* NOTE: | ||
* - max allowed value for items is 2^(16) - 1 (65535), see comments in the code. | ||
* - max value for range is 2^32, or 4-byte numbers. | ||
* - max allowed value for items and range is 2^(32) - 1, or 4-byte numbers. | ||
* - unlimitied repetitions for items are enabled for default (+Infinity), | ||
@@ -66,0 +65,0 @@ * otherwise use repeat === 1 to produce a full or a partial range permutation. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
47611
940
105