Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
LatinIME
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
keyboard
LatinIME
Commits
3350f703
Commit
3350f703
authored
9 years ago
by
Dan Zivkovic
Committed by
Android (Google) Code Review
9 years ago
Browse files
Options
Downloads
Plain Diff
Merge "Log timing of commitChosenWord()"
parents
915b1ed3
9731fadc
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
+39
-0
39 additions, 0 deletions
.../com/android/inputmethod/latin/inputlogic/InputLogic.java
with
39 additions
and
0 deletions
java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
+
39
−
0
View file @
3350f703
...
@@ -2094,6 +2094,9 @@ public final class InputLogic {
...
@@ -2094,6 +2094,9 @@ public final class InputLogic {
}
}
}
}
// TODO: Remove this before going live.
private
static
final
boolean
DEBUG_COMMIT_TIMING
=
true
;
/**
/**
* Commits the chosen word to the text field and saves it for later retrieval.
* Commits the chosen word to the text field and saves it for later retrieval.
*
*
...
@@ -2104,24 +2107,60 @@ public final class InputLogic {
...
@@ -2104,24 +2107,60 @@ public final class InputLogic {
*/
*/
private
void
commitChosenWord
(
final
SettingsValues
settingsValues
,
final
String
chosenWord
,
private
void
commitChosenWord
(
final
SettingsValues
settingsValues
,
final
String
chosenWord
,
final
int
commitType
,
final
String
separatorString
)
{
final
int
commitType
,
final
String
separatorString
)
{
long
startTimeMillis
=
0
;
if
(
DEBUG_COMMIT_TIMING
)
{
startTimeMillis
=
System
.
currentTimeMillis
();
Log
.
d
(
TAG
,
"commitChosenWord() : ["
+
chosenWord
+
"]"
);
}
final
SuggestedWords
suggestedWords
=
mSuggestedWords
;
final
SuggestedWords
suggestedWords
=
mSuggestedWords
;
final
CharSequence
chosenWordWithSuggestions
=
final
CharSequence
chosenWordWithSuggestions
=
SuggestionSpanUtils
.
getTextWithSuggestionSpan
(
mLatinIME
,
chosenWord
,
SuggestionSpanUtils
.
getTextWithSuggestionSpan
(
mLatinIME
,
chosenWord
,
suggestedWords
);
suggestedWords
);
if
(
DEBUG_COMMIT_TIMING
)
{
long
runTimeMillis
=
System
.
currentTimeMillis
()
-
startTimeMillis
;
Log
.
d
(
TAG
,
"commitChosenWord() : "
+
runTimeMillis
+
" ms to run "
+
"SuggestionSpanUtils.getTextWithSuggestionSpan()"
);
startTimeMillis
=
System
.
currentTimeMillis
();
}
// When we are composing word, get n-gram context from the 2nd previous word because the
// When we are composing word, get n-gram context from the 2nd previous word because the
// 1st previous word is the word to be committed. Otherwise get n-gram context from the 1st
// 1st previous word is the word to be committed. Otherwise get n-gram context from the 1st
// previous word.
// previous word.
final
NgramContext
ngramContext
=
mConnection
.
getNgramContextFromNthPreviousWord
(
final
NgramContext
ngramContext
=
mConnection
.
getNgramContextFromNthPreviousWord
(
settingsValues
.
mSpacingAndPunctuations
,
mWordComposer
.
isComposingWord
()
?
2
:
1
);
settingsValues
.
mSpacingAndPunctuations
,
mWordComposer
.
isComposingWord
()
?
2
:
1
);
if
(
DEBUG_COMMIT_TIMING
)
{
long
runTimeMillis
=
System
.
currentTimeMillis
()
-
startTimeMillis
;
Log
.
d
(
TAG
,
"commitChosenWord() : "
+
runTimeMillis
+
" ms to run "
+
"Connection.getNgramContextFromNthPreviousWord()"
);
Log
.
d
(
TAG
,
"commitChosenWord() : NgramContext = "
+
ngramContext
);
startTimeMillis
=
System
.
currentTimeMillis
();
}
mConnection
.
commitText
(
chosenWordWithSuggestions
,
1
);
mConnection
.
commitText
(
chosenWordWithSuggestions
,
1
);
if
(
DEBUG_COMMIT_TIMING
)
{
long
runTimeMillis
=
System
.
currentTimeMillis
()
-
startTimeMillis
;
Log
.
d
(
TAG
,
"commitChosenWord() : "
+
runTimeMillis
+
" ms to run "
+
"Connection.commitText"
);
startTimeMillis
=
System
.
currentTimeMillis
();
}
// Add the word to the user history dictionary
// Add the word to the user history dictionary
performAdditionToUserHistoryDictionary
(
settingsValues
,
chosenWord
,
ngramContext
);
performAdditionToUserHistoryDictionary
(
settingsValues
,
chosenWord
,
ngramContext
);
if
(
DEBUG_COMMIT_TIMING
)
{
long
runTimeMillis
=
System
.
currentTimeMillis
()
-
startTimeMillis
;
Log
.
d
(
TAG
,
"commitChosenWord() : "
+
runTimeMillis
+
" ms to run "
+
"performAdditionToUserHistoryDictionary()"
);
startTimeMillis
=
System
.
currentTimeMillis
();
}
// TODO: figure out here if this is an auto-correct or if the best word is actually
// TODO: figure out here if this is an auto-correct or if the best word is actually
// what user typed. Note: currently this is done much later in
// what user typed. Note: currently this is done much later in
// LastComposedWord#didCommitTypedWord by string equality of the remembered
// LastComposedWord#didCommitTypedWord by string equality of the remembered
// strings.
// strings.
mLastComposedWord
=
mWordComposer
.
commitWord
(
commitType
,
mLastComposedWord
=
mWordComposer
.
commitWord
(
commitType
,
chosenWordWithSuggestions
,
separatorString
,
ngramContext
);
chosenWordWithSuggestions
,
separatorString
,
ngramContext
);
if
(
DEBUG_COMMIT_TIMING
)
{
long
runTimeMillis
=
System
.
currentTimeMillis
()
-
startTimeMillis
;
Log
.
d
(
TAG
,
"commitChosenWord() : "
+
runTimeMillis
+
" ms to run "
+
"WordComposer.commitWord()"
);
startTimeMillis
=
System
.
currentTimeMillis
();
}
}
}
/**
/**
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment