Skip to content

Commit

Permalink
Add configurable symbol table block size when the sepcified size is s…
Browse files Browse the repository at this point in the history
…maller than 32K.
  • Loading branch information
linlin-s committed Nov 28, 2023
1 parent 07ffb31 commit 3d99a4d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/com/amazon/ion/impl/_Private_IonBinaryWriterBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,10 @@ public void setStreamCopyOptimized(final boolean optimized)

public void setBlockSize(int size) {
myBinaryWriterBuilder.withUserBlockSize(size);
// Adjust the symbol table block size when the user block size is smaller than the default, because in most cases, the symbol table is smaller than the data.
if (size < myBinaryWriterBuilder.DEFAULT_BLOCK_SIZE) {
myBinaryWriterBuilder.withSymbolsBlockSize(size);
}
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/com/amazon/ion/system/IonBinaryWriterBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ public IvmMinimizing getIvmMinimizing()
public abstract IonBinaryWriterBuilder withLocalSymbolTableAppendDisabled();

/**
* Specify the default block size for write buffer.
* Specify the block size for write buffer.
* @param size represent the specified block size in bytes.
* If this functionality is not set, the default block size is 32768 bytes.
*/
Expand Down

0 comments on commit 3d99a4d

Please sign in to comment.