Improve speed at which language files are loaded - #914
Open
tiffit wants to merge 3 commits into
Open
Conversation
| remap = false)) | ||
| private static Object[] split(Iterable<String> iterable, Class<String> type, @Local String s) { | ||
| for (int i = 0; i < s.length() - 1; i++) { | ||
| if (s.charAt(i) == '=') { |
Contributor
There was a problem hiding this comment.
Why not use indexOf?
| at = @At(value = "INVOKE", target = "Ljava/util/List;iterator()Ljava/util/Iterator;", remap = false)) | ||
| private static Iterator<String> createOffThreadIterator(List<String> instance, | ||
| @Local(argsOnly = true) InputStream input) { | ||
| return new OffThreadLineIterator(input); |
Contributor
There was a problem hiding this comment.
Wait a moment, how does this work? Instead of performing blocking IO operations on the main thread, we create one new off-thread and block the main thread while the off-thread is performing IO operations?
The only possible benefit I see from this is being able to process the lines while the other thread is waiting on IO, but that's a pretty minor benefit assuming this process is IO-bound.
Contributor
|
How much faster is this? I have a hard time believing that the thread dispatch overhead is lower than some basic string operations. |
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.
Locale.classandStringTranslate.classhave essentially the same method with some slight modifications. This PR targets both of those classes. From personal profiling, I noticed ~500-600ms faster launch time in GTNH.