further optimisation
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 18/100
- Loại issue
- Tái cấu trúc
- Độ rõ ràng
- Cần làm rõ
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- numpy, python
- Lĩnh vực
- performance
Hướng nghiên cứu
Start by reading _read_bulk_fsspec, the B-tree index-building path, and the measurements in the issue; the issue presents several possible bottlenecks but does not select a specific change. Establish which bottleneck to address and how to benchmark it before starting; done should mean a measured improvement with correctness preserved. Pull request #284 is already open.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
@zequihg50 has observed further differences between Zarr and pyfive on remote files where one would expect differences to be minor.
I asked AI to investigate. These are the findings:
Claude Sonnet 5.5 Analysis
Measurements use work26 (my mamba python) on 10 cores (my macbook air), a 1.7 MiB-chunk float32 file with shuffle, gzip and Fletcher32, and fsspec's in-memory filesystem. They are not WAN timings.
Where time goes now (800 chunks, single-threaded): pyfive reads in 3.1 s, the same as h5py (3.08 s). Zarr takes 1.28 s on the same chunking with shuffle and zlib. The time is split as follows:
| Stage | Share |
|---|---|
| zlib.decompress | 72% |
| Unshuffle and buffer copies | 16% |
| Fletcher32 checksum | 4% |
| Fetch | 3.5% |
Candidates, ranked
-
Quadratic chunk-range matching in
_read_bulk_fsspec(the big one). After fetching, each chunk scans the returned ranges from the start until it finds its match. With no range merging, that is about K²/2 comparisons. It is pure Python CPU, independent of filters, I/O and network. It is the most likely explanation if the 10-minute file has very many chunks. cProfile at 64,000 chunks put 70.7 of 71 s in_read_bulk_fsspecitself, and the whole read otherwise takes about 0.3 s. A dict lookup would fix it, or sorted ranges with bisect when merging is on.Chunks Read time 4,000 0.23 s 16,000 3.4 s 64,000 58 s -
Serial decode. All three read strategies decode chunks one after another, even though the work is mostly GIL-releasing native code writing to separate regions of the output. A thread pool over decode and assign gave:
Threads Read time 1 3.3 s 4 1.9 s 8 1.4 s
For comparison, Zarr takes 1.28s.
- The unshuffle loop holds the GIL, which caps that scaling. Swapping in a NumPy transpose is slower serially (3.9 s versus 3.4 s) but scales much better:
Threads Loop NumPy transpose numcodecs Shuffle 4 1.77 s 1.21 s 1.74 s 8 1.50 s 1.03 s 1.40 s 10 1.62 s 0.96 s 1.32
The best combination (NumPy transpose, 10 threads) beat Zarr's 1.28 s in this run. This corrects my earlier advice against NumPy unshuffle: that conclusion came from single-threaded timings and does not hold once decoding is parallel.
- Serial B-tree reads when building the chunk index. The default
btree_parallel=Falsereads each node with two separate reads, and the metadata buffer only covers the first 1 MiB. Underlying read calls during index build:Chunks Reads 4,000 25 16,000 451 64,000 2,165
Each is a network round trip on a remote file. At 50–100 ms each, 64,000 chunks would cost roughly 2–4 minutes before any data moves. I did not measure that time, only the read counts. Whether the 2-per-node figure comes from separate header and body reads is inferred from the code, not verified.
-
No overlap between fetch and decode. The bulk path fetches everything, then decodes everything, so on a WAN the cost is fetch time plus decode time. Zarr overlaps them. I could not measure this without a real remote endpoint.
-
Minor:
- Double fetch: when batch_request_size is set,
_read_bulk_fsspecfetches all ranges twice. This is from reading the code, not measured. - Extra copies: several per chunk (bytes(...) + tail, [:-4], buffer slicing).
- Double fetch: when batch_request_size is set,
- Ngôn ngữ chính
- Python
- Star
- 105
- Fork
- 29
- Merge trung bình
- 2 ngày 8 giờ
- Pull request đã merge (30 ngày)
- 9
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của NCAS-CMS/pyfive
-
enhancement
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
Maintainer thường phản hồi trong vòng 1 ngày
-
pyfive and hdf5>=2Đang mởinstallation
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
NCAS-CMS/pyfive#279 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
VDS datasets silently return NoneCó thể làm lại được @bnlawrence đã nhận 48 ngày trước và không có pull request nào đang mở. Đang mởbug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
NCAS-CMS/pyfive#275 · 2 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
difference in check_dtype for vlen compared to h5pyCó thể làm lại được @davidhassell đã nhận 153 ngày trước và không có pull request nào đang mở. Đang mởquestion
NCAS-CMS/pyfive#228 · 13 bình luận · 2 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
question
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
NCAS-CMS/pyfive#219 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của NCAS-CMS/pyfive
Issue tương tự
-
flaky: test_fire_returns_thread_per_http_entry_on_head waits 5 s per dispatch worker on busy shardsĐang mởstatus/accepted type/bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
microsoft/apm#5309 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug vector-store
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
EverMind-AI/Raven#1413 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Tests: parallel pyinstallcheck runs oversubscribe the machine through nested TBB and BLAS poolsCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 86/100
ACCESS-NRI/containerised-environments-infra#143 ·
Maintainer thường phản hồi trong vòng 2 ngày