Skip to content

Reading time differs for compressed and uncompressed documents #73

@jurekkow

Description

@jurekkow

Describe the bug
There is a significant difference in ROI reading speed, depending on the method of compression.

To Reproduce
The following Python script:

import timeit

from pylibCZIrw import czi


file_paths = ["uncompressed.czi", "jpeg-xr-compressed.czi", "zstd-compressed.czi"]

roi_x = -126748
roi_y = 46095
z = 0
t = 0
c = 0
scene = 0

num_read = 1

for file_path in file_paths:
    reader = czi.CziReader(file_path)
    roi = (roi_x, roi_y, 2000, 2000)
    read_time = timeit.timeit(
        lambda: reader.read(roi=roi, plane={"T": t, "Z": z, "C": c}, scene=scene),
        number=num_read,
        globals=globals(),
    )
    print(f"{file_path}: {read_time}s")

Outputs:

uncompressed.czi: 0.01224821200594306s
jpeg-xr-compressed.czi: 0.46801461999712046s
zstd-compressed.czi: 0.051155578999896534s

Expected behavior
Reading times of compressed and uncompressed documents don't differ, or differ less than 2x.

Desktop (please complete the following information):

  • OS: Ubuntu 20.04.4 LTS
  • Python Version: 3.9.11
  • pyLibCZI Version: 3.5.1

Additional context
The original, JPEGXR-compressed document, was decompressed and ZSTD-compressed again using czicompress tool.

Test document will be delivered separately.

Metadata

Metadata

Assignees

Labels

questionFurther information is requested

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions