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

Attemp to Improve Dict Complile Performance #663

Merged
merged 5 commits into from
Jun 23, 2023

Conversation

WhiredPlanck
Copy link
Contributor

@WhiredPlanck WhiredPlanck commented Jun 13, 2023

Pull request

Issue tracker

Fixes will automatically close the related issue

Fixes # N/A

Feature

Describe feature of pull request

This PR uses several techniques to try to improve the speed of compiling dictionaries. It may save 8 ~ 10 % of build time of the dictionaries.

Unit test

  • Done

Manual test

  • Done

Code Review

  1. Unit and manual test pass
  2. GitHub Action CI pass
  3. At least one contributor reviews and votes
  4. Can be merged clean without conflicts
  5. PR will be merged by rebase upstream base

Additional Info

Tested schema: rime-ice
Compiler: GCC 13.1.1
OS: Arch Linux x86_64

Before

(Script)Encoder::DfsEncoder takes about 53% of the build time to run before the optimization.

a1

After

By speeding up EntryColletor::TranslateWord, (Script)Encoder::DfsEncoder takes about 45% of the build time to run, about 8% shorter than before.

b1

- Replace map with unordered_map for related data structs
- Replace boost::lexicast to std::stox

This may save 8 % ~ 10 % of the build time of the dictionaries.
src/rime/algo/strings.h Outdated Show resolved Hide resolved
src/rime/algo/strings.cc Outdated Show resolved Hide resolved
@lotem lotem merged commit bd3c7c7 into rime:master Jun 23, 2023
@WhiredPlanck WhiredPlanck deleted the dict-complile-performance branch June 28, 2023 12:51
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.

2 participants