Skip to content

Performance regression in gix-blame #2148

@Byron

Description

@Byron

gix blame on tag gix-blame-v0.1.0 is much faster than on main. The main difference is the usage of zlib-ng than zlib-rs.

❯ hyperfine './gix-main blame README.md' './gix-0.1 blame README.md' 'git blame README.md'
Benchmark 1: ./gix-main blame README.md
  Time (mean ± σ):     157.4 ms ±   0.6 ms    [User: 149.5 ms, System: 5.9 ms]
  Range (min … max):   156.1 ms … 158.4 ms    18 runs

Benchmark 2: ./gix-0.1 blame README.md
  Time (mean ± σ):      50.9 ms ±   0.5 ms    [User: 41.7 ms, System: 6.9 ms]
  Range (min … max):    50.0 ms …  52.6 ms    56 runs

Benchmark 3: git blame README.md
  Time (mean ± σ):      52.1 ms ±   0.7 ms    [User: 43.7 ms, System: 6.3 ms]
  Range (min … max):    49.9 ms …  53.2 ms    54 runs

Summary
  ./gix-0.1 blame README.md ran
    1.02 ± 0.02 times faster than git blame README.md
    3.10 ± 0.03 times faster than ./gix-main blame README.md

gix-blame.trace.zip

Image Image

Before we jump to conclusions, I may also note that this could be related to the object caching being less effective or disabled for some reason. Also, the traversal algorithm changed and maybe it does more work.

Maybe a good first check would be to bring back zlib-ng for a test-run on main.

diff --git a/gix-features/Cargo.toml b/gix-features/Cargo.toml
index a955c1f2f0..7996f9d7fe 100644
--- a/gix-features/Cargo.toml
+++ b/gix-features/Cargo.toml
@@ -121,7 +121,7 @@ bytesize = { version = "2.0.1", optional = true }
 bytes = { version = "1.0.0", optional = true }
 
 # zlib module
-flate2 = { version = "1.1.1", optional = true, default-features = false, features = ["zlib-rs"] }
+flate2 = { version = "1.1.1", optional = true, default-features = false, features = ["zlib-ng"] }
 thiserror = { version = "2.0.0", optional = true }
 
 once_cell = { version = "1.21.3", optional = true }
Image

Turns out that zlib-ng is slower than zlib-rs, and that the ZLIB backend is only hit more in main, it's not slower.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions