Closed
Bug 902497
Opened 11 years ago
Closed 11 years ago
[sms][mms] use the new asynchronous getSegmentInfoText from bug 903403 for updateSmsSegmentLimit
Categories
(Firefox OS Graveyard :: Gaia::SMS, defect)
Tracking
(blocking-b2g:koi+)
RESOLVED
FIXED
blocking-b2g | koi+ |
People
(Reporter: julienw, Assigned: julienw)
References
Details
(Keywords: perf, Whiteboard: [u=commsapps-user c=messaging p=2 s=v1.2-features-sprint-3] [perf-reviewed])
Attachments
(1 file, 4 obsolete files)
47.23 KB,
patch
|
steveck
:
review+
|
Details | Diff | Splinter Review |
STR:
* start writing a SMS
* type quickly (for example use 3 fingers in the same time on the keyboard)
=> we notice a lag for displaying the characters in the input
We profiled this with Gabriele and we noticed that updateSmsSegmentLimit takes about 30% of the used time, because w call mozMobileMessage.getSegmentInfoForText which does synchronous IPC, which takes time.
I can see 2 potential solutions:
* getSegmentInfoForText is moved to the child process (as bug 896810 is trying to do for other things)
* if this proves to be too much work, we can add a timer in the Messages app to update the sms counter only 500ms after the last key.
So Gene, the first question is for you: do you think it's easy/difficult to move getSegmentInfoForText to the child process ?
Flags: needinfo?(gene.lian)
Comment 1•11 years ago
|
||
(Vicamo, please correct me if I'm wrong)
I think it's very hard to move the logic from parent process to child process because the calculation of getSegmentInfoForText() depends on:
1. |dom.sms.strict7BitEncoding| preference which can only be acquired in the parent process.
2. some RIL mapping tables like RIL.GSM_SMS_STRICT_7BIT_CHARMAP and RIL.PDU_NL_LOCKING_SHIFT_TABLES... etc, which are only available on the RIL, again, in the parent process.
The ordinary design of this API is expecting the input of the complete text, so it doesn't make sense to call it whenever one char is appended at the tail. I think we need to solve this issue at Gaia as suggested at comment #0.
Flags: needinfo?(gene.lian) → needinfo?(vyang)
Assignee | ||
Comment 2•11 years ago
|
||
(In reply to Gene Lian [:gene] from comment #1)
> 1. |dom.sms.strict7BitEncoding| preference which can only be acquired in the parent process.
When is this pref actually changed ? I think this could be cached somewhere anyway.
> The ordinary design of this API is expecting the input of the complete text,
> so it doesn't make sense to call it whenever one char is appended at the
> tail.
yes we need to call it so that we can display the character counter to the user (how much characters he can still type before sending another SMS).
But now I remember that you also need to call this function in the sending code, and therefore it's probably not a good idea to move it anyway.
> I think we need to solve this issue at Gaia as suggested at comment #0.
I wonder if we could try to be more clever in Gaia, ie detect when we would change the encoding and call the function only at that point. When we don't change the encoding (ie: the user added or removed a "normal" ascii character) we can probably do the calculation in Gaia. Therefore we would call the Gecko API only once in a while, when the user adds an extended ascii character.
This would probably work great for the latin alphabet but probably not for other alphabet. Could there be a way for the API to send us the "normal" alphabet for the current encoding ? Then when the user types something outside of the normal alphabet, we would call the API.
Comment 3•11 years ago
|
||
|getSegmentInfoForText| may have different behaviours in different backends. In Android backend, we don't have strict 7bit encoding. So moving this function to child process may cause mismatch in results of |getSegmentInfoForText| and |sendSMS| itself.
What about making it async?
Flags: needinfo?(vyang)
Comment 4•11 years ago
|
||
(In reply to Vicamo Yang [:vicamo][:vyang] from comment #3)
> What about making it async?
I think we'll do that. One of the ideas we were evaluating is to request the updated info from a timeout instead of synchronously. Every time the user types we might reset this timeout so the request kicks in only when there's a longer pause (say more than 500ms) instead of once for every typed key.
Comment 5•11 years ago
|
||
Fire bug 903409 to make getSegmentInfoForText() to be an asynchronous API on the Gecko side. Keep this bug open for Gaia.
Version: 22 Branch → Trunk
Comment 6•11 years ago
|
||
(In reply to Gene Lian [:gene] from comment #5)
> Fire bug 903409 to make getSegmentInfoForText() to be an asynchronous API
^^^^^^^^^^ Sorry, I mean bug 903403.
Assignee | ||
Updated•11 years ago
|
No longer blocks: move-apis-to-child
Component: DOM: Device Interfaces → Gaia::SMS
Product: Core → Boot2Gecko
Summary: [sms][mms] updateSmsSegmentLimit takes a long time when typing quickly → [sms][mms] use the new asynchronous updateSmsSegmentLimit from bug 903403
Version: Trunk → unspecified
Assignee | ||
Comment 7•11 years ago
|
||
Moved component and changed title then.
With the asynchronous updateSmsSegmentLimit, a small refactoring will need to be done in Gaia.
Assignee | ||
Updated•11 years ago
|
Assignee: nobody → felash
Assignee | ||
Updated•11 years ago
|
Whiteboard: [u=commsapps-user c=messaging p=2]
Updated•11 years ago
|
Whiteboard: [u=commsapps-user c=messaging p=2] → [u=commsapps-user c=messaging p=2 s=v1.2-features-sprint-3]
Updated•11 years ago
|
Whiteboard: [u=commsapps-user c=messaging p=2 s=v1.2-features-sprint-3] → [u=commsapps-user c=messaging p=2 s=v1.2-features-sprint-3] [fxos-perf-triaged]
Assignee | ||
Updated•11 years ago
|
Summary: [sms][mms] use the new asynchronous updateSmsSegmentLimit from bug 903403 → [sms][mms] use the new asynchronous getSegmentInfoText from bug 903403 for updateSmsSegmentLimit
Assignee | ||
Comment 9•11 years ago
|
||
this is a WIP
especially I'd like to not call the API if another one is still ongoing.
Assignee | ||
Comment 10•11 years ago
|
||
Or maybe just call it once every 500ms.
Assignee | ||
Comment 11•11 years ago
|
||
Github PR is https://github.com/mozilla-b2g/gaia/pull/11865
* we don't call getSegmentInfoForText more than once every 500ms
* getSegmentInfoForText is now asynchronous and the new code is handling this
* we now do the composeForm dataset type change in ThreadUI. As a result, the
"type" event, sent by Compose, is not cancelable anymore, because we don't use
this anymore.
---
apps/sms/js/compose.js | 12 +-
apps/sms/js/thread_ui.js | 97 +++++---
apps/sms/test/unit/compose_test.js | 29 ---
apps/sms/test/unit/mock_navigatormoz_sms.js | 72 ++++--
apps/sms/test/unit/thread_ui_test.js | 339 +++++++++++++++------------
5 files changed, 302 insertions(+), 247 deletions(-)
Asking review from both Steve (as a peer) and Rick (as someone who knows well some parts I change here). I'd like feedback from both before landing.
Attachment #797330 -
Attachment is obsolete: true
Attachment #797923 -
Flags: review?(waldron.rick)
Attachment #797923 -
Flags: review?(schung)
Comment 12•11 years ago
|
||
Sorry for the late review because of some personal affairs. I'll start reviewing and test it with both gecko/gaia patches.
Comment 13•11 years ago
|
||
Hi Julien, this patch looks ok at the first glance, but I need to wait for the building the gecko patch for verify(and it take looong time to builf it...). I left few comments on github but I will take a deep look later(and test after build ready).
If possible, could we have some unit test to verify the update mechanism works? Because it takes me a while to think if there is any possible senario that will make the updateCounterForSms failed to match the latset status after update timeout ;p
Assignee | ||
Comment 14•11 years ago
|
||
(In reply to Steve Chung [:steveck] from comment #13)
>
> If possible, could we have some unit test to verify the update mechanism
> works? Because it takes me a while to think if there is any possible senario
> that will make the updateCounterForSms failed to match the latset status
> after update timeout ;p
Yep of course I can do a unit test for this, I prepared the Mock to be able to do this but didn't use it :)
Thanks !
Assignee | ||
Comment 15•11 years ago
|
||
updated Github PR at https://github.com/mozilla-b2g/gaia/pull/11865
follow-up:
* remove a log
* add more tests
* made the explanation about the timeout clearer
Attachment #797923 -
Attachment is obsolete: true
Attachment #797923 -
Flags: review?(waldron.rick)
Attachment #797923 -
Flags: review?(schung)
Attachment #799096 -
Flags: review?(schung)
Attachment #799096 -
Flags: feedback?(waldron.rick)
Comment 16•11 years ago
|
||
Comment on attachment 799096 [details] [diff] [review]
patch v2
Review of attachment 799096 [details] [diff] [review]:
-----------------------------------------------------------------
Thnaks for the update and comments, it's very clear about the fixing and it work well after testing, I'm good with this patch except for the small concern about the request error here.
::: apps/sms/js/thread_ui.js
@@ +674,4 @@
>
> + var overLimit = segments > kMaxConcatenatedMessages;
> + callback(overLimit);
> + }).bind(this);
Not sure if any situation will cause the getSegmentInfoForText return error callback. Maybe it's rare case, but how about having a onerror callback function and hide the counter?
Assignee | ||
Comment 17•11 years ago
|
||
Addressed the comment: added an onerror handler and added a test about this.
Updated Github PR at https://github.com/mozilla-b2g/gaia/pull/11865
thanks !
Attachment #799096 -
Attachment is obsolete: true
Attachment #799096 -
Flags: review?(schung)
Attachment #799096 -
Flags: feedback?(waldron.rick)
Attachment #799381 -
Flags: review?(schung)
Assignee | ||
Comment 18•11 years ago
|
||
Sorry Steve, I saw the log was back for some reason, so here another patch with the log removed.
The Github PR is updated https://github.com/mozilla-b2g/gaia/pull/11865
Attachment #799381 -
Attachment is obsolete: true
Attachment #799381 -
Flags: review?(schung)
Attachment #799384 -
Flags: review?(schung)
Comment 19•11 years ago
|
||
Comment on attachment 799384 [details] [diff] [review]
patch v4
Looks great, Thanks!
BTW, Travis failed on one error in message app, but it looks unrelated to this patch(and it shows green light in my local).
Attachment #799384 -
Flags: review?(schung) → review+
Updated•11 years ago
|
Keywords: checkin-needed
Updated•11 years ago
|
Status: NEW → ASSIGNED
Whiteboard: [u=commsapps-user c=messaging p=2 s=v1.2-features-sprint-3] [fxos-perf-triaged] → [u=commsapps-user c=messaging p=2 s=v1.2-features-sprint-3] [perf-reviewed]
Comment 20•11 years ago
|
||
You need to log in
before you can comment on or make changes to this bug.
Description
•