Mercurial > hg
view contrib/merge-lists/Cargo.toml @ 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 | 681b25ea579e |
children | 337bc83c1275 |
line wrap: on
line source
# A tool that performs a 3-way merge, resolving conflicts in sorted lists and # leaving other conflicts unchanged. This is useful with Mercurial's support # for partial merge tools (configured in `[partial-merge-tools]`). [package] name = "merge-lists" version = "0.1.0" edition = "2021" # We need https://github.com/rust-lang/rust/pull/89825 rust-version = "1.59" [dependencies] clap = { version = "3.1.6", features = ["derive"] } itertools = "0.10.3" regex = "1.5.5" similar = { version="2.1.0", features = ["bytes"] } [dev-dependencies] assert_cmd = "2.0.4" insta = "1.13.0" tempdir = "0.3.7"