Skip to content

Commit

Permalink
New defaults for -Zlr/-Zmc; possibly 5% gain in compression.
Browse files Browse the repository at this point in the history
this was a huge oversight because both -Zlr and -Zmc configures
the adaptation and yet we never tried to tweak -Zmc until now!
JS code seems very non-stationary, thus smaller -Zmc fares better.
  • Loading branch information
lifthrasiir committed Aug 21, 2021
1 parent e78919e commit 2c7a59a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ Output options:
-Zco|--context-bits BITS [Range: 1..24+, Default: derived]
Sets the size of each context model, as opposed to the total size (-M).
The maximum can range from 24 to 30 depending on the number of contexts.
-Zlr|--learning-rate RATE [Range: 1..2^53, Default: 256]
-Zlr|--learning-rate RATE [Range: 1..2^53, Default: 500]
Configures the learning rate of context mixer; smaller adapts faster.
-Zmc|--model-max-count COUNT [Range: 1..32767, Default: 63]
-Zmc|--model-max-count COUNT [Range: 1..32767, Default: 5]
Configures the adaptation speed of context models.
Context models adapt fastest when the context is first seen,
but become slower each subsequent occurrence of the context.
Expand Down
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -536,10 +536,10 @@ export class Packer {
sparseSelectors: options.sparseSelectors ? options.sparseSelectors.slice() : defaultSparseSelectors(),
maxMemoryMB: options.maxMemoryMB || 150,
precision: options.precision || 16,
modelMaxCount: options.modelMaxCount || 63,
modelMaxCount: options.modelMaxCount || 5,
recipLearningRate:
options.recipLearningRate ||
Math.max(1, Math.round((options.learningRateDenom || 256) / (options.learningRateNum || 1))),
Math.max(1, Math.round((options.learningRateDenom || 500) / (options.learningRateNum || 1))),
contextBits: options.contextBits,
arrayBufferPool: options.arrayBufferPool,
numAbbreviations: typeof options.numAbbreviations === 'number' ? options.numAbbreviations : 64,
Expand Down

0 comments on commit 2c7a59a

Please sign in to comment.