Skip to content

Instantly share code, notes, and snippets.

View nmoinvaz's full-sized avatar

Nathan Moinvaziri nmoinvaz

  • Phoenix, United States
View GitHub Profile
Here is zlib level/algorithm mapping:
Level | Algorithm
0 Store
1 Intel deflate quick
2-3 Zlib deflate fast
4-6 Intel deflate medium
7-9 Zlib deflate slow
@nmoinvaz
nmoinvaz / minigzip.py
Created May 23, 2020 03:39
Minigzip compression level test python script
import os
import argparse
parser = argparse.ArgumentParser(description='Minigzip test app')
parser.add_argument('--file', help='File to test', default=None, action='store', required=False)
args, unknown = parser.parse_known_args()
print("Arguments - Known/Unknown")
print(args)
print(unknown)
@nmoinvaz
nmoinvaz / compare258_benchmark.cc
Last active May 25, 2020 13:42
Google benchmark for testing compare258 variants.
/* compare258_benchmark.cc -- test compare258 variants
* Copyright (C) 2020 Nathan Moinvaziri
* For conditions of distribution and use, see copyright notice in zlib.h
*/
/*
cmake . -A Win32 -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDLL -DWITH_GZFILEOP=ON -DBUILD_SHARED_LIBS=OFF
cmake_minimum_required(VERSION 3.17)
cmake_policy(SET CMP0091 NEW)
@nmoinvaz
nmoinvaz / adler32_benchmark.cc
Last active May 25, 2020 13:44
Google benchmark for testing adler32 variants.
/* adler32_benchmark.cc -- test adler32 variants
* Copyright (C) 2020 Nathan Moinvaziri
* For conditions of distribution and use, see copyright notice in zlib.h
*/
/*
cmake . -A Win32 -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDLL -DWITH_GZFILEOP=ON -DBUILD_SHARED_LIBS=OFF
cmake_minimum_required(VERSION 3.17)
cmake_policy(SET CMP0091 NEW)
@nmoinvaz
nmoinvaz / inflateparams.c
Last active May 25, 2020 13:43
Zlib-ng inflate testing command line
/* inflateparams.c -- test inflate using different parameters
* Copyright (C) 2020 Nathan Moinvaziri
* For conditions of distribution and use, see copyright notice in zlib.h
*/
/*
add_executable(inflateparams test/inflateparams.c)
configure_test_executable(inflateparams)
*/
@nmoinvaz
nmoinvaz / hash_benchmark.cc
Last active May 25, 2020 13:43
Google benchmark for zlib-ng hashing functions
/* hash_benchmark.cc -- test hash function variants
* Copyright (C) 2020 Nathan Moinvaziri
* For conditions of distribution and use, see copyright notice in zlib.h
*/
/*
cmake . -A Win32 -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDLL -DBUILD_SHARED_LIBS=OFF
cmake_minimum_required(VERSION 3.17)
@nmoinvaz
nmoinvaz / hash_test.py
Last active May 9, 2020 07:58
Testing hash functions in python for zlib-ng
import matplotlib.pyplot as plt
import numpy as np
import random
import timeit
import time
import math
import argparse
import zlib
from random import seed
import struct
@nmoinvaz
nmoinvaz / powershell-cert.md
Last active January 22, 2023 18:11
Powershell Commands for Certificates

Self-signed Code Signing Certificate

To create the code signing certificate using PowerShell (using Administrator prompt):

$cert = New-SelfSignedCertificate -Subject "My Certificate" -Type CodeSigning -CertStoreLocation Cert:\CurrentUser\My -NotAfter (Get-Date).AddYears(100)

To export the certificate from the certificate store:

$certPassword = ConvertTo-SecureString -String "passwordhere" -Force –AsPlainText
$cert | Export-PfxCertificate -FilePath "mycert.pfx" -Password $certPassword
@nmoinvaz
nmoinvaz / compare258_results.md
Last active March 29, 2020 18:55
compare_258_results.md

pigznmoinvaz.exe is built off nmoinvaz/zlib-ng branch improvements/compare-258.

(base) PS E:\pigz-bench-python> python .\b_speed_threads.py
Skipping test: Unable to find "gzip"
exe     level   ms      mb/s    %       threads
pigzCloudflare.exe      3       212     270     47.30   0
pigzCloudflare.exe      6       281     203     46.68   0
pigzCloudflare.exe      9       408     140     46.60   0
pigzCloudflare.exe      3       778     74      47.31   1

pigzCustom.exe is built off nmoinvaz/zlib-ng branch improvements/update-hash-v3.

(base) C:\Users\nathan\Source\pigz-bench-python>python ./b_speed_threads.py
Skipping test: Unable to find "gzip"
exe     level   ms      mb/s    %       threads
pigzCloudflare.exe      3       416     138     47.30   0
pigzCloudflare.exe      6       552     104     46.68   0
pigzCloudflare.exe      9       771     74      46.60   0
pigzCloudflare.exe      3       1842    31      47.31   1