From dd4ccfa317196e7c2c75c551b847d2fb079e5eea Mon Sep 17 00:00:00 2001 From: Sergey Dryabzhinsky Date: Fri, 24 Oct 2025 20:37:16 +0300 Subject: [PATCH 1/4] Add mention of new env var for tests --- README.rst | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index 38fb66b6d..57f03be1c 100644 --- a/README.rst +++ b/README.rst @@ -357,8 +357,7 @@ When using a PEP 517 builder you can use ``ZSTD_WARNINGS`` environment variable >>> $ ZSTD_WARNINGS=1 python -m build -w -If you want to treat all warnings as errors just add ``-- -all-warnings-errors`` option +If you want to treat all warnings as errors just add ``--all-warnings-errors`` option >>> $ python setup.py build_ext --all-warnings-errors clean @@ -366,6 +365,10 @@ When using a PEP 517 builder you can use ``ZSTD_WERRORS`` environment variable i >>> $ ZSTD_WERRORS=1 python -m build -w +When using a PEP 517 builder you can use ``ZSTD_FULLTIME_TESTS`` environment variable, to run tests with fulltime length: + + >>> $ ZSTD_FULLTIME_TESTS=1 python setup.py test + Install from pypi ----------------- From 7066d72e563db4726b137cfc9fe24aae469b3e75 Mon Sep 17 00:00:00 2001 From: Sergey Dryabzhinsky Date: Fri, 24 Oct 2025 20:53:26 +0300 Subject: [PATCH 2/4] silence gcc warnings, reduce tests time --- src/util.h | 6 ++--- tests/test_speed.py | 64 +++++++++++++++++++++++++++++++++++++-------- 2 files changed, 56 insertions(+), 14 deletions(-) diff --git a/src/util.h b/src/util.h index d00a9f6c5..5cfed6ef6 100644 --- a/src/util.h +++ b/src/util.h @@ -66,9 +66,9 @@ extern "C" { typedef struct stat stat_t; #endif -static int numLogicalCores = 1; -static time_t lastTimeCached = 0; -static int util_cpuCoresCacheTTL = 60; +__attribute__((unused)) static int numLogicalCores = 1; +__attribute__((unused)) static time_t lastTimeCached = 0; +__attribute__((unused)) static int util_cpuCoresCacheTTL = 60; int UTIL_countAvailableCores(void); int UTIL_setCpuCoresCacheTTL(int cacheTTL); int UTIL_stopCpuCoresCache(void); diff --git a/tests/test_speed.py b/tests/test_speed.py index 70319d753..c1ae8d97f 100644 --- a/tests/test_speed.py +++ b/tests/test_speed.py @@ -12,7 +12,9 @@ def test_00_system_info(self): log.info("Bundled libzstd uses threads? :%r" % zstd.ZSTD_with_threads()) def test_compression_speed(self): - wait = 30 + wait = 10 + if "ZSTD_FULLTIME_TESTS" in os.environ: + wait = 30 log.info("\nWait %d seconds..." % wait) sum = 0 l=len(tDATA) @@ -28,8 +30,30 @@ def test_compression_speed(self): log.info("Compression speed average = %6.2f Mb/sec" % (1.0*sum/1024/1024/wait,)) log.info("diff Compression memory usage = %6.2f kb" % (1.0*(endMemoryUsage-beginMemoryUsage)/1024,)) + def test_compression_speed_no_cpu_cores_cache(self): + wait = 10 + if "ZSTD_FULLTIME_TESTS" in os.environ: + wait = 30 + log.info("\nWait %d seconds..." % wait) + sum = 0 + l=len(tDATA) + tbegin = time() + beginMemoryUsage=get_real_memory_usage() + log.info("begin Compression memory usage = %6.2f kb" % (1.0*beginMemoryUsage/1024,)) + zstd.ZSTD_stopCpuCoresCache() + while time()-tbegin Date: Sun, 26 Oct 2025 15:01:07 +0300 Subject: [PATCH 3/4] Fix compilation with msvsc --- src/util.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/util.h b/src/util.h index 5cfed6ef6..1aadf169c 100644 --- a/src/util.h +++ b/src/util.h @@ -66,9 +66,15 @@ extern "C" { typedef struct stat stat_t; #endif +#if defined(_WIN32) || defined(WIN32) + static int numLogicalCores = 1; + static time_t lastTimeCached = 0; + static int util_cpuCoresCacheTTL = 60; +#else __attribute__((unused)) static int numLogicalCores = 1; __attribute__((unused)) static time_t lastTimeCached = 0; __attribute__((unused)) static int util_cpuCoresCacheTTL = 60; +#endif int UTIL_countAvailableCores(void); int UTIL_setCpuCoresCacheTTL(int cacheTTL); int UTIL_stopCpuCoresCache(void); From 272fc904e285dabd8c169d009966699996806d95 Mon Sep 17 00:00:00 2001 From: Sergey Dryabzhinsky Date: Sun, 26 Oct 2025 15:02:33 +0300 Subject: [PATCH 4/4] Fix: msvsc don't know /O3 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 3162c582d..b0c0bf0b3 100644 --- a/setup.py +++ b/setup.py @@ -352,7 +352,7 @@ def which(bin_exe): } if BUILD_SPEED3: COPT = { - 'msvc': ['/O3', ], + 'msvc': ['/Ox', ], 'mingw32': ['-O3',], 'unix': ['-O3',], 'clang': ['-O3',],