WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
97237
[WebSocket] Receiving a large message is really slow
https://bugs.webkit.org/show_bug.cgi?id=97237
Summary
[WebSocket] Receiving a large message is really slow
evan.exe
Reported
2012-09-20 10:52:41 PDT
It takes around 6 seconds for WebKit to receive single a 5 MB message over a WebSocket on localhost. It takes Firefox around 0.125 seconds in comparison. The test code is available at
https://gist.github.com/3753757/
. I looked into it and from what I can tell, WebSocketChannel is receiving data from the socket in 1 KB increments and reallocating its entire buffer every time to store each new increment.
Attachments
Vector<char> instead of char array in WebSocketChannel
(12.06 KB, patch)
2012-09-20 16:35 PDT
,
evan.exe
no flags
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
evan.exe
Comment 1
2012-09-20 16:35:56 PDT
Created
attachment 165008
[details]
Vector<char> instead of char array in WebSocketChannel
Alexey Proskuryakov
Comment 2
2012-09-21 10:00:31 PDT
Comment on
attachment 165008
[details]
Vector<char> instead of char array in WebSocketChannel View in context:
https://bugs.webkit.org/attachment.cgi?id=165008&action=review
Looks great to me. Marking r+ for now, will cq+ once EWS reports success. In the future, please do mark patches r? and cq? as appropriate, so that they are visible in review queue.
> Source/WebCore/Modules/websockets/WebSocketChannel.cpp:394 > + LOG(Network, "WebSocket buffer overflow (%lu+%lu)", static_cast<unsigned long>(m_buffer.size()), static_cast<unsigned long>(len));
Not related to this patch at all, but: this is a runtime condition, and should be logged to developer console, not to a debug channel.
> Source/WebCore/Modules/websockets/WebSocketChannel.cpp:405 > + memmove(m_buffer.data(), m_buffer.data() + len, m_buffer.size() - len); > + m_buffer.resize(m_buffer.size() - len);
This looks suspicious. We are still doing lots of unnecessary copying. You could have used Vector::remove() here - not that it would have improved performance characteristics, but it would be one line instead of three.
WebKit Review Bot
Comment 3
2012-09-21 10:28:02 PDT
Comment on
attachment 165008
[details]
Vector<char> instead of char array in WebSocketChannel Clearing flags on attachment: 165008 Committed
r129239
: <
http://trac.webkit.org/changeset/129239
>
WebKit Review Bot
Comment 4
2012-09-21 10:28:05 PDT
All reviewed patches have been landed. Closing bug.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug