Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: faster prefix record deser #777

Merged
merged 9 commits into from
Jul 12, 2024

Conversation

nichmor
Copy link
Contributor

@nichmor nichmor commented Jul 11, 2024

based on this blog https://blog.datalust.co/deserializing-json-really-fast/ I've tried to choose simd_json for our deserialization to PrefixRecord as it seems that it has a lot of samples in the flamegraph
image

In the benchmarks, having 42 JSON files in the conda_meta folder and using simd_json will give us the following results:

process_json_files      time:   [9.2815 ms 9.3741 ms 9.4924 ms]
Found 7 outliers among 100 measurements (7.00%)
5 (5.00%) high mild
2 (2.00%) high severe

using old way:

process_json_files      time:   [9.7586 ms 9.8881 ms 10.041 ms]
change: [+3.5487% +5.4835% +7.3793%] (p = 0.00 < 0.05)
Performance has regressed.

We can see an increase of +5.4835%

Cargo.toml Show resolved Hide resolved
@nichmor nichmor changed the title experiment: faster prefix record deser perf: faster prefix record deser Jul 12, 2024
@nichmor nichmor marked this pull request as ready for review July 12, 2024 08:54
@@ -23,6 +23,7 @@ purl = { workspace = true, features = ["serde"] }
rattler_digest = { path = "../rattler_digest", version = "0.19.4", default-features = false, features = ["serde"] }
rattler_macros = { path = "../rattler_macros", version = "0.19.4", default-features = false }
regex = { workspace = true }
simd-json = { version = "*", features = ["serde_impl"]}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a minimal version here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

made this workspace=true and added simd-json in root Cargo.toml

crates/rattler_conda_types/src/prefix_record.rs Outdated Show resolved Hide resolved
@Hofer-Julian
Copy link
Collaborator

I pushed a commit that removes the unsafe usage: 11c8600

@baszalmstra baszalmstra merged commit d619dcd into conda:main Jul 12, 2024
15 checks passed
@baszalmstra baszalmstra mentioned this pull request Jul 12, 2024
baszalmstra added a commit that referenced this pull request Jul 15, 2024
## 🤖 New release
* `file_url`: 0.1.2 -> 0.1.3
* `rattler`: 0.26.5 -> 0.27.0
* `rattler_cache`: 0.1.1 -> 0.1.2
* `rattler_conda_types`: 0.26.0 -> 0.26.1
* `rattler_digest`: 0.19.4 -> 0.19.5
* `rattler_package_streaming`: 0.21.4 -> 0.21.5
* `rattler_networking`: 0.20.9 -> 0.20.10
* `rattler_shell`: 0.21.0 -> 0.21.1
* `rattler_lock`: 0.22.13 -> 0.22.14
* `rattler_repodata_gateway`: 0.21.0 -> 0.21.1
* `rattler_solve`: 0.25.0 -> 0.25.1
* `rattler_libsolv_c`: 0.19.4 -> 0.19.5
* `rattler_virtual_packages`: 0.19.16 -> 0.19.17
* `rattler_index`: 0.19.18 -> 0.19.19

<details><summary><i><b>Changelog</b></i></summary><p>

## `file_url`
<blockquote>

##
[0.1.3](file_url-v0.1.2...file_url-v0.1.3)
- 2024-07-15

### Other
- update Cargo.toml dependencies
</blockquote>

## `rattler`
<blockquote>

##
[0.27.0](rattler-v0.26.5...rattler-v0.27.0)
- 2024-07-15

### Fixed
- unclobber issue when packages are named differently
([#776](#776))

### Other
- bump dependencies and remove unused ones
([#771](#771))
</blockquote>

## `rattler_cache`
<blockquote>

##
[0.1.2](rattler_cache-v0.1.1...rattler_cache-v0.1.2)
- 2024-07-15

### Other
- bump dependencies and remove unused ones
([#771](#771))
</blockquote>

## `rattler_conda_types`
<blockquote>

##
[0.26.1](rattler_conda_types-v0.26.0...rattler_conda_types-v0.26.1)
- 2024-07-15

### Other
- PrefixRecord deserialization using simd
([#777](#777))
</blockquote>

## `rattler_digest`
<blockquote>

##
[0.19.5](rattler_digest-v0.19.4...rattler_digest-v0.19.5)
- 2024-07-15

### Other
- bump dependencies and remove unused ones
([#771](#771))
</blockquote>

## `rattler_package_streaming`
<blockquote>

##
[0.21.5](rattler_package_streaming-v0.21.4...rattler_package_streaming-v0.21.5)
- 2024-07-15

### Other
- bump zip to 2.1.3
([#772](#772))
</blockquote>

## `rattler_networking`
<blockquote>

##
[0.20.10](rattler_networking-v0.20.9...rattler_networking-v0.20.10)
- 2024-07-15

### Other
- bump dependencies and remove unused ones
([#771](#771))
</blockquote>

## `rattler_shell`
<blockquote>

##
[0.21.1](rattler_shell-v0.21.0...rattler_shell-v0.21.1)
- 2024-07-15

### Other
- update Cargo.toml dependencies
</blockquote>

## `rattler_lock`
<blockquote>

##
[0.22.14](rattler_lock-v0.22.13...rattler_lock-v0.22.14)
- 2024-07-15

### Other
- bump dependencies and remove unused ones
([#771](#771))
</blockquote>

## `rattler_repodata_gateway`
<blockquote>

##
[0.21.1](rattler_repodata_gateway-v0.21.0...rattler_repodata_gateway-v0.21.1)
- 2024-07-15

### Other
- bump dependencies and remove unused ones
([#771](#771))
</blockquote>

## `rattler_solve`
<blockquote>

##
[0.25.1](rattler_solve-v0.25.0...rattler_solve-v0.25.1)
- 2024-07-15

### Other
- update Cargo.toml dependencies
</blockquote>

## `rattler_libsolv_c`
<blockquote>

##
[0.19.5](rattler_libsolv_c-v0.19.4...rattler_libsolv_c-v0.19.5)
- 2024-07-15

### Other
- bump dependencies and remove unused ones
([#771](#771))
</blockquote>

## `rattler_virtual_packages`
<blockquote>

##
[0.19.17](rattler_virtual_packages-v0.19.16...rattler_virtual_packages-v0.19.17)
- 2024-07-15

### Other
- updated the following local packages: rattler_conda_types
</blockquote>

## `rattler_index`
<blockquote>

##
[0.19.19](rattler_index-v0.19.18...rattler_index-v0.19.19)
- 2024-07-15

### Other
- updated the following local packages: rattler_conda_types,
rattler_digest, rattler_package_streaming
</blockquote>


</p></details>

---
This PR was generated with
[release-plz](https://github.com/MarcoIeni/release-plz/).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants