-
Notifications
You must be signed in to change notification settings - Fork 372
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
Performance improvements #1735
Performance improvements #1735
Conversation
170e900
to
d2996a8
Compare
Got closed when rebasing |
|
||
final int lineEnd = StringUtils.getLineEnd(text, lineStart, selEnd); | ||
final CharSequence line = text.subSequence(lineStart, lineEnd); | ||
for (int i = 0; i < lineCount; i++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Much simpler and less work being done
@@ -147,7 +146,7 @@ private void assertCorrectReplacement(String original, String expectedReplacemen | |||
|
|||
private String replaceWithFirstMatchingPattern(List<TextActions.ReplacePattern> replacePatterns, String input) { | |||
for (TextActions.ReplacePattern replacePattern : replacePatterns) { | |||
Matcher matcher = replacePattern.searchPattern.matcher(input); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Creating a matcher is surprisingly expensive compared to resetting it with a new input
when working on the Custom templates issue I noticed that UTF-8 with bom doesn't really work on the newfile dialog - always see a empty document created then. when choosing same template with bom checked off it works. (Not sure if realted to the file write PRs) |
I will investigate
Jun. 5, 2022 11:41:13 Gregor Santner ***@***.***>:
… when working on the Custom templates issue I noticed that UTF-8 with bom doesn't really work on the newfile dialog - always see a empty document created then. when choosing same template with bom checked off it works.
(Not sure if realted to the file write PRs)
—
Reply to this email directly, view it on GitHub[#1735 (comment)], or unsubscribe[https://github.com/notifications/unsubscribe-auth/AAOZ3TEUOGLTW2FGX755ZODVNTYENANCNFSM5XOOWAWQ].
You are receiving this because you modified the open/close state.[Tracking image][https://github.com/notifications/beacon/AAOZ3TDBSN7RZ4DQK3OGBDDVNTYENA5CNFSM5XOOWAW2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOIRN36SQ.gif]
|
@gsantner I can't get the tests to run any more Any idea what I can do? EDIT: Resolved. The issue was Android studio cupcake not being happy with this. I will try upgrading again after patch 2 is out. Downgraded to Bumblebee for now |
return () -> { | ||
synchronized (sync) { | ||
_handler.removeCallbacks(callback); | ||
_handler.postDelayed(callback, delayMs); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a general debouncer. Similar to the Highlighting debouncer, but a simple function. I will look into simplifying the highlighting logic with this at a later date.
|
||
final char[] buf = new char[end - start]; | ||
TextUtils.getChars(source, start, end, buf, 0); | ||
return new String(buf); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
editable.subSequence(start, end).toString()
copies spans etc. This avoids that extra work
yeah wouldn't be the first time such things happen. I only upgrade android studio and the android gradle tool when there is some absolute must |
@@ -342,10 +342,16 @@ public static void showMultiChoiceDialogWithSearchFilterUI(final Activity activi | |||
}; | |||
|
|||
// Helper function to append selection count to OK button | |||
final String okString = dopt.okButtonText != 0 ? activity.getString(dopt.okButtonText) : ""; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unrelated fix for when okButtonText == 0.
Text actions calls are surrounded with a try-catch all, so exceptions caused here were not detected
I am satisfied with these changes |
yes thank you, merged |
This branch has some performance improvements for regexReplace and the chunked change system.
Objective is to make a actions take < 50ms on a 100k character file with highlighting enabled (my monthly log / journal files regularly reach 70k chars). We aren't quite there, but this has brought us from 120ms to 80ms on my pixel 3