Skip to content

Commit 10b3be1

Browse files
authored
feat: performance improvement + bug fixes to conform with the openxml… (#41)
* feat: performance improvement + bug fixes to conform with the openxml sdk better Release-As: 0.7.0
1 parent 4d51021 commit 10b3be1

28 files changed

Lines changed: 10444 additions & 626 deletions

Cargo.toml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,23 @@ readme = "README.md"
1111
name = "jetxl"
1212
crate-type = ["cdylib"]
1313

14+
[features]
15+
# Opt-in: use libdeflate (via the `libdeflater` crate) instead of miniz_oxide
16+
# for DEFLATE compression in the ZIP writer. libdeflate is typically the fastest
17+
# DEFLATE encoder available and still produces standard DEFLATE streams, so the
18+
# output remains a spec-valid .xlsx. It requires a C compiler (`cc`) at build
19+
# time but, unlike zlib-ng, does not require cmake. The compression ratio can
20+
# differ slightly from miniz_oxide at a given level, so benchmark both on your
21+
# data. Default build uses the pure-Rust miniz_oxide backend (no C toolchain).
22+
libdeflate = ["dep:libdeflater"]
23+
1424
[dependencies]
1525
pyo3 = { version = "0.28", features = ["chrono", "chrono-tz","extension-module"] }
1626
pyo3-arrow = "0.17"
1727
arrow = "58"
1828
arrow-array = "58"
1929
arrow-schema = "58"
2030
arrow-data = "58"
21-
mtzip = { version = "4.0.3", features = ["rayon"] }
2231
chrono = "0.4"
2332
zmij = "1.0"
2433
itoa = "1.0"
@@ -28,12 +37,15 @@ base64 = "0.22"
2837
rand = "0.9"
2938
rayon = "1.10"
3039
rustc-hash = "2.0"
40+
mimalloc = { version = "0.1", default-features = false }
41+
miniz_oxide = "0.8"
42+
crc32fast = "1.4"
43+
libdeflater = { version = "1.24", optional = true }
3144
image = { version = "0.25", default-features = false, features = ["png", "jpeg", "gif", "bmp"] }
3245

3346
[profile.release]
3447
opt-level = 3
3548
lto = "fat"
3649
codegen-units = 1
3750
panic = "abort"
38-
strip = true
39-
51+
strip = true

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Jetxl is a high-performance library for creating Excel files from Python with na
2727

2828
At the time of the test, the following library versions were used:
2929
- Jetxl: 0.2.5
30-
- Polars: 1.40.1
30+
- Polars: 1.42.1
3131
- Pandas: 3.0.3
3232
- Pyexcelerate: 0.13.0
3333
- Rustpy-xlsxwriter: 0.4.4
@@ -38,7 +38,7 @@ At the time of the test, the following library versions were used:
3838
### Library comparison summary
3939
| Library | 1M Rows | Speedup | Throughput | Memory |
4040
|---------|---------|---------|------------|--------|
41-
| **jetxl (arrow)** | **1.85s** | **1.0x** | **523K rows/s** | **~0 MB** |
41+
| **jetxl (arrow)** | **0.68s** | **1.0x** | **1468K rows/s** | **~0 MB** |
4242
| jetxl (dict) | 3.02s | 1.6x slower | 322K rows/s | ~0 MB |
4343
| rustpy_xlsxwriter | 7.51s | 4.0x slower | 125K rows/s | 267.5 MB |
4444
| xlsxwriter | 29.16s | **15x slower** | 31K rows/s | 947.6 MB |
@@ -2685,7 +2685,8 @@ import jetxl as jet
26852685

26862686
df = pl.DataFrame({
26872687
"Name": ["Alice", "Bob"],
2688-
"Sales": [1000, 1500]
2688+
"Sales": [1000, 1500],
2689+
"Region": ["North", "South"]
26892690
})
26902691

26912692
# Add title rows, metadata, spacing before DataFrame
@@ -3049,4 +3050,4 @@ except ValueError as e:
30493050
---
30503051

30513052

3052-
Made with ❤️ and 🦀 by the Jetxl team
3053+
Made with ❤️ and 🦀 by the Jetxl team

0 commit comments

Comments
 (0)