Mercurial > hg
view tests/phabricator/phab-conduit.json @ 50400:95acba2c29f6
encoding: avoid quadratic time complexity when json-encoding non-UTF8 strings
Apparently the code uses "+=" with a bytes object, which is linear-time, so the
whole encoding is quadratic-time. This patch makes us use a bytearray object,
instead, which has a(n amortized-)constant-time append operation.
The encoding is still not particularly fast, but at least a 10MB file
takes tens of seconds, not many hours to encode.
author | Arseniy Alekseyev <aalekseyev@janestreet.com> |
---|---|
date | Mon, 06 Mar 2023 11:27:57 +0000 |
parents | a5e3f38407cb |
children |
line wrap: on
line source
{ "interactions": [ { "response": { "headers": { "x-content-type-options": [ "nosniff" ], "x-xss-protection": [ "1; mode=block" ], "content-type": [ "application/json" ], "transfer-encoding": [ "chunked" ], "strict-transport-security": [ "max-age=0; includeSubdomains; preload" ], "date": [ "Fri, 17 Jan 2020 00:32:52 GMT" ], "cache-control": [ "no-store" ], "expires": [ "Sat, 01 Jan 2000 00:00:00 GMT" ], "server": [ "Apache/2.4.10 (Debian)" ], "x-frame-options": [ "Deny" ], "referrer-policy": [ "no-referrer" ] }, "status": { "code": 200, "message": "OK" }, "body": { "string": "{\"result\":{\"data\":[],\"maps\":{},\"query\":{\"queryKey\":null},\"cursor\":{\"limit\":100,\"after\":null,\"before\":null,\"order\":null}},\"error_code\":null,\"error_info\":null}" } }, "request": { "method": "POST", "uri": "https://phab.mercurial-scm.org//api/user.search", "headers": { "content-type": [ "application/x-www-form-urlencoded" ], "user-agent": [ "mercurial/proto-1.0 (Mercurial 5.2.2+620-6ee2ba170fe6+20200116)" ], "accept": [ "application/mercurial-0.1" ], "content-length": [ "169" ], "host": [ "phab.mercurial-scm.org" ] }, "body": "params=%7B%22__conduit__%22%3A+%7B%22token%22%3A+%22cli-hahayouwish%22%7D%2C+%22constraints%22%3A+%7B%22isBot%22%3A+true%7D%7D&output=json&__conduit__=1" } } ], "version": 1 }