Closed
Bug 811683
Opened 13 years ago
Closed 13 years ago
[b2g-bluetooth] Use given 'max packet size' instead of 255
Categories
(Core :: DOM: Device Interfaces, defect)
Tracking
()
People
(Reporter: echou, Assigned: echou)
References
Details
(Whiteboard: [LOE:S])
Attachments
(2 files, 4 obsolete files)
6.20 KB,
patch
|
cjones
:
review+
bajaj
:
approval-mozilla-aurora+
bajaj
:
approval-mozilla-b2g18+
|
Details | Diff | Splinter Review |
3.99 KB,
patch
|
gyeh
:
review+
bajaj
:
approval-mozilla-aurora+
bajaj
:
approval-mozilla-b2g18+
|
Details | Diff | Splinter Review |
Most of the times, before a file transferring process starts, two devices would exchange information via CONNECT request and response. According to OBEX spec, we can get "maximum OBEX packet length" from the packet, and this value should be used to optimize the speed of sending file. In current codebase, we use the minimum packet size 255 bytes for one packet, apparently we need some improvement.
Assignee | ||
Updated•13 years ago
|
Comment 1•13 years ago
|
||
Hey Eric,
It's hard to know if we would block shipping v.1 for this bug. For that reason, we are minusing. If you disagree, please renom and included rationale. If you have patches that you'd like to uplift, you can request that on the patch itself.
blocking-basecamp: ? → -
Assignee | ||
Comment 2•13 years ago
|
||
Rationale for blocking+: From the result of my test, for current codebase, it took about 3 min and 45 seconds to send a 3.91MB music file to my HTC phone. On the other hand, when this patch was applied, it took only 38 seconds. In my opinion, this is a necessary optimization and the patch does not change the logic too much, which means it's a quite low-risk change.
* Kyle, please help to review UnixSocket.h. I increased the value of MAX_DATA_SIZE because the original value (1KB) was not enough for OPP to send a MB-level file.
* Gina, please help to review BluetoothOppManager.cpp
Thanks in advance.
Attachment #681847 -
Flags: review?(kyle)
Attachment #681847 -
Flags: review?(gyeh)
Assignee | ||
Comment 3•13 years ago
|
||
Rationale for blocking+: From the result of my test, for current codebase, it took about 3 min and 45 seconds to send a 3.91MB music file to my HTC phone. On the other hand, when this patch was applied, it took only 38 seconds. In my opinion, this is a necessary optimization and the patch does not change the logic too much, which means it's a quite low-risk change.
blocking-basecamp: - → ?
Comment 4•13 years ago
|
||
During triage we agreed that we want to have performance fixes like this. However, slow transfer via bluetooth will not block the release. If this is indeed safe fix, please request Aurora uplift.
blocking-basecamp: ? → -
Comment 5•13 years ago
|
||
Comment on attachment 681847 [details] [diff] [review]
patch 1: v1: used packet size as large as possible
Review of attachment 681847 [details] [diff] [review]:
-----------------------------------------------------------------
::: ipc/unixsocket/UnixSocket.h
@@ +18,4 @@
>
> struct UnixSocketRawData
> {
> + static const size_t MAX_DATA_SIZE = 65535;
Wouldn't it be better to have this passed as an argument in a constructor. Otherwise this change will affect all users.
Assignee | ||
Comment 6•13 years ago
|
||
(In reply to Dave Hylands [:dhylands] from comment #5)
> Comment on attachment 681847 [details] [diff] [review]
> patch 1: v1: used packet size as large as possible
>
> Review of attachment 681847 [details] [diff] [review]:
> -----------------------------------------------------------------
>
> ::: ipc/unixsocket/UnixSocket.h
> @@ +18,4 @@
> >
> > struct UnixSocketRawData
> > {
> > + static const size_t MAX_DATA_SIZE = 65535;
>
> Wouldn't it be better to have this passed as an argument in a constructor.
> Otherwise this change will affect all users.
It would be a little strange if we have to decide MAX_DATA_SIZE every time we need an UnixSocketRawData object. My suggestion would be using nsAutoPtr<uint8_t> to keep mData, however this part was implemented by Kyle, he must have better idea than me about how to implement. :)
Comment 7•13 years ago
|
||
Comment on attachment 681847 [details] [diff] [review]
patch 1: v1: used packet size as large as possible
Review of attachment 681847 [details] [diff] [review]:
-----------------------------------------------------------------
I'm in agreement with dhylands on this one. MAX_DATA_SIZE is a holdover from the stuff I brought in when we did the RIL, which we knew would be small packets. For someone more variable that could generate TONS of packets, it'd be nice to have a variable max size, especially if we use this on the phone where we don't want to blow up the process with 64k blocks for 16 byte messages.
It /might/ be worth combining the UnixSocketRawData structure creation into the UnixSocket, so you could define the data size with the socket versus per packet? Lemme know your thoughts. If you agree with this, bug it to me unless you want to implement it. :)
Attachment #681847 -
Flags: review?(kyle)
Assignee | ||
Comment 8•13 years ago
|
||
Hey Kyle,
Sorry for the late reply.
>
> I'm in agreement with dhylands on this one. MAX_DATA_SIZE is a holdover from
> the stuff I brought in when we did the RIL, which we knew would be small
> packets. For someone more variable that could generate TONS of packets, it'd
> be nice to have a variable max size, especially if we use this on the phone
> where we don't want to blow up the process with 64k blocks for 16 byte
> messages.
>
Yes, I know the point. I don't like the idea of creating 64k buffer for a small packet, either. However, do we really need to pass a value of 'MAX_DATA_SIZE' into ctor every time while creating an UnixSocketRawData object? MAX_DATA_SIZE sounds like to be a constant value indicating the limit of low-level implementation. :|
> It /might/ be worth combining the UnixSocketRawData structure creation into
> the UnixSocket, so you could define the data size with the socket versus per
> packet? Lemme know your thoughts. If you agree with this, bug it to me
> unless you want to implement it. :)
Sounds good. It would be nice if you could help on the implementation since you know more than me about how it should go. :)
I'm thinking that we can just use this bug since it's related, so re-assign it to you, and please assign it back to me once your part is done. Feel free to change it if it's not appropriate.
Eric
Assignee: echou → kyle
Comment 9•13 years ago
|
||
(In reply to Eric Chou [:ericchou] [:echou] from comment #8)
> Sorry for the late reply.
Hah, I spent some time trying to find this bug today, so thanks for making it come up in my bug mail. :)
> >
> > I'm in agreement with dhylands on this one. MAX_DATA_SIZE is a holdover from
> > the stuff I brought in when we did the RIL, which we knew would be small
> > packets. For someone more variable that could generate TONS of packets, it'd
> > be nice to have a variable max size, especially if we use this on the phone
> > where we don't want to blow up the process with 64k blocks for 16 byte
> > messages.
> >
>
> Yes, I know the point. I don't like the idea of creating 64k buffer for a
> small packet, either. However, do we really need to pass a value of
> 'MAX_DATA_SIZE' into ctor every time while creating an UnixSocketRawData
> object? MAX_DATA_SIZE sounds like to be a constant value indicating the
> limit of low-level implementation. :|
Yeah, honestly the "single size for everything" idea is a bit obtuse, and I haven't really seen anyone else do it (nor can I remember why I kept thinking we should, but I haven't looked at the code in a couple of weeks). We should be able to just read and write as much as you want per RawData object, just means the RawData object gets a bit more complex, but nothing we can't deal with.
> Sounds good. It would be nice if you could help on the implementation since
> you know more than me about how it should go. :)
Cool, was why I was trying to find this bug in the first place. I'll go ahead and handle this. :)
Comment 10•13 years ago
|
||
Tagging cjones on this for UnixSocket review, echou for OPP review.
Attachment #689569 -
Flags: review?(jones.chris.g)
Updated•13 years ago
|
Attachment #689569 -
Flags: review?(echou)
Comment 11•13 years ago
|
||
Attachment #689569 -
Attachment is obsolete: true
Attachment #689569 -
Flags: review?(jones.chris.g)
Attachment #689569 -
Flags: review?(echou)
Attachment #689572 -
Flags: review?(jones.chris.g)
Updated•13 years ago
|
Attachment #689572 -
Flags: review?(echou)
Comment 12•13 years ago
|
||
New patch version because I forgot to set UnixSocketRawData's data to delete[] properly. :(
Comment 13•13 years ago
|
||
In which I /actually/ change that type I meant to last time but forgot my -a and just did git commit --amend. Go me.
Attachment #689572 -
Attachment is obsolete: true
Attachment #689572 -
Flags: review?(jones.chris.g)
Attachment #689572 -
Flags: review?(echou)
Attachment #689579 -
Flags: review?(jones.chris.g)
Updated•13 years ago
|
Attachment #689579 -
Flags: review?(echou)
Assignee | ||
Comment 14•13 years ago
|
||
Comment on attachment 689579 [details] [diff] [review]
Patch 2 (V3) - Make sockets take variable sizes, fix opp types
Review of attachment 689579 [details] [diff] [review]:
-----------------------------------------------------------------
The part of OPP looks good to me. Thanks for fixing it.
Attachment #689579 -
Flags: review?(echou) → review+
Comment on attachment 689579 [details] [diff] [review]
Patch 2 (V3) - Make sockets take variable sizes, fix opp types
>diff --git a/ipc/unixsocket/UnixSocket.h b/ipc/unixsocket/UnixSocket.h
>+ static const size_t MAX_DATA_SIZE = 0xFFFF;
ITYM 1 << 16?
>+ nsAutoArrayPtr<uint8_t> mData;
Use nsAutoTArray<int8_t, DEFAULT> with a well-chosen default (1024?)
if possible. This makes the common case faster the and the uncommon
case safer.
I don't understand this patch too well but lmk if this makes sense.
Attachment #689579 -
Flags: review?(jones.chris.g)
Comment 16•13 years ago
|
||
I removed the default no-arguments constructor so that size input is required. Main reason for doing this is so we can support bigger packet sizes for bluetooth.
And changed hex to bit shift. Habit. :)
Attachment #689579 -
Attachment is obsolete: true
Attachment #689808 -
Flags: review?(jones.chris.g)
Updated•13 years ago
|
Attachment #689808 -
Flags: review?(jones.chris.g) → review+
Comment 17•13 years ago
|
||
Kicking this back to echou since patch 1 needs to be updated (remove unixsocket change) and r+'d by gyeh.
Assignee: kyle → echou
Assignee | ||
Comment 18•13 years ago
|
||
* Increased the speed of file sharing, not used 255 (the minimum packet size) anymore.
Attachment #681847 -
Attachment is obsolete: true
Attachment #681847 -
Flags: review?(gyeh)
Attachment #690192 -
Flags: review?(gyeh)
Comment 19•13 years ago
|
||
Comment on attachment 690192 [details] [diff] [review]
patch 1: v2: use max packet size given by remote device for file sharing
Review of attachment 690192 [details] [diff] [review]:
-----------------------------------------------------------------
Looks good, r=me.
Attachment #690192 -
Flags: review?(gyeh) → review+
Assignee | ||
Comment 20•13 years ago
|
||
Assignee | ||
Comment 21•13 years ago
|
||
Comment 22•13 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/216d556025d1
https://hg.mozilla.org/mozilla-central/rev/14a7b73eb421
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla20
Assignee | ||
Comment 23•13 years ago
|
||
Comment on attachment 689808 [details] [diff] [review]
Patch 2 (V4) - Make sockets take variable sizes, fix opp types
[Approval Request Comment]
Bug caused by (feature/regressing bug #): no
User impact if declined: very slow file-sending process
Testing completed (on m-c, etc.): on m-c and by myself
Risk to taking this patch (and alternatives if risky): No. I've tested file transferring for several days and can confirm that no regression is caused by both patches.
String or UUID changes made by this patch: no
Please see comment 3 for more details about the impact if declined.
Attachment #689808 -
Flags: approval-mozilla-b2g18?
Attachment #689808 -
Flags: approval-mozilla-aurora?
Assignee | ||
Comment 24•13 years ago
|
||
Comment on attachment 690192 [details] [diff] [review]
patch 1: v2: use max packet size given by remote device for file sharing
[Approval Request Comment]
Bug caused by (feature/regressing bug #): no
User impact if declined: very slow file-sending process
Testing completed (on m-c, etc.): on m-c and by myself
Risk to taking this patch (and alternatives if risky): No. I've tested file transferring for several days and can confirm that no regression is caused by both patches.
String or UUID changes made by this patch: no
Please see comment 3 for more details about the impact if declined.
Attachment #690192 -
Flags: approval-mozilla-b2g18?
Attachment #690192 -
Flags: approval-mozilla-aurora?
Comment 25•13 years ago
|
||
Comment on attachment 689808 [details] [diff] [review]
Patch 2 (V4) - Make sockets take variable sizes, fix opp types
low risk change for a perf win, based on bug comment#3 #4.Approving on aurora/b2g18 .
Attachment #689808 -
Flags: approval-mozilla-b2g18?
Attachment #689808 -
Flags: approval-mozilla-b2g18+
Attachment #689808 -
Flags: approval-mozilla-aurora?
Attachment #689808 -
Flags: approval-mozilla-aurora+
Updated•13 years ago
|
Attachment #690192 -
Flags: approval-mozilla-b2g18?
Attachment #690192 -
Flags: approval-mozilla-b2g18+
Attachment #690192 -
Flags: approval-mozilla-aurora?
Attachment #690192 -
Flags: approval-mozilla-aurora+
Comment 26•13 years ago
|
||
You need to log in
before you can comment on or make changes to this bug.
Description
•