Bug 167324 - Maintain ordering when doing speculative loads
Summary: Maintain ordering when doing speculative loads
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Page Loading (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2017-01-23 14:26 PST by Antti Koivisto
Modified: 2017-02-01 06:02 PST (History)
5 users (show)

See Also:


Attachments
patch (7.73 KB, patch)
2017-01-23 14:31 PST, Antti Koivisto
cdumez: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Antti Koivisto 2017-01-23 14:26:30 PST
Currently we randomize the ordering of speculative loads because they are serialized as a hash map. It would be better to load in the same order as the requests were originally issued as that is likely to match the order the document needs them.
Comment 1 Antti Koivisto 2017-01-23 14:31:35 PST
Created attachment 299539 [details]
patch
Comment 2 Chris Dumez 2017-01-23 14:53:33 PST
Comment on attachment 299539 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=299539&action=review

r=me

> Source/WebKit2/NetworkProcess/cache/NetworkCacheSubresourcesEntry.cpp:109
> +    Vector<SubresourceInfo> result;

I think we should reserveInitialCapacity() and uncheckedAppend() since we know there will be at most subresourceLoads.size() items and the common case will be subresourceLoads.size() items.

> Source/WebKit2/NetworkProcess/cache/NetworkCacheSubresourcesEntry.h:49
> +        , m_requestHeaders(request.httpHeaderFields())

It is a bit unfortunate that we are now copying those HashMaps for transient resources too now. I hope this does not show on PLT.
Comment 3 Antti Koivisto 2017-01-23 17:39:00 PST
https://trac.webkit.org/changeset/211068
Comment 4 Darin Adler 2017-01-23 18:02:28 PST
Comment on attachment 299539 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=299539&action=review

>> Source/WebKit2/NetworkProcess/cache/NetworkCacheSubresourcesEntry.cpp:109
>> +    Vector<SubresourceInfo> result;
> 
> I think we should reserveInitialCapacity() and uncheckedAppend() since we know there will be at most subresourceLoads.size() items and the common case will be subresourceLoads.size() items.

The patch landed with a call to reserveCapacity/append, but reserveInitialCapacity/uncheckedAppend are more efficient.
Comment 5 Antti Koivisto 2017-01-23 21:36:58 PST
Oops!
Comment 6 Antti Koivisto 2017-01-23 22:03:30 PST
Did that in https://trac.webkit.org/r211076
Comment 7 Radar WebKit Bug Importer 2017-02-01 06:02:02 PST
<rdar://problem/30306314>