Skip to content

Commit 0840b1b

Browse files
committed
Replace regex by regex-lite.
This can drastically improve the performance of regexes on smaller strings. For example: `limit(100000; repeat("--")) | match("^-="; "").string` takes about 0.9 seconds with `regex`, but only 0.3 seconds with `regex-lite`.
1 parent d9b91b8 commit 0840b1b

File tree

5 files changed

+10
-32
lines changed

5 files changed

+10
-32
lines changed

.github/workflows/msrv.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
working-directory: jaq-json
1818
run: cargo check
1919

20-
- uses: dtolnay/rust-toolchain@1.64
20+
- uses: dtolnay/rust-toolchain@1.65
2121
- name: Check jaq
2222
working-directory: jaq
2323
run: cargo check

Cargo.lock

Lines changed: 4 additions & 27 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

jaq-std/Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@ readme = "../README.md"
88
description = "Standard library for jaq"
99
repository = "https://github.com/01mf02/jaq"
1010
keywords = ["json", "query", "jq"]
11-
rust-version = "1.63"
11+
rust-version = "1.65"
1212

1313
[features]
1414
default = ["std", "format", "log", "math", "regex", "time"]
15+
regex = ["regex-lite"]
1516
std = []
1617
format = ["aho-corasick", "base64", "urlencoding"]
1718
math = ["libm"]
@@ -22,7 +23,7 @@ jaq-core = { version = "2.0.0-gamma", path = "../jaq-core" }
2223

2324
hifijson = { version = "0.2.0", optional = true }
2425
chrono = { version = "0.4.38", default-features = false, features = ["alloc"], optional = true }
25-
regex = { version = "1.9", optional = true }
26+
regex-lite = { version = "0.1", optional = true }
2627
log = { version = "0.4.17", optional = true }
2728
libm = { version = "0.2.7", optional = true }
2829
aho-corasick = { version = "1.0", optional = true }

jaq-std/src/regex.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
33
use alloc::string::{String, ToString};
44
use alloc::vec::Vec;
5-
use regex::{Error, Regex, RegexBuilder};
5+
use regex_lite::{self as regex, Error, Regex, RegexBuilder};
66

77
#[derive(Copy, Clone, Default)]
88
pub struct Flags {

jaq/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ description = "Just another JSON query tool"
99
repository = "https://github.com/01mf02/jaq"
1010
keywords = ["json", "query", "jq"]
1111
categories = ["command-line-utilities", "compilers", "parser-implementations"]
12-
rust-version = "1.64"
12+
rust-version = "1.65"
1313

1414
[features]
1515
default = ["mimalloc"]

0 commit comments

Comments
 (0)