Eliminate cleaners/core import time bottleneck#4167
Open
aseembits93 wants to merge 6 commits intoUnstructured-IO:mainfrom
Open
Eliminate cleaners/core import time bottleneck#4167aseembits93 wants to merge 6 commits intoUnstructured-IO:mainfrom
aseembits93 wants to merge 6 commits intoUnstructured-IO:mainfrom
Conversation
Contributor
|
I don't think the gains here (1/3 second at import time) are worth putting data in a code file. |
Contributor
|
@qued ok, there are a couple of other approaches - storing the list in a separate data file or reducing the sys.maxunicode range to a group of smaller ranges and checking for punctuation membership within that. Let me know what approach works better |
Contributor
|
@misrasaurabh1 My first instinct is to use a data file, but does the file IO to load it erode all the gains from not checking all the unicode characters? |
Contributor
|
we can experiment with the other approaches and check |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously the code was going through a million unicode characters and for each of them checking if the character was unicode punctuation or not. This was heavy and took about 350ms during import time.
After processing the number of punctuation was only about ~750 so we just hard coded the unicode punctuation characters in source code itself. This way we eliminate the runtime calculation.
To ensure correctness, we added a test.


Before
After