Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Parallel option to improve database construct performance, Add DISABLE symbols to generated code for reduce code size #76

Merged
merged 6 commits into from
Feb 16, 2022

Conversation

neuecc
Copy link
Member

@neuecc neuecc commented Feb 16, 2022

When invoking new MemoryDatabase(byte[] databaseBinary...), read and construct database from binary. If binary size is large then construct performance will slow down. MemoryDatabase has ctor(..., int maxDegreeOfParallelism = 1) option in constructor to construct in parallel.

var database = new MemoryDatabase(bin, maxDegreeOfParallelism: Environment.ProcessorCount);

The use of Parallel can greatly improve the construct performance. Recommend to use Environment.ProcessorCount.

If you want to reduce code size of generated code, Validator and MetaDatabase info can omit in runtime. Generated code has two symbols DISABLE_MASTERMEMORY_VALIDATOR and DISABLE_MASTERMEMORY_METADATABASE. By defining them, can be erased from the build code.

@neuecc neuecc merged commit ecc3a91 into master Feb 16, 2022
@neuecc neuecc deleted the optimization branch February 16, 2022 08:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant