OS: Windows-11-10.0.26200-SP0
CPU: AMD64 Family 25 Model 68 Stepping 1, AuthenticAMD
Number of logical cores: 16
Python: 64bit AMD64 3.13.5 | packaged by Anaconda, Inc. | (main, Jun 12 2025, 16:37:03) [MSC v.1929 64 bit (AMD64)]
STDOUT: *** lz4 v1.10.0 64-bit multithread, by Yann Collet ***
The running time with 1 threads is 11 seconds.
The running time with 2 threads is 12 seconds.
The running time with 3 threads is 13 seconds.
The running time with 4 threads is 14 seconds.
The running time with 5 threads is 14 seconds.
The running time with 6 threads is 13 seconds.
The running time with 7 threads is 13 seconds.
The running time with 8 threads is 9 seconds.
The running time with 9 threads is 13 seconds.
Как правильно настроить LZ4_NBWORKERS?
Спасибо за объяснение и счастливого нового года.>
Я использую LZ4 v1.10.0 — многоядерную версию. Я хотел бы настроить LZ4_NBWORKERS для использования преимуществ многоядерных процессоров: [code]import subprocess, time, platform, sys, os
# Information of the system print('OS:', platform.platform()) print('CPU:', platform.processor()) print('Number of logical cores:', os.cpu_count()) print('Python:', platform.architecture()[0], platform.machine(), sys.version)
# Paths tarPath = "tar" # Windows 11 has tar.exe on PATH lz4Path = r"C:\Users\Akira\Downloads\Compressed\lz4_win64_v1_10_0\lz4.exe" srcDir = r"E:\Personal Projects\tmp" filesToArchive = ["chunk_0.ndjson", "chunk_0.ndjson"] outLz4 = r"E:\Personal Projects\tmp\test.tar.lz4"
# Version of lz4 print() result = subprocess.run([lz4Path, "-V"], capture_output=True, text=True, check=True) print("STDOUT:", result.stdout.strip()) print()
# Prepare the command # Using CMD syntax to set env variable + pipe for nCore in range(1, 10): cmd = f'set LZ4_NBWORKERS={nCore} && tar -C "{srcDir}" -cf - {" ".join(filesToArchive)} | "{lz4Path}" -f - "{outLz4}"' start = time.perf_counter() result = subprocess.run(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) end = time.perf_counter() print("The running time with", nCore, "threads is", round(end-start), "seconds.") # print("STDERR:", result.stderr.decode()) [/code] Похоже, что улучшения скорости нет: [code]OS: Windows-11-10.0.26200-SP0 CPU: AMD64 Family 25 Model 68 Stepping 1, AuthenticAMD Number of logical cores: 16 Python: 64bit AMD64 3.13.5 | packaged by Anaconda, Inc. | (main, Jun 12 2025, 16:37:03) [MSC v.1929 64 bit (AMD64)]
STDOUT: *** lz4 v1.10.0 64-bit multithread, by Yann Collet ***
The running time with 1 threads is 11 seconds. The running time with 2 threads is 12 seconds. The running time with 3 threads is 13 seconds. The running time with 4 threads is 14 seconds. The running time with 5 threads is 14 seconds. The running time with 6 threads is 13 seconds. The running time with 7 threads is 13 seconds. The running time with 8 threads is 9 seconds. The running time with 9 threads is 13 seconds. [/code] Как правильно настроить LZ4_NBWORKERS? Спасибо за объяснение и счастливого нового года.>