Closed Bug 1130317 Opened 5 years ago Closed 5 years ago

[UserDictionary] Pre-determine dict blob total byte length before building the blob

Categories

(Firefox OS Graveyard :: Gaia::Keyboard, defect)

ARM
Gonk (Firefox OS)
defect
Not set

Tracking

(Not tracked)

RESOLVED FIXED
2.2 S6 (20feb)

People

(Reporter: mnjul, Assigned: mnjul)

References

Details

(Whiteboard: [p=1])

Attachments

(1 file)

In bug 1102834's user dictionary blob generation, the blob array grows dynamically as each byte is push()'ed into the array, which is later converted to a typed array. However, it should be possible that we pre-determine the length of the blob array and allocate a typed array of specific size and fill in the bytes directly on the typed array. We should investigate the possibility.
* For better performance, for sure.
On this. Target Milestone is set to S7 because S6's end-date is Chinese New Year.
Assignee: nobody → jlu
Target Milestone: --- → 2.2 S7 (6mar)
Whiteboard: [p=1]
Will request for review after testing is good.
Status: NEW → ASSIGNED
(In reply to John Lu [:mnjul] [MoCoTPE] from comment #1)
> * For better performance, for sure.

A very rough JSPerf: http://jsperf.com/typed-array-push-or-predetermined
Comment on attachment 8561210 [details] [review]
[PullReq] mnjul:bug_1130317_dict_blob_predetermine_length to mozilla-b2g:master

Tim,

Please check out the patch. The rationale behind this is pretty simple. No tests were modified as we blackbox-test WordListConverter, and its internal performance improvement patch should, of course, not have an impact on blob end-result.

Thanks!
Attachment #8561210 - Flags: review?(timdream)
Attachment #8561210 - Flags: review?(timdream) → review+
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: 2.2 S7 (6mar) → 2.2 S6 (20feb)
You need to log in before you can comment on or make changes to this bug.