mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-22 02:52:52 +00:00
WebDriver: Do not break WebDriver responses into multiple socket writes
WPT uses Python's http.client.HTTPConnection to send/receive WebDriver messages. For some reason, on Linux, we see an ~0.04s delay between the WPT server receiving the WebDriver response headers and its body. There are tests which make north of 1100 of these requests, which adds up to ~44s. These connections are almost always going to be over localhost and able the be sent in a single write. So let's send the response all at once. On my Linux machine, this reduces the runtime of /cookies/name/name.html from 45-60s down to 3-4s.
This commit is contained in:
parent
9765a733d0
commit
e5877cda61
Notes:
github-actions[bot]
2024-09-24 22:44:19 +00:00
Author: https://github.com/trflynn89
Commit: e5877cda61
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1516
Reviewed-by: https://github.com/tcl3 ✅
1 changed files with 2 additions and 7 deletions
|
@ -303,14 +303,9 @@ ErrorOr<void, Client::WrappedError> Client::send_success_response(JsonValue resu
|
|||
builder.append("Content-Type: application/json; charset=utf-8\r\n"sv);
|
||||
builder.appendff("Content-Length: {}\r\n", content.length());
|
||||
builder.append("\r\n"sv);
|
||||
builder.append(content);
|
||||
|
||||
auto builder_contents = TRY(builder.to_byte_buffer());
|
||||
TRY(m_socket->write_until_depleted(builder_contents));
|
||||
|
||||
while (!content.is_empty()) {
|
||||
auto bytes_sent = TRY(m_socket->write_some(content.bytes()));
|
||||
content = content.substring_view(bytes_sent);
|
||||
}
|
||||
TRY(m_socket->write_until_depleted(builder.string_view()));
|
||||
|
||||
if (!keep_alive)
|
||||
die();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue