diff --git a/.circleci/config.yml b/.circleci/config.yml index 6f2106b..38296b7 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -37,7 +37,7 @@ common: &common key: cache-v1-{{ arch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "setup.py" }}-{{ checksum "tox.ini" }} orbs: - win: circleci/windows@5.0.0 + win: circleci/windows@5.1.0 windows-wheel-steps: windows-wheel-setup: &windows-wheel-setup diff --git a/.github/workflows/benchmark.yaml b/.github/workflows/benchmark.yaml new file mode 100644 index 0000000..7d2a6be --- /dev/null +++ b/.github/workflows/benchmark.yaml @@ -0,0 +1,146 @@ +name: Pytest Benchmarks + +on: + pull_request: + branches: [master] + paths: + - '**.py' + - '.github/workflows/benchmark.yaml' + - 'pyproject.toml' + - 'setup.py' + push: + branches: [master] + paths: + - '**.py' + - '.github/workflows/benchmark.yaml' + - 'pyproject.toml' + - 'setup.py' + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + benchmark: + name: Run Benchmarks + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v5 + + - name: Set up Python + uses: actions/setup-python@v6 + with: + python-version: "3.13" + cache: pip + cache-dependency-path: | + setup.py + pyproject.toml + + - name: Cache .mypy_cache + uses: actions/cache@v4 + with: + path: .mypy_cache + key: mypy-cache-${{ runner.os }}-x64-${{ hashFiles('**/*.py', 'pyproject.toml') }} + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install .[dev] pytest-codspeed pytest-benchmark + + - name: Remove Python files from test env + run: rm -r faster_hexbytes + + - name: Run Pytest Benchmark & Save Output + run: pytest --benchmark-only --benchmark-json=benchmark.json benchmarks/ + + - name: Upload Pytest Benchmark Results + uses: actions/upload-artifact@v4 + with: + name: pytest-benchmark-results + path: benchmark.json + + - name: Parse Pytest Benchmark Output + run: python scripts/benchmark/parse_benchmark_output.py benchmark.json pytest_benchmark_results.json + + - name: Compare Pytest Benchmark Results + run: python scripts/benchmark/compare_benchmark_results.py pytest_benchmark_results.json pytest_benchmark_diff.json + + - name: Generate Markdown Benchmark Results + run: python scripts/benchmark/generate_benchmark_markdown.py + + - name: Commit and Push Markdown Benchmark Results + continue-on-error: true + run: | + git config --global user.name "github-actions[bot]" + git config --global user.email "github-actions[bot]@users.noreply.github.com" + git fetch origin ${{ github.head_ref || github.ref_name }} + git checkout ${{ github.head_ref || github.ref_name }} + git add benchmarks/results/*.md + if git diff --cached --quiet; then + echo "No changes to commit." + else + git commit -m "Update benchmark results [skip ci]" + git push origin HEAD:${{ github.head_ref || github.ref_name }} + fi + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Upload Markdown Benchmark Results + uses: actions/upload-artifact@v4 + with: + name: markdown-benchmark-results + path: benchmarks/results/*.md + + - name: Upload Pytest Benchmark Diff + uses: actions/upload-artifact@v4 + with: + name: pytest-benchmark-diff + path: pytest_benchmark_diff.json + + - name: Post Pytest Benchmark Diff as PR Comment + uses: actions/github-script@v8 + with: + script: | + const fs = require('fs'); + const diff = JSON.parse(fs.readFileSync('pytest_benchmark_diff.json', 'utf8')); + let body = '### Pytest Benchmark Diff\n\n'; + const repo = `${context.repo.owner}/${context.repo.repo}`; + const branch = context.payload.pull_request ? context.payload.pull_request.head.ref : context.ref.replace('refs/heads/', ''); + for (const [submodule, groupDiffs] of Object.entries(diff)) { + let submoduleFile = "unknown"; + let benchmarkFile = "unknown"; + const m = submodule.match(/^faster_hexbytes\.(.+)$/); + if (m) { + submoduleFile = `faster_hexbytes/${m[1]}.py`; + benchmarkFile = `benchmarks/test_${m[1]}_benchmarks.py`; + } + const submoduleUrl = `https://github.com/${repo}/blob/${branch}/${submoduleFile}`; + const benchmarkUrl = `https://github.com/${repo}/blob/${branch}/${benchmarkFile}`; + body += `#### [${submodule}](${submoduleUrl}) - [view benchmarks](${benchmarkUrl})\n`; + body += '| Function | Reference Mean | Faster Mean | % Change | Speedup (%) | x Faster | Faster |\n'; + body += '|----------|---------------|-------------|----------|-------------|----------|--------|\n'; + for (const [group, data] of Object.entries(groupDiffs).sort(([a], [b]) => a.localeCompare(b))) { + if (data.percent_change !== null && data.percent_change !== undefined) { + let emoji = '➖'; + if (data.percent_change > 0) emoji = '✅'; + else if (data.percent_change < 0) emoji = '❌'; + const percentChange = data.percent_change !== undefined && data.percent_change !== null + ? `${data.percent_change.toFixed(2)}%` : ''; + const speedupPercent = data.speedup_percent !== undefined && data.speedup_percent !== null + ? `${data.speedup_percent.toFixed(2)}%` : ''; + const speedupX = data.speedup_x !== undefined && data.speedup_x !== null && isFinite(data.speedup_x) + ? `${data.speedup_x.toFixed(2)}x` : ''; + body += `| \`${group}\` | ${data.reference_mean} | ${data.faster_mean} | ${percentChange} | ${speedupPercent} | ${speedupX} | ${emoji} |\n`; + } else if (data.note) { + body += `| \`${group}\` | | | | | | ➖ |\n`; + } + } + body += '\n'; + } + github.rest.issues.createComment({ + ...context.repo, + issue_number: context.issue.number, + body + }); + if: github.event_name == 'pull_request' diff --git a/.github/workflows/codspeed.yaml b/.github/workflows/codspeed.yaml new file mode 100644 index 0000000..0ef2bbc --- /dev/null +++ b/.github/workflows/codspeed.yaml @@ -0,0 +1,58 @@ +name: CodSpeed Benchmarks + +on: + pull_request: + branches: [master] + paths: + - '**.py' + - '.github/workflows/codspeed.yaml' + - 'pyproject.toml' + - 'setup.py' + push: + branches: [master] + paths: + - '**.py' + - '.github/workflows/codspeed.yaml' + - 'pyproject.toml' + - 'setup.py' + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + benchmark: + name: Run CodSpeed Benchmarks + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v5 + + - name: Set up Python + uses: actions/setup-python@v6 + with: + python-version: "3.13" + cache: pip + cache-dependency-path: | + setup.py + pyproject.toml + + - name: Cache .mypy_cache + uses: actions/cache@v4 + with: + path: .mypy_cache + key: mypy-cache-${{ runner.os }}-x64-${{ hashFiles('**/*.py', 'pyproject.toml') }} + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install .[dev] pytest-codspeed + + - name: Remove Python files from test env + run: rm -r faster_hexbytes + + - name: Run CodSpeed + uses: CodSpeedHQ/action@v4 + with: + mode: instrumentation + run: pytest --codspeed -k "test_faster_" benchmarks/ diff --git a/.github/workflows/compile.yaml b/.github/workflows/compile.yaml new file mode 100644 index 0000000..8a43f5f --- /dev/null +++ b/.github/workflows/compile.yaml @@ -0,0 +1,83 @@ +name: Compile + +on: + pull_request: + branches: + - master + paths-ignore: + - '.github/workflows/**' + - '!.github/workflows/compile.yaml' + push: + branches: + - master + paths-ignore: + - '.github/workflows/**' + - '!.github/workflows/compile.yaml' + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + build-ubuntu: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v5 + with: + # Check out the PR branch + ref: ${{ github.head_ref }} + + - name: Set up Python + uses: actions/setup-python@v6 + with: + python-version: "3.14" + cache: pip + cache-dependency-path: | + setup.py + pyproject.toml + + - name: Cache .mypy_cache + uses: actions/cache@v4 + with: + path: .mypy_cache + key: mypy-cache-${{ runner.os }}-x64-${{ hashFiles('**/*.py', 'pyproject.toml') }} + + - name: Delete existing build files + run: rm -rf build + + - name: Install Faster Hexbytes + env: + MYPYC_STRICT_DUNDER_TYPING: 1 + run: pip install . + + - name: Normalize C files for diffchecking + # This makes it much easier to diffcheck changes in the C files + run: | + # Insert DIFFCHECK_PLACEHOLDER macro at the top if not present + for f in build/*.c; do + if ! grep -q 'DIFFCHECK_PLACEHOLDER' "$f"; then + sed -i '1i#ifndef DIFFCHECK_PLACEHOLDER\n#define DIFFCHECK_PLACEHOLDER 0\n#endif' "$f" + fi + done + # Replace line number in CPy_AddTraceback with macro + sed -i 's/\(CPy_AddTraceback([^,]*, *[^,]*, *\)[0-9]\+\(, *[^)]*)\)/\1DIFFCHECK_PLACEHOLDER\2/g' build/*.c + # Replace index in CPyStatics[...] with macro + sed -i 's/CPyStatics\[[0-9]\+\]/CPyStatics[DIFFCHECK_PLACEHOLDER]/g' build/*.c + + - name: Check for changes + run: | + if [[ -n $(git status --porcelain) ]]; then + echo "changes_detected=true" >> $GITHUB_ENV + else + echo "changes_detected=false" >> $GITHUB_ENV + fi + + - name: Commit changes + if: env.changes_detected == 'true' + run: | + git config --local user.name "github-actions[bot]" + git config --local user.email "github-actions[bot]@users.noreply.github.com" + git add . + git commit -m "chore: compile C files for source control" + git push diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..3e3a9cb --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,213 @@ +name: Build and Publish Wheels + +on: + release: + branches: + - master + types: [published] + +jobs: + build_wheels: + name: Build wheels using cibuildwheel + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + include: + # ---------------------------------------------------- + # manylinux 64-bit + # ---------------------------------------------------- + - os: ubuntu-latest + build_type: manylinux-x64 + cibw_build: "*manylinux*" + cibw_archs_linux: x86_64 + artifact_name: "wheels-ubuntu-latest-manylinux-x64" + + # ---------------------------------------------------- + # manylinux 32-bit + # ---------------------------------------------------- + - os: ubuntu-latest + build_type: manylinux-x86 + cibw_build: "*manylinux*" + cibw_archs_linux: i686 + artifact_name: "wheels-ubuntu-latest-manylinux-x86" + + # ---------------------------------------------------- + # musllinux 64-bit + # ---------------------------------------------------- + - os: ubuntu-latest + build_type: musllinux-x64 + cibw_build: "*musllinux*" + cibw_archs_linux: x86_64 + artifact_name: "wheels-ubuntu-latest-musllinux-x64" + + # ---------------------------------------------------- + # musllinux 32-bit + # ---------------------------------------------------- + - os: ubuntu-latest + build_type: musllinux-x86 + cibw_build: "*musllinux*" + cibw_archs_linux: i686 + artifact_name: "wheels-ubuntu-latest-musllinux-x86" + + # ---------------------------------------------------- + # macOS (64-bit only) + # ---------------------------------------------------- + - os: macos-latest + build_type: macos + cibw_build: "" + cibw_archs_linux: "" + artifact_name: "wheels-macos-latest" + + # ---------------------------------------------------- + # Windows 64-bit + # ---------------------------------------------------- + - os: windows-latest + build_type: winx64 + cibw_build: "" + cibw_archs_windows: AMD64 + artifact_name: "wheels-windows-latest-x64" + + # ---------------------------------------------------- + # Windows 32-bit + # ---------------------------------------------------- + - os: windows-latest + build_type: winx86 + cibw_build: "" + cibw_archs_windows: x86 + artifact_name: "wheels-windows-latest-x86" + + steps: + - name: Check out code + uses: actions/checkout@v5 + with: + fetch-depth: 0 + + - name: Set up Python + uses: actions/setup-python@v6 + with: + python-version: "3.11" + cache: pip + cache-dependency-path: | + setup.py + pyproject.toml + + - name: Install cibuildwheel + run: | + python -m pip install --upgrade pip setuptools wheel cibuildwheel + + - name: Cache .mypy_cache + uses: actions/cache@v4 + with: + path: .mypy_cache + key: mypy-cache-${{ runner.os }}-x64-${{ hashFiles('**/*.py', 'pyproject.toml') }} + + - name: Build wheels + env: + # Skip PyPy + CIBW_SKIP: pp* + # On Linux: manylinux / musllinux arches + CIBW_ARCHS_LINUX: ${{ matrix.cibw_archs_linux || '' }} + # On Windows: AMD64 / x86 + CIBW_ARCHS_WINDOWS: ${{ matrix.cibw_archs_windows || '' }} + # Which wheels to build for Linux (manylinux vs. musllinux) + CIBW_BUILD: ${{ matrix.cibw_build || '' }} + run: | + python -m cibuildwheel --output-dir wheelhouse + + - name: Upload wheels + uses: actions/upload-artifact@v4 + with: + name: ${{ matrix.artifact_name }} + path: wheelhouse/*.whl + + publish_sdist_and_wheels: + name: Publish wheels to PyPI + needs: build_wheels + runs-on: ubuntu-latest + steps: + - name: Check out code + uses: actions/checkout@v5 + with: + fetch-depth: 0 + + - name: Set up Python + uses: actions/setup-python@v6 + with: + python-version: "3.11" + cache: pip + cache-dependency-path: | + setup.py + pyproject.toml + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install setuptools wheel twine mypy==1.18.2 hexbytes==1.3.1 + + - name: Build sdist + run: | + python setup.py sdist + + # ---------------------------------------------------- + # Download wheels built on each runner + # ---------------------------------------------------- + - name: Download manylinux 64-bit wheels + uses: actions/download-artifact@v5 + with: + name: "wheels-ubuntu-latest-manylinux-x64" + path: wheelhouse/linux-many-x64 + + - name: Download manylinux 32-bit wheels + uses: actions/download-artifact@v5 + with: + name: "wheels-ubuntu-latest-manylinux-x86" + path: wheelhouse/linux-many-x86 + + - name: Download musllinux 64-bit wheels + uses: actions/download-artifact@v5 + with: + name: "wheels-ubuntu-latest-musllinux-x64" + path: wheelhouse/linux-musl-x64 + + - name: Download musllinux 32-bit wheels + uses: actions/download-artifact@v5 + with: + name: "wheels-ubuntu-latest-musllinux-x86" + path: wheelhouse/linux-musl-x86 + + - name: Download macOS wheels + uses: actions/download-artifact@v5 + with: + name: "wheels-macos-latest" + path: wheelhouse/macos + + - name: Download Windows 64-bit wheels + uses: actions/download-artifact@v5 + with: + name: "wheels-windows-latest-x64" + path: wheelhouse/windows-x64 + + - name: Download Windows 32-bit wheels + uses: actions/download-artifact@v5 + with: + name: "wheels-windows-latest-x86" + path: wheelhouse/windows-x86 + + # ---------------------------------------------------- + # Publish all built artifacts to PyPI + # ---------------------------------------------------- + - name: Publish sdist and wheels to PyPI + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} + run: | + twine upload \ + dist/* \ + wheelhouse/linux-many-x64/*.whl \ + wheelhouse/linux-many-x86/*.whl \ + wheelhouse/linux-musl-x64/*.whl \ + wheelhouse/linux-musl-x86/*.whl \ + wheelhouse/macos/*.whl \ + wheelhouse/windows-x64/*.whl \ + wheelhouse/windows-x86/*.whl diff --git a/.github/workflows/tox.yaml b/.github/workflows/tox.yaml new file mode 100644 index 0000000..50e52be --- /dev/null +++ b/.github/workflows/tox.yaml @@ -0,0 +1,117 @@ +name: Tox + +on: + push: + branches: [main, master] + paths: + - '**.py' + - '.github/workflows/tox.yaml' + - 'pyproject.toml' + - 'setup.py' + - 'tox.ini' + pull_request: + branches: [main, master] + paths: + - '**.py' + - '.github/workflows/tox.yaml' + - 'pyproject.toml' + - 'setup.py' + - 'tox.ini' + schedule: + - cron: '0 10 * * *' # Daily 10:00 UTC + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + test: + name: Test (${{ matrix.jobtype }}, ${{ matrix.python-version}}, ${{ matrix.os }}, ${{ matrix.architecture }}) + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.13t", "3.14", "3.14t"] + jobtype: [core, lint, wheel] + architecture: [x64, x86] + exclude: + # Exclude x86 (32-bit) builds for macos, which doesn't support 32-bit at all + - os: macos-latest + architecture: x86 + max-parallel: ${{ (github.event_name == 'schedule' || github.event_name == 'push') && 4 || 1000 }} + env: + TOXENV: py${{ matrix.python-version }}-${{ matrix.jobtype }} + TOX_RECREATE_FLAG: ${{ github.event_name == 'schedule' && '-r' || '' }} + IS_UBUNTU_32BIT: ${{ matrix.os == 'ubuntu-latest' && matrix.architecture == 'x86' }} + steps: + - uses: actions/checkout@v5 + + # Use i386/python Docker for all 32-bit Ubuntu jobs (TODO cache some of this) + - name: Run job in 32-bit Ubuntu Docker container + if: ${{ env.IS_UBUNTU_32BIT == 'true' }} + uses: addnab/docker-run-action@v3 + with: + image: i386/python:${{ matrix.python-version }} + shell: bash + options: -v ${{ github.workspace }}:/workspace -w /workspace + run: | + python -m pip install --upgrade pip + python -m pip install tox + python -m tox -e ${{ env.TOXENV }} ${{ env.TOX_RECREATE_FLAG }} + # There are no prebuilt 32-bit freethreaded Python containers at the time of this commit, but + # we will keep these runners so they will activate on their own whenever such containers exist + continue-on-error: ${{ matrix.python-version == '3.13t' || matrix.python-version == '3.14t' }} + + # No architecture specified for MacOS + - name: Set up Python (macos) + if: ${{ matrix.os == 'macos-latest' }} + uses: actions/setup-python@v6 + with: + python-version: ${{ matrix.python-version }} + cache: pip + cache-dependency-path: | + setup.py + pyproject.toml + tox.ini + + # All other builds (64-bit Linux, 32-bit and 64-bit Windows) + - name: Set up Python + if: ${{ matrix.os != 'macos-latest' && env.IS_UBUNTU_32BIT != 'true' }} + uses: actions/setup-python@v6 + with: + python-version: ${{ matrix.python-version }} + architecture: ${{ matrix.architecture }} + cache: pip + cache-dependency-path: | + setup.py + pyproject.toml + tox.ini + + - name: Upgrade pip and install tox + if: ${{ env.IS_UBUNTU_32BIT != 'true' }} + run: | + python -m pip install --upgrade pip + python -m pip install tox + + - name: Cache .mypy_cache + if: ${{ env.IS_UBUNTU_32BIT != 'true' }} + uses: actions/cache@v4 + with: + path: .mypy_cache + key: mypy-cache-${{ runner.os }}-${{ matrix.architecture }}-${{ hashFiles('**/*.py', 'pyproject.toml') }} + + - name: Cache tox environment and hypothesis examples + if: ${{ env.IS_UBUNTU_32BIT != 'true' }} + uses: actions/cache@v4 + with: + path: | + .tox + .hypothesis + key: ${{ runner.os }}-tox-${{ hashFiles('pyproject.toml', 'setup.py', 'tox.ini') }}-${{ matrix.python-version }}-${{ matrix.architecture }}-${{ matrix.jobtype }} + save-always: ${{ env.TOX_RECREATE_FLAG == '-r' }} + + - name: Run tox + if: ${{ env.IS_UBUNTU_32BIT != 'true' }} + run: python -m tox run ${{ env.TOX_RECREATE_FLAG }} diff --git a/.gitignore b/.gitignore index 2eb3d43..bf3ec5a 100644 --- a/.gitignore +++ b/.gitignore @@ -7,7 +7,10 @@ *.egg *.egg-info dist -build +build/**/*.py +build/**/*.typed +build/**/*.o +build/ops.txt .build eggs .eggs diff --git a/README.md b/README.md index c7e0ade..d9c368e 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,17 @@ +### I forked hexbytes and compiled it to C. It does the same stuff, now faster + +[![PyPI](https://img.shields.io/pypi/v/faster-hexbytes.svg?logo=Python&logoColor=white)](https://pypi.org/project/faster-hexbytes/) +[![Monthly Downloads](https://img.shields.io/pypi/dm/faster-hexbytes)](https://pypistats.org/packages/faster-hexbytes) +[![Codspeed.io Status](https://img.shields.io/endpoint?url=https://codspeed.io/badge.json)](https://codspeed.io/BobTheBuidler/faster-hexbytes) + +##### This fork will be kept up-to-date with [hexbytes](https://github.com/ethereum/hexbytes). I will pull updates as they are released and push new [faster-hexbytes](https://github.com/BobTheBuidler/faster-hexbytes) releases to [PyPI](https://pypi.org/project/faster-hexbytes/). + +##### You can find the compiled C code on faster-hexbytes [master](https://github.com/BobTheBuidler/hexbytes/tree/master) branch. + +##### We benchmark `faster-hexbytes` against the original `hexbytes` for your convenience. [See results](https://github.com/BobTheBuidler/faster-hexbytes/tree/master/benchmarks/results). + +##### The original hexbytes readme is below: + # HexBytes [![Join the conversation on Discord](https://img.shields.io/discord/809793915578089484?color=blue&label=chat&logo=discord&logoColor=white)](https://discord.gg/GHryRvPB84) diff --git a/benchmarks/__init__.py b/benchmarks/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/benchmarks/__init__.py @@ -0,0 +1 @@ + diff --git a/benchmarks/params.py b/benchmarks/params.py new file mode 100644 index 0000000..7784144 --- /dev/null +++ b/benchmarks/params.py @@ -0,0 +1,193 @@ +from typing import Any, List, Tuple, Union +from eth_typing import HexStr + +import hexbytes +import faster_hexbytes + +Convertable = Union[bool, bytearray, bytes, int, str, memoryview] + +# Centralized list of all byte patterns and their ids (use human-readable where possible) +BYTES_CASES: List[Tuple[bytes, str]] = [ + (b"abc", "b'abc'"), + (b"", "b''"), + (b"\x00" * 32, "b'\\x00'*32"), + (b"\xff" * 64, "b'\\xff'*64"), + (b"a" * 1024, "b'a'*1024"), + (b"\x01\x02\x03", "b'\\x01\\x02\\x03'"), + (b"\xde\xad\xbe\xef", "b'\\xde\\xad\\xbe\\xef'"), + (b"\x00\xff\x00\xff", "b'\\x00\\xff\\x00\\xff'"), + (b"palindromeemordnilap", "palindrome"), + (b"\x7f" * 8, "b'\\x7f'*8"), + (b"\x80" * 8, "b'\\x80'*8"), + (b"\x01" * 100, "b'\\x01'*100"), + (b"\x10\x20\x30\x40\x50", "b'\\x10\\x20\\x30\\x40\\x50'"), + (b"\x00\xff" * 32, "alternating 0x00/0xff"), + (b"\xaa\x55" * 32, "alternating 0xaa/0x55"), + (b"\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09", "0-9"), + (b"\x00\x10\x20\x30\x40\x50\x60\x70\x80\x90", "multiples of 0x10"), + (b"\x01" * 2048, "b'\\x01'*2048"), + (b"\x00\x01" * 512, "long alternating"), + (b"\x00\xff\x01\xfe" * 64, "4-byte pattern"), + (bytes(range(256)), "all byte values"), + (b"racecar", "palindrome ascii"), + (b"12321", "palindrome numeric"), + (b"\x00" * 1, "single null byte"), + (b"\xff" * 1, "single 0xff"), + (b"\x01\x02" * 50 + b"\x03\x04" * 50, "mixed pattern"), + (b"\x00\xff" * 16 + b"\x01\xfe" * 16, "two patterns"), + (b"the quick brown fox jumps over the lazy dog", "ascii sentence"), + (b"\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09" * 10, "repeated 0-9"), +] + +BYTES_VALS: List[bytes] = [v for v, _ in BYTES_CASES] +BYTES_IDS: List[str] = [id for _, id in BYTES_CASES] + + +def variant_ids(base_ids: List[str], prefix: str) -> List[str]: + return [f"{prefix}({id})" for id in base_ids] + + +BYTEARRAYS = [bytearray(b) for b in BYTES_VALS] +BYTEARRAYS_IDS = variant_ids(BYTES_IDS, "bytearray") + +MEMORYVIEWS = [memoryview(b) for b in BYTES_VALS] +MEMORYVIEWS_IDS = variant_ids(BYTES_IDS, "memoryview") + +HEXBYTES_ORIG = [hexbytes.HexBytes(b) for b in BYTES_VALS] +HEXBYTES_ORIG_IDS = variant_ids(BYTES_IDS, "hexbytes.HexBytes") + +HEXBYTES_FAST = [faster_hexbytes.HexBytes(b) for b in BYTES_VALS] +HEXBYTES_FAST_IDS = variant_ids(BYTES_IDS, "faster_hexbytes.HexBytes") + +# Other types for construction and conversion, with human-readable ids where possible +STR_CASES: List[Tuple[str, str]] = [ + ("abc", "'abc'"), + ("", "''"), + ("0x1234", "'0x1234'"), + ("deadbeef", "'deadbeef'"), + ("0x", "'0x'"), + ("0x" + "ff" * 32, "'0x'+'ff'*32"), + ("0x" + "00" * 64, "'0x'+'00'*64"), + ("0xabcdef", "'0xabcdef'"), + ("0x" + "a" * 128, "'0x'+'a'*128"), + ("0xdeadbeef", "'0xdeadbeef'"), + ("0xCAFEBABE", "'0xCAFEBABE'"), +] +STR_VALS: List[str] = [v for v, _ in STR_CASES] +STR_IDS: List[str] = [id for _, id in STR_CASES] + +INT_CASES: List[Tuple[int, str]] = [ + (123456, "123456"), + (0, "0"), + (2**8, "2**8"), + (2**16, "2**16"), + (2**32, "2**32"), + (2**64, "2**64"), + (2**256 - 1, "2**256-1"), +] +INT_VALS: List[int] = [v for v, _ in INT_CASES] +INT_IDS: List[str] = [id for _, id in INT_CASES] + +BOOL_CASES: List[Tuple[bool, str]] = [ + (True, "True"), + (False, "False"), +] +BOOL_VALS: List[bool] = [v for v, _ in BOOL_CASES] +BOOL_IDS: List[str] = [id for _, id in BOOL_CASES] + +# For to_bytes and HexBytes construction +CONSTRUCTOR_VALS: List[Any] = ( + BYTES_VALS + BYTEARRAYS + MEMORYVIEWS + STR_VALS + INT_VALS + BOOL_VALS +) +CONSTRUCTOR_IDS: List[str] = ( + BYTES_IDS + BYTEARRAYS_IDS + MEMORYVIEWS_IDS + STR_IDS + INT_IDS + BOOL_IDS +) + +# For bytes-based operations +# (BYTES_VALS and BYTES_IDS already defined above) + +# For index and slice operations +INDEXES = [0, 1, 2, 3, 4, 5, -1] +INDEX_IDS = [str(i) for i in INDEXES] + +SLICES = [slice(0, 3), slice(1, 6), slice(2, None), slice(None, None), slice(-3, None)] +SLICE_IDS = [ + "slice(0,3)", + "slice(1,6)", + "slice(2,None)", + "slice(None,None)", + "slice(-3,None)", +] + +# For to_bytes and hexstr_to_bytes +TO_BYTES_VALS: List[Convertable] = ( + BYTES_VALS + BYTEARRAYS + MEMORYVIEWS + STR_VALS + INT_VALS + BOOL_VALS +) +TO_BYTES_IDS: List[str] = ( + BYTES_IDS + BYTEARRAYS_IDS + MEMORYVIEWS_IDS + STR_IDS + INT_IDS + BOOL_IDS +) + +HEXSTRINGS: List[HexStr] = [ + "0x1234", + "deadbeef", + "0x", + "", + "0x" + "ff" * 32, + "0x" + "00" * 64, + "0xabcdef", + "0x" + "a" * 128, + "0xdeadbeef", + "0xCAFEBABE", + "0x0", + "0x1", + "0x" + "1" * 64, + "0x" + "f" * 64, + "0x" + "0" * 128, + "0x" + "1234567890abcdef" * 8, + "0x" + "00ff" * 16, + "0x" + "ff00" * 16, + "0x" + "a1b2c3d4" * 8, + "0x" + "dead" * 16, + "0x" + "beef" * 16, + "0x" + "cafebabe" * 8, + "0x" + "facefeed" * 8, + "0x" + "badc0ffee0ddf00d" * 4, + "0x" + "0123456789abcdef" * 8, + "0x" + "f" * 128, + "0x" + "e" * 256, + "0x" + "d" * 512, + "0x" + "c" * 1024, + "0x" + "b" * 2048, +] +HEXSTRINGS_IDS: List[str] = [ + "'0x1234'", + "'deadbeef'", + "'0x'", + "''", + "'0x'+'ff'*32", + "'0x'+'00'*64", + "'0xabcdef'", + "'0x'+'a'*128", + "'0xdeadbeef'", + "'0xCAFEBABE'", + "'0x0'", + "'0x1'", + "'0x'+'1'*64", + "'0x'+'f'*64", + "'0x'+'0'*128", + "'0x'+'1234567890abcdef'*8", + "'0x'+'00ff'*16", + "'0x'+'ff00'*16", + "'0x'+'a1b2c3d4'*8", + "'0x'+'dead'*16", + "'0x'+'beef'*16", + "'0x'+'cafebabe'*8", + "'0x'+'facefeed'*8", + "'0x'+'badc0ffee0ddf00d'*4", + "'0x'+'0123456789abcdef'*8", + "'0x'+'f'*128", + "'0x'+'e'*256", + "'0x'+'d'*512", + "'0x'+'c'*1024", + "'0x'+'b'*2048", +] diff --git a/benchmarks/results/_utils.md b/benchmarks/results/_utils.md new file mode 100644 index 0000000..fe41ac1 --- /dev/null +++ b/benchmarks/results/_utils.md @@ -0,0 +1,141 @@ +#### [faster_hexbytes._utils](https://github.com/BobTheBuidler/faster-hexbytes/blob/master/faster_hexbytes/_utils.py) - [view benchmarks](https://github.com/BobTheBuidler/faster-hexbytes/blob/master/benchmarks/test__utils_benchmarks.py) + +| Function | Reference Mean | Faster Mean | % Change | Speedup (%) | x Faster | Faster | +|----------|---------------|-------------|----------|-------------|----------|--------| +| `hexstr_to_bytes['']` | 1.7775917983662326e-05 | 1.0727932500263032e-05 | 39.65% | 65.70% | 1.66x | ✅ | +| `hexstr_to_bytes['0x'+'0'*128]` | 3.491490471043102e-05 | 2.0919416525130024e-05 | 40.08% | 66.90% | 1.67x | ✅ | +| `hexstr_to_bytes['0x'+'00'*64]` | 3.446399900535072e-05 | 2.084486314228059e-05 | 39.52% | 65.34% | 1.65x | ✅ | +| `hexstr_to_bytes['0x'+'00ff'*16]` | 3.07139326313055e-05 | 1.8245216446590623e-05 | 40.60% | 68.34% | 1.68x | ✅ | +| `hexstr_to_bytes['0x'+'0123456789abcdef'*8]` | 3.4416328818048816e-05 | 2.1364675933872856e-05 | 37.92% | 61.09% | 1.61x | ✅ | +| `hexstr_to_bytes['0x'+'1'*64]` | 3.100143024090268e-05 | 1.8085035848866485e-05 | 41.66% | 71.42% | 1.71x | ✅ | +| `hexstr_to_bytes['0x'+'1234567890abcdef'*8]` | 3.441861393884184e-05 | 2.0849935033229896e-05 | 39.42% | 65.08% | 1.65x | ✅ | +| `hexstr_to_bytes['0x'+'a'*128]` | 3.4561192947161615e-05 | 2.0909033331686867e-05 | 39.50% | 65.29% | 1.65x | ✅ | +| `hexstr_to_bytes['0x'+'a1b2c3d4'*8]` | 3.1403812929364115e-05 | 1.8250018801877918e-05 | 41.89% | 72.08% | 1.72x | ✅ | +| `hexstr_to_bytes['0x'+'b'*2048]` | 0.00013753065358410233 | 0.00011893207404219291 | 13.52% | 15.64% | 1.16x | ✅ | +| `hexstr_to_bytes['0x'+'badc0ffee0ddf00d'*4]` | 3.099832064262594e-05 | 1.8894152914837597e-05 | 39.05% | 64.06% | 1.64x | ✅ | +| `hexstr_to_bytes['0x'+'beef'*16]` | 3.069293012127684e-05 | 1.819615153771005e-05 | 40.72% | 68.68% | 1.69x | ✅ | +| `hexstr_to_bytes['0x'+'c'*1024]` | 9.01187594160798e-05 | 7.165488217868635e-05 | 20.49% | 25.77% | 1.26x | ✅ | +| `hexstr_to_bytes['0x'+'cafebabe'*8]` | 3.078868619515657e-05 | 1.8153241640669056e-05 | 41.04% | 69.60% | 1.70x | ✅ | +| `hexstr_to_bytes['0x'+'d'*512]` | 5.717538693757999e-05 | 4.191188016720377e-05 | 26.70% | 36.42% | 1.36x | ✅ | +| `hexstr_to_bytes['0x'+'dead'*16]` | 3.056904536226116e-05 | 1.807443997571223e-05 | 40.87% | 69.13% | 1.69x | ✅ | +| `hexstr_to_bytes['0x'+'e'*256]` | 4.2916587071081487e-05 | 2.777874104941655e-05 | 35.27% | 54.49% | 1.54x | ✅ | +| `hexstr_to_bytes['0x'+'f'*128]` | 3.441630937427268e-05 | 2.1008247175884103e-05 | 38.96% | 63.82% | 1.64x | ✅ | +| `hexstr_to_bytes['0x'+'f'*64]` | 3.115085523484252e-05 | 1.8273651367177792e-05 | 41.34% | 70.47% | 1.70x | ✅ | +| `hexstr_to_bytes['0x'+'facefeed'*8]` | 3.052517387721047e-05 | 1.8539806661974925e-05 | 39.26% | 64.65% | 1.65x | ✅ | +| `hexstr_to_bytes['0x'+'ff'*32]` | 3.101207130589155e-05 | 1.8166417131457863e-05 | 41.42% | 70.71% | 1.71x | ✅ | +| `hexstr_to_bytes['0x'+'ff00'*16]` | 3.125244425618186e-05 | 1.8120887750486596e-05 | 42.02% | 72.47% | 1.72x | ✅ | +| `hexstr_to_bytes['0x']` | 2.2601683819888815e-05 | 1.0645460230090324e-05 | 52.90% | 112.31% | 2.12x | ✅ | +| `hexstr_to_bytes['0x0']` | 3.1713275923851624e-05 | 1.817321485458567e-05 | 42.70% | 74.51% | 1.75x | ✅ | +| `hexstr_to_bytes['0x1']` | 3.17379536154141e-05 | 1.822157537232279e-05 | 42.59% | 74.18% | 1.74x | ✅ | +| `hexstr_to_bytes['0x1234']` | 2.7838757970796635e-05 | 1.5795555405837136e-05 | 43.26% | 76.24% | 1.76x | ✅ | +| `hexstr_to_bytes['0xCAFEBABE']` | 2.8614949011522105e-05 | 1.591753977381602e-05 | 44.37% | 79.77% | 1.80x | ✅ | +| `hexstr_to_bytes['0xabcdef']` | 2.8803541128933988e-05 | 1.5921828453220432e-05 | 44.72% | 80.91% | 1.81x | ✅ | +| `hexstr_to_bytes['0xdeadbeef']` | 2.8607378892316006e-05 | 1.587141543631149e-05 | 44.52% | 80.24% | 1.80x | ✅ | +| `hexstr_to_bytes['deadbeef']` | 2.1949053918184868e-05 | 1.3789659724657343e-05 | 37.17% | 59.17% | 1.59x | ✅ | +| `to_bytes['']` | 2.7955620716199966e-05 | 1.1797225133100466e-05 | 57.80% | 136.97% | 2.37x | ✅ | +| `to_bytes['0x'+'00'*64]` | 4.640411641467185e-05 | 2.2434685311775978e-05 | 51.65% | 106.84% | 2.07x | ✅ | +| `to_bytes['0x'+'a'*128]` | 4.684056000001329e-05 | 2.2574385306526537e-05 | 51.81% | 107.49% | 2.07x | ✅ | +| `to_bytes['0x'+'ff'*32]` | 4.318002503555302e-05 | 2.020647868451592e-05 | 53.20% | 113.69% | 2.14x | ✅ | +| `to_bytes['0x']` | 3.314101681805598e-05 | 1.2266483321805938e-05 | 62.99% | 170.18% | 2.70x | ✅ | +| `to_bytes['0x1234']` | 4.0501930807956784e-05 | 1.738635051057951e-05 | 57.07% | 132.95% | 2.33x | ✅ | +| `to_bytes['0xCAFEBABE']` | 4.0621225816056714e-05 | 1.743460371084774e-05 | 57.08% | 132.99% | 2.33x | ✅ | +| `to_bytes['0xabcdef']` | 4.0354350721587806e-05 | 1.7580093385599063e-05 | 56.44% | 129.55% | 2.30x | ✅ | +| `to_bytes['0xdeadbeef']` | 4.0645245803455973e-05 | 1.7482358201118536e-05 | 56.99% | 132.49% | 2.32x | ✅ | +| `to_bytes['abc']` | 3.6857843943719186e-05 | 1.8918340672893454e-05 | 48.67% | 94.83% | 1.95x | ✅ | +| `to_bytes['deadbeef']` | 3.20727471455936e-05 | 1.5093752812033718e-05 | 52.94% | 112.49% | 2.12x | ✅ | +| `to_bytes[0-9]` | 6.405104477169434e-06 | 3.481490940926133e-06 | 45.65% | 83.98% | 1.84x | ✅ | +| `to_bytes[0]` | 7.386539555383063e-05 | 3.185220650225649e-05 | 56.88% | 131.90% | 2.32x | ✅ | +| `to_bytes[123456]` | 7.821481600061214e-05 | 3.5855117308899914e-05 | 54.16% | 118.14% | 2.18x | ✅ | +| `to_bytes[2**16]` | 7.852956848802972e-05 | 3.562569676400627e-05 | 54.63% | 120.43% | 2.20x | ✅ | +| `to_bytes[2**256-1]` | 8.200174130913126e-05 | 4.2477666359339256e-05 | 48.20% | 93.05% | 1.93x | ✅ | +| `to_bytes[2**32]` | 7.990086204576741e-05 | 3.917294543620569e-05 | 50.97% | 103.97% | 2.04x | ✅ | +| `to_bytes[2**64]` | 8.096338538172213e-05 | 4.049433200400262e-05 | 49.98% | 99.94% | 2.00x | ✅ | +| `to_bytes[2**8]` | 7.736550064124095e-05 | 3.38261195493415e-05 | 56.28% | 128.72% | 2.29x | ✅ | +| `to_bytes[4-byte pattern]` | 5.810964246285607e-06 | 3.4827826985651824e-06 | 40.07% | 66.85% | 1.67x | ✅ | +| `to_bytes[False]` | 2.2148925700342022e-05 | 4.193161930657539e-06 | 81.07% | 428.22% | 5.28x | ✅ | +| `to_bytes[True]` | 2.1914907076166526e-05 | 4.272684603804276e-06 | 80.50% | 412.91% | 5.13x | ✅ | +| `to_bytes[all byte values]` | 6.280903951637545e-06 | 3.463342473454103e-06 | 44.86% | 81.35% | 1.81x | ✅ | +| `to_bytes[alternating 0x00/0xff]` | 6.254048018198429e-06 | 3.449426758973995e-06 | 44.84% | 81.31% | 1.81x | ✅ | +| `to_bytes[alternating 0xaa/0x55]` | 6.274259199507789e-06 | 3.47531986681661e-06 | 44.61% | 80.54% | 1.81x | ✅ | +| `to_bytes[ascii sentence]` | 6.410588981912706e-06 | 3.5700308497286407e-06 | 44.31% | 79.57% | 1.80x | ✅ | +| `to_bytes[b'']` | 6.10352624376636e-06 | 3.5640788418879e-06 | 41.61% | 71.25% | 1.71x | ✅ | +| `to_bytes[b'\\x00'*32]` | 6.204836918156331e-06 | 3.5478724157598516e-06 | 42.82% | 74.89% | 1.75x | ✅ | +| `to_bytes[b'\\x00\\xff\\x00\\xff']` | 6.212304353583824e-06 | 3.488907567241734e-06 | 43.84% | 78.06% | 1.78x | ✅ | +| `to_bytes[b'\\x01'*100]` | 6.1108317619697845e-06 | 3.475464519872266e-06 | 43.13% | 75.83% | 1.76x | ✅ | +| `to_bytes[b'\\x01'*2048]` | 6.412506347989267e-06 | 3.5317178487341285e-06 | 44.92% | 81.57% | 1.82x | ✅ | +| `to_bytes[b'\\x01\\x02\\x03']` | 6.263785655651608e-06 | 3.5467792157562786e-06 | 43.38% | 76.60% | 1.77x | ✅ | +| `to_bytes[b'\\x10\\x20\\x30\\x40\\x50']` | 6.2030308329165995e-06 | 3.569135670965629e-06 | 42.46% | 73.80% | 1.74x | ✅ | +| `to_bytes[b'\\x7f'*8]` | 6.110410318541576e-06 | 3.4510035726980575e-06 | 43.52% | 77.06% | 1.77x | ✅ | +| `to_bytes[b'\\x80'*8]` | 6.108707295649537e-06 | 3.4766991212699945e-06 | 43.09% | 75.70% | 1.76x | ✅ | +| `to_bytes[b'\\xde\\xad\\xbe\\xef']` | 6.221459231679587e-06 | 3.6628319193328574e-06 | 41.13% | 69.85% | 1.70x | ✅ | +| `to_bytes[b'\\xff'*64]` | 6.20125730704149e-06 | 3.6603347174000155e-06 | 40.97% | 69.42% | 1.69x | ✅ | +| `to_bytes[b'a'*1024]` | 6.208299950724173e-06 | 3.664229542525834e-06 | 40.98% | 69.43% | 1.69x | ✅ | +| `to_bytes[b'abc']` | 5.824765260288395e-06 | 3.627948166702222e-06 | 37.72% | 60.55% | 1.61x | ✅ | +| `to_bytes[bytearray(0-9)]` | 2.8340198982049607e-05 | 1.389877378098738e-05 | 50.96% | 103.90% | 2.04x | ✅ | +| `to_bytes[bytearray(4-byte pattern)]` | 2.8516350658940008e-05 | 1.4015066218152717e-05 | 50.85% | 103.47% | 2.03x | ✅ | +| `to_bytes[bytearray(all byte values)]` | 2.8485148340827248e-05 | 1.4016406086190249e-05 | 50.79% | 103.23% | 2.03x | ✅ | +| `to_bytes[bytearray(alternating 0x00/0xff)]` | 2.8199036845120896e-05 | 1.3904260965956375e-05 | 50.69% | 102.81% | 2.03x | ✅ | +| `to_bytes[bytearray(alternating 0xaa/0x55)]` | 2.815897700733323e-05 | 1.3683789830500578e-05 | 51.41% | 105.78% | 2.06x | ✅ | +| `to_bytes[bytearray(ascii sentence)]` | 2.8263667834917084e-05 | 1.3943717727594286e-05 | 50.67% | 102.70% | 2.03x | ✅ | +| `to_bytes[bytearray(b'')]` | 2.6409268578679534e-05 | 1.2568176618087206e-05 | 52.41% | 110.13% | 2.10x | ✅ | +| `to_bytes[bytearray(b'\\x00'*32)]` | 2.8037044180183664e-05 | 1.3932908291924571e-05 | 50.31% | 101.23% | 2.01x | ✅ | +| `to_bytes[bytearray(b'\\x00\\xff\\x00\\xff')]` | 2.7323515494515315e-05 | 1.3949457982115627e-05 | 48.95% | 95.88% | 1.96x | ✅ | +| `to_bytes[bytearray(b'\\x01'*100)]` | 2.8221135504671916e-05 | 1.4097409849262612e-05 | 50.05% | 100.19% | 2.00x | ✅ | +| `to_bytes[bytearray(b'\\x01'*2048)]` | 3.570467544896867e-05 | 1.9927464588039017e-05 | 44.19% | 79.17% | 1.79x | ✅ | +| `to_bytes[bytearray(b'\\x01\\x02\\x03')]` | 2.8287103714232012e-05 | 1.4147741627550316e-05 | 49.99% | 99.94% | 2.00x | ✅ | +| `to_bytes[bytearray(b'\\x10\\x20\\x30\\x40\\x50')]` | 2.7658895030992004e-05 | 1.385051129578054e-05 | 49.92% | 99.70% | 2.00x | ✅ | +| `to_bytes[bytearray(b'\\x7f'*8)]` | 2.7940442051731036e-05 | 1.4136463383102241e-05 | 49.41% | 97.65% | 1.98x | ✅ | +| `to_bytes[bytearray(b'\\x80'*8)]` | 2.834711645944484e-05 | 1.3917514809080335e-05 | 50.90% | 103.68% | 2.04x | ✅ | +| `to_bytes[bytearray(b'\\xde\\xad\\xbe\\xef')]` | 2.8023905091192385e-05 | 1.4127868235928117e-05 | 49.59% | 98.36% | 1.98x | ✅ | +| `to_bytes[bytearray(b'\\xff'*64)]` | 2.8041287223907698e-05 | 1.3796742968987002e-05 | 50.80% | 103.25% | 2.03x | ✅ | +| `to_bytes[bytearray(b'a'*1024)]` | 3.452359306148068e-05 | 1.9926495228188348e-05 | 42.28% | 73.25% | 1.73x | ✅ | +| `to_bytes[bytearray(b'abc')]` | 2.7993054555332495e-05 | 1.4101273131591149e-05 | 49.63% | 98.51% | 1.99x | ✅ | +| `to_bytes[bytearray(long alternating)]` | 3.4941171445052263e-05 | 1.9958103041113844e-05 | 42.88% | 75.07% | 1.75x | ✅ | +| `to_bytes[bytearray(mixed pattern)]` | 2.8412226547313388e-05 | 1.4054230794244093e-05 | 50.53% | 102.16% | 2.02x | ✅ | +| `to_bytes[bytearray(multiples of 0x10)]` | 2.8210212994194743e-05 | 1.4066195751407053e-05 | 50.14% | 100.55% | 2.01x | ✅ | +| `to_bytes[bytearray(palindrome ascii)]` | 2.811958424887465e-05 | 1.4077242534547195e-05 | 49.94% | 99.75% | 2.00x | ✅ | +| `to_bytes[bytearray(palindrome numeric)]` | 2.7881754838381873e-05 | 1.4076983481452832e-05 | 49.51% | 98.07% | 1.98x | ✅ | +| `to_bytes[bytearray(palindrome)]` | 2.8108772201246278e-05 | 1.4064760910190597e-05 | 49.96% | 99.85% | 2.00x | ✅ | +| `to_bytes[bytearray(repeated 0-9)]` | 2.7875124149586617e-05 | 1.4130458538432285e-05 | 49.31% | 97.27% | 1.97x | ✅ | +| `to_bytes[bytearray(single 0xff)]` | 2.8173936254947837e-05 | 1.43499823632826e-05 | 49.07% | 96.33% | 1.96x | ✅ | +| `to_bytes[bytearray(single null byte)]` | 2.802816211427365e-05 | 1.4394923331648491e-05 | 48.64% | 94.71% | 1.95x | ✅ | +| `to_bytes[bytearray(two patterns)]` | 2.819233572932223e-05 | 1.3915738498587107e-05 | 50.64% | 102.59% | 2.03x | ✅ | +| `to_bytes[long alternating]` | 6.415968997645673e-06 | 3.395213209207197e-06 | 47.08% | 88.97% | 1.89x | ✅ | +| `to_bytes[memoryview(0-9)]` | 4.2749595779593174e-05 | 1.6729078785421595e-05 | 60.87% | 155.54% | 2.56x | ✅ | +| `to_bytes[memoryview(4-byte pattern)]` | 4.230633340732641e-05 | 1.7672179228065396e-05 | 58.23% | 139.40% | 2.39x | ✅ | +| `to_bytes[memoryview(all byte values)]` | 4.1825420467904574e-05 | 1.7727645718149545e-05 | 57.62% | 135.93% | 2.36x | ✅ | +| `to_bytes[memoryview(alternating 0x00/0xff)]` | 4.142029004912543e-05 | 1.6863311969785655e-05 | 59.29% | 145.62% | 2.46x | ✅ | +| `to_bytes[memoryview(alternating 0xaa/0x55)]` | 4.243998568804123e-05 | 1.685910583996521e-05 | 60.28% | 151.73% | 2.52x | ✅ | +| `to_bytes[memoryview(ascii sentence)]` | 4.21362768954307e-05 | 1.7067336933448895e-05 | 59.49% | 146.88% | 2.47x | ✅ | +| `to_bytes[memoryview(b'')]` | 4.037774127942253e-05 | 1.5303872734096135e-05 | 62.10% | 163.84% | 2.64x | ✅ | +| `to_bytes[memoryview(b'\\x00'*32)]` | 4.153634534747011e-05 | 1.7118680363379728e-05 | 58.79% | 142.64% | 2.43x | ✅ | +| `to_bytes[memoryview(b'\\x00\\xff\\x00\\xff')]` | 4.222663602906194e-05 | 1.715702613960184e-05 | 59.37% | 146.12% | 2.46x | ✅ | +| `to_bytes[memoryview(b'\\x01'*100)]` | 4.161471657379659e-05 | 1.7721207457399612e-05 | 57.42% | 134.83% | 2.35x | ✅ | +| `to_bytes[memoryview(b'\\x01'*2048)]` | 5.0768532666849206e-05 | 2.3962627337585568e-05 | 52.80% | 111.87% | 2.12x | ✅ | +| `to_bytes[memoryview(b'\\x01\\x02\\x03')]` | 4.1099188083035814e-05 | 1.733918454650432e-05 | 57.81% | 137.03% | 2.37x | ✅ | +| `to_bytes[memoryview(b'\\x10\\x20\\x30\\x40\\x50')]` | 4.193944557658287e-05 | 1.7098338768552156e-05 | 59.23% | 145.28% | 2.45x | ✅ | +| `to_bytes[memoryview(b'\\x7f'*8)]` | 4.2378447529107664e-05 | 1.710789949815429e-05 | 59.63% | 147.71% | 2.48x | ✅ | +| `to_bytes[memoryview(b'\\x80'*8)]` | 4.269689760055061e-05 | 1.6952550682772517e-05 | 60.30% | 151.86% | 2.52x | ✅ | +| `to_bytes[memoryview(b'\\xde\\xad\\xbe\\xef')]` | 4.189233114923724e-05 | 1.71297682780245e-05 | 59.11% | 144.56% | 2.45x | ✅ | +| `to_bytes[memoryview(b'\\xff'*64)]` | 4.171092115928625e-05 | 1.7007314413660392e-05 | 59.23% | 145.25% | 2.45x | ✅ | +| `to_bytes[memoryview(b'a'*1024)]` | 4.980692543268638e-05 | 2.457575314659188e-05 | 50.66% | 102.67% | 2.03x | ✅ | +| `to_bytes[memoryview(b'abc')]` | 4.083182682664677e-05 | 1.7346904310720036e-05 | 57.52% | 135.38% | 2.35x | ✅ | +| `to_bytes[memoryview(long alternating)]` | 4.887775280551575e-05 | 2.2811732311275143e-05 | 53.33% | 114.27% | 2.14x | ✅ | +| `to_bytes[memoryview(mixed pattern)]` | 4.2911069076599587e-05 | 1.7611319399190952e-05 | 58.96% | 143.66% | 2.44x | ✅ | +| `to_bytes[memoryview(multiples of 0x10)]` | 4.2443399062919516e-05 | 1.685632448891867e-05 | 60.29% | 151.80% | 2.52x | ✅ | +| `to_bytes[memoryview(palindrome ascii)]` | 4.203521250490273e-05 | 1.6958199115612473e-05 | 59.66% | 147.88% | 2.48x | ✅ | +| `to_bytes[memoryview(palindrome numeric)]` | 4.172926686035928e-05 | 1.7081017581140755e-05 | 59.07% | 144.30% | 2.44x | ✅ | +| `to_bytes[memoryview(palindrome)]` | 4.241722505404804e-05 | 1.7155580227242966e-05 | 59.56% | 147.25% | 2.47x | ✅ | +| `to_bytes[memoryview(repeated 0-9)]` | 4.25180515779048e-05 | 1.755468544093007e-05 | 58.71% | 142.20% | 2.42x | ✅ | +| `to_bytes[memoryview(single 0xff)]` | 4.22082408931371e-05 | 1.7265692772094226e-05 | 59.09% | 144.46% | 2.44x | ✅ | +| `to_bytes[memoryview(single null byte)]` | 4.259737195222626e-05 | 1.7302336770885106e-05 | 59.38% | 146.19% | 2.46x | ✅ | +| `to_bytes[memoryview(two patterns)]` | 4.248407717683878e-05 | 1.7077688830265145e-05 | 59.80% | 148.77% | 2.49x | ✅ | +| `to_bytes[mixed pattern]` | 6.339674193176509e-06 | 3.506538152394292e-06 | 44.69% | 80.80% | 1.81x | ✅ | +| `to_bytes[multiples of 0x10]` | 6.413060162742873e-06 | 3.477923311417062e-06 | 45.77% | 84.39% | 1.84x | ✅ | +| `to_bytes[palindrome ascii]` | 6.329120349634986e-06 | 3.4775444088901684e-06 | 45.05% | 82.00% | 1.82x | ✅ | +| `to_bytes[palindrome numeric]` | 6.284042853244198e-06 | 3.5741855388631874e-06 | 43.12% | 75.82% | 1.76x | ✅ | +| `to_bytes[palindrome]` | 6.146577946421703e-06 | 3.4775622138726858e-06 | 43.42% | 76.75% | 1.77x | ✅ | +| `to_bytes[repeated 0-9]` | 6.406428210258779e-06 | 3.5764697127159e-06 | 44.17% | 79.13% | 1.79x | ✅ | +| `to_bytes[single 0xff]` | 6.303223160387747e-06 | 3.320065286642722e-06 | 47.33% | 89.85% | 1.90x | ✅ | +| `to_bytes[single null byte]` | 6.122554022222805e-06 | 3.4135951948735565e-06 | 44.25% | 79.36% | 1.79x | ✅ | +| `to_bytes[two patterns]` | 6.344258505391835e-06 | 3.576089281212079e-06 | 43.63% | 77.41% | 1.77x | ✅ | diff --git a/benchmarks/results/main.md b/benchmarks/results/main.md new file mode 100644 index 0000000..ad291ee --- /dev/null +++ b/benchmarks/results/main.md @@ -0,0 +1,486 @@ +#### [faster_hexbytes.main](https://github.com/BobTheBuidler/faster-hexbytes/blob/master/faster_hexbytes/main.py) - [view benchmarks](https://github.com/BobTheBuidler/faster-hexbytes/blob/master/benchmarks/test_main_benchmarks.py) + +| Function | Reference Mean | Faster Mean | % Change | Speedup (%) | x Faster | Faster | +|----------|---------------|-------------|----------|-------------|----------|--------| +| `hexbytes_getitem_index[-1-0-9]` | 2.4754881906208523e-05 | 2.36101290408267e-05 | 4.62% | 4.85% | 1.05x | ✅ | +| `hexbytes_getitem_index[-1-4-byte pattern]` | 2.478487193494239e-05 | 2.3431113403435642e-05 | 5.46% | 5.78% | 1.06x | ✅ | +| `hexbytes_getitem_index[-1-all byte values]` | 2.470368766320023e-05 | 2.364275939613159e-05 | 4.29% | 4.49% | 1.04x | ✅ | +| `hexbytes_getitem_index[-1-alternating 0x00/0xff]` | 2.4896610380112766e-05 | 2.361363987671643e-05 | 5.15% | 5.43% | 1.05x | ✅ | +| `hexbytes_getitem_index[-1-alternating 0xaa/0x55]` | 2.4731110648896462e-05 | 2.370604565036118e-05 | 4.14% | 4.32% | 1.04x | ✅ | +| `hexbytes_getitem_index[-1-ascii sentence]` | 2.4661189514374503e-05 | 2.3727241339910318e-05 | 3.79% | 3.94% | 1.04x | ✅ | +| `hexbytes_getitem_index[-1-b'\\x00'*32]` | 2.459202631467664e-05 | 2.3764809506726955e-05 | 3.36% | 3.48% | 1.03x | ✅ | +| `hexbytes_getitem_index[-1-b'\\x00\\xff\\x00\\xff']` | 2.4694652962089537e-05 | 2.3592214347367266e-05 | 4.46% | 4.67% | 1.05x | ✅ | +| `hexbytes_getitem_index[-1-b'\\x01'*100]` | 2.47202669441009e-05 | 2.3629964039164815e-05 | 4.41% | 4.61% | 1.05x | ✅ | +| `hexbytes_getitem_index[-1-b'\\x01'*2048]` | 2.4526826059437435e-05 | 2.340732067475789e-05 | 4.56% | 4.78% | 1.05x | ✅ | +| `hexbytes_getitem_index[-1-b'\\x01\\x02\\x03']` | 2.450398621063975e-05 | 2.3638475156303192e-05 | 3.53% | 3.66% | 1.04x | ✅ | +| `hexbytes_getitem_index[-1-b'\\x10\\x20\\x30\\x40\\x50']` | 2.4684590057352116e-05 | 2.3653271956331653e-05 | 4.18% | 4.36% | 1.04x | ✅ | +| `hexbytes_getitem_index[-1-b'\\x7f'*8]` | 2.4751953902601515e-05 | 2.3555827154925643e-05 | 4.83% | 5.08% | 1.05x | ✅ | +| `hexbytes_getitem_index[-1-b'\\x80'*8]` | 2.4720320137424888e-05 | 2.3647478742445188e-05 | 4.34% | 4.54% | 1.05x | ✅ | +| `hexbytes_getitem_index[-1-b'\\xde\\xad\\xbe\\xef']` | 2.468165859865056e-05 | 2.3423259512719994e-05 | 5.10% | 5.37% | 1.05x | ✅ | +| `hexbytes_getitem_index[-1-b'\\xff'*64]` | 2.4377689073240468e-05 | 2.3658937275614014e-05 | 2.95% | 3.04% | 1.03x | ✅ | +| `hexbytes_getitem_index[-1-b'a'*1024]` | 2.4695952401237492e-05 | 2.366338024547864e-05 | 4.18% | 4.36% | 1.04x | ✅ | +| `hexbytes_getitem_index[-1-b'abc']` | 2.4800231674423054e-05 | 2.3452005299177345e-05 | 5.44% | 5.75% | 1.06x | ✅ | +| `hexbytes_getitem_index[-1-long alternating]` | 2.464127714730724e-05 | 2.349964519133728e-05 | 4.63% | 4.86% | 1.05x | ✅ | +| `hexbytes_getitem_index[-1-mixed pattern]` | 2.490234386622281e-05 | 2.3673651752844787e-05 | 4.93% | 5.19% | 1.05x | ✅ | +| `hexbytes_getitem_index[-1-multiples of 0x10]` | 2.471712311112505e-05 | 2.3538268903849502e-05 | 4.77% | 5.01% | 1.05x | ✅ | +| `hexbytes_getitem_index[-1-palindrome ascii]` | 2.4969699866733358e-05 | 2.3674475003669625e-05 | 5.19% | 5.47% | 1.05x | ✅ | +| `hexbytes_getitem_index[-1-palindrome numeric]` | 2.4720960424348795e-05 | 2.35198337052224e-05 | 4.86% | 5.11% | 1.05x | ✅ | +| `hexbytes_getitem_index[-1-palindrome]` | 2.4730699765237392e-05 | 2.361908106747321e-05 | 4.49% | 4.71% | 1.05x | ✅ | +| `hexbytes_getitem_index[-1-repeated 0-9]` | 2.4778248510655504e-05 | 2.371700090864329e-05 | 4.28% | 4.47% | 1.04x | ✅ | +| `hexbytes_getitem_index[-1-two patterns]` | 2.4925916740350813e-05 | 2.355574189183202e-05 | 5.50% | 5.82% | 1.06x | ✅ | +| `hexbytes_getitem_index[0-0-9]` | 2.3574485924826352e-05 | 2.233714169508928e-05 | 5.25% | 5.54% | 1.06x | ✅ | +| `hexbytes_getitem_index[0-4-byte pattern]` | 2.3688561803606983e-05 | 2.2437420454966476e-05 | 5.28% | 5.58% | 1.06x | ✅ | +| `hexbytes_getitem_index[0-all byte values]` | 2.3815792609252528e-05 | 2.225711666626083e-05 | 6.54% | 7.00% | 1.07x | ✅ | +| `hexbytes_getitem_index[0-alternating 0x00/0xff]` | 2.3598852107127032e-05 | 2.2335021439197906e-05 | 5.36% | 5.66% | 1.06x | ✅ | +| `hexbytes_getitem_index[0-alternating 0xaa/0x55]` | 2.3662492195827045e-05 | 2.2482525217041793e-05 | 4.99% | 5.25% | 1.05x | ✅ | +| `hexbytes_getitem_index[0-ascii sentence]` | 2.3794392693218644e-05 | 2.230096771135748e-05 | 6.28% | 6.70% | 1.07x | ✅ | +| `hexbytes_getitem_index[0-b'\\x00'*32]` | 2.365388249112569e-05 | 2.2362793690086348e-05 | 5.46% | 5.77% | 1.06x | ✅ | +| `hexbytes_getitem_index[0-b'\\x00\\xff\\x00\\xff']` | 2.373522166087113e-05 | 2.2352927595969076e-05 | 5.82% | 6.18% | 1.06x | ✅ | +| `hexbytes_getitem_index[0-b'\\x01'*100]` | 2.3810309165051318e-05 | 2.2268803262158138e-05 | 6.47% | 6.92% | 1.07x | ✅ | +| `hexbytes_getitem_index[0-b'\\x01'*2048]` | 2.3865380270337903e-05 | 2.2433777460444585e-05 | 6.00% | 6.38% | 1.06x | ✅ | +| `hexbytes_getitem_index[0-b'\\x01\\x02\\x03']` | 2.3687567012699863e-05 | 2.2142043598113183e-05 | 6.52% | 6.98% | 1.07x | ✅ | +| `hexbytes_getitem_index[0-b'\\x10\\x20\\x30\\x40\\x50']` | 2.3665175268832828e-05 | 2.22770555775527e-05 | 5.87% | 6.23% | 1.06x | ✅ | +| `hexbytes_getitem_index[0-b'\\x7f'*8]` | 2.375633959321337e-05 | 2.210544040276182e-05 | 6.95% | 7.47% | 1.07x | ✅ | +| `hexbytes_getitem_index[0-b'\\x80'*8]` | 2.366345837231524e-05 | 2.2282313631059953e-05 | 5.84% | 6.20% | 1.06x | ✅ | +| `hexbytes_getitem_index[0-b'\\xde\\xad\\xbe\\xef']` | 2.3813665988852002e-05 | 2.225609869629857e-05 | 6.54% | 7.00% | 1.07x | ✅ | +| `hexbytes_getitem_index[0-b'\\xff'*64]` | 2.38010661143064e-05 | 2.23844079908076e-05 | 5.95% | 6.33% | 1.06x | ✅ | +| `hexbytes_getitem_index[0-b'a'*1024]` | 2.387913994799082e-05 | 2.2221621747005114e-05 | 6.94% | 7.46% | 1.07x | ✅ | +| `hexbytes_getitem_index[0-b'abc']` | 2.3405791927593618e-05 | 2.238444648865565e-05 | 4.36% | 4.56% | 1.05x | ✅ | +| `hexbytes_getitem_index[0-long alternating]` | 2.3848708237134662e-05 | 2.2604184928612543e-05 | 5.22% | 5.51% | 1.06x | ✅ | +| `hexbytes_getitem_index[0-mixed pattern]` | 2.3611310275487704e-05 | 2.2304260956267688e-05 | 5.54% | 5.86% | 1.06x | ✅ | +| `hexbytes_getitem_index[0-multiples of 0x10]` | 2.3775802467868507e-05 | 2.249233952309131e-05 | 5.40% | 5.71% | 1.06x | ✅ | +| `hexbytes_getitem_index[0-palindrome ascii]` | 2.388396453925264e-05 | 2.2408350203997427e-05 | 6.18% | 6.59% | 1.07x | ✅ | +| `hexbytes_getitem_index[0-palindrome numeric]` | 2.3615511099754482e-05 | 2.229416988361859e-05 | 5.60% | 5.93% | 1.06x | ✅ | +| `hexbytes_getitem_index[0-palindrome]` | 2.3769869763035617e-05 | 2.2262362266245086e-05 | 6.34% | 6.77% | 1.07x | ✅ | +| `hexbytes_getitem_index[0-repeated 0-9]` | 2.365069434437882e-05 | 2.2545686539260675e-05 | 4.67% | 4.90% | 1.05x | ✅ | +| `hexbytes_getitem_index[0-single 0xff]` | 2.3764204532388718e-05 | 2.231888352301192e-05 | 6.08% | 6.48% | 1.06x | ✅ | +| `hexbytes_getitem_index[0-single null byte]` | 2.3688530707151423e-05 | 2.2451306821425064e-05 | 5.22% | 5.51% | 1.06x | ✅ | +| `hexbytes_getitem_index[0-two patterns]` | 2.36301805484756e-05 | 2.2420918565641907e-05 | 5.12% | 5.39% | 1.05x | ✅ | +| `hexbytes_getitem_index[1-0-9]` | 2.329318114513981e-05 | 2.2595021861281157e-05 | 3.00% | 3.09% | 1.03x | ✅ | +| `hexbytes_getitem_index[1-4-byte pattern]` | 2.350705450220431e-05 | 2.241064176845273e-05 | 4.66% | 4.89% | 1.05x | ✅ | +| `hexbytes_getitem_index[1-all byte values]` | 2.3514594342731333e-05 | 2.2383803789615347e-05 | 4.81% | 5.05% | 1.05x | ✅ | +| `hexbytes_getitem_index[1-alternating 0x00/0xff]` | 2.3456498513295538e-05 | 2.2794411416332482e-05 | 2.82% | 2.90% | 1.03x | ✅ | +| `hexbytes_getitem_index[1-alternating 0xaa/0x55]` | 2.33792320107034e-05 | 2.258775699764005e-05 | 3.39% | 3.50% | 1.04x | ✅ | +| `hexbytes_getitem_index[1-ascii sentence]` | 2.3534967809989544e-05 | 2.2409397832567892e-05 | 4.78% | 5.02% | 1.05x | ✅ | +| `hexbytes_getitem_index[1-b'\\x00'*32]` | 2.357479555109983e-05 | 2.2443906695829757e-05 | 4.80% | 5.04% | 1.05x | ✅ | +| `hexbytes_getitem_index[1-b'\\x00\\xff\\x00\\xff']` | 2.3748749032151378e-05 | 2.2240414077822714e-05 | 6.35% | 6.78% | 1.07x | ✅ | +| `hexbytes_getitem_index[1-b'\\x01'*100]` | 2.3662733513615578e-05 | 2.2441215871707897e-05 | 5.16% | 5.44% | 1.05x | ✅ | +| `hexbytes_getitem_index[1-b'\\x01'*2048]` | 2.3709492840837744e-05 | 2.24685964209688e-05 | 5.23% | 5.52% | 1.06x | ✅ | +| `hexbytes_getitem_index[1-b'\\x01\\x02\\x03']` | 2.36027222668159e-05 | 2.2380020102669342e-05 | 5.18% | 5.46% | 1.05x | ✅ | +| `hexbytes_getitem_index[1-b'\\x10\\x20\\x30\\x40\\x50']` | 2.3597789003283424e-05 | 2.2288636831188665e-05 | 5.55% | 5.87% | 1.06x | ✅ | +| `hexbytes_getitem_index[1-b'\\x7f'*8]` | 2.3691764469992e-05 | 2.2299293834068118e-05 | 5.88% | 6.24% | 1.06x | ✅ | +| `hexbytes_getitem_index[1-b'\\x80'*8]` | 2.3826422020934128e-05 | 2.2412189972717277e-05 | 5.94% | 6.31% | 1.06x | ✅ | +| `hexbytes_getitem_index[1-b'\\xde\\xad\\xbe\\xef']` | 2.353906005495418e-05 | 2.2392269446532264e-05 | 4.87% | 5.12% | 1.05x | ✅ | +| `hexbytes_getitem_index[1-b'\\xff'*64]` | 2.365230211027973e-05 | 2.2245732835752976e-05 | 5.95% | 6.32% | 1.06x | ✅ | +| `hexbytes_getitem_index[1-b'a'*1024]` | 2.3484244683977175e-05 | 2.236002527981225e-05 | 4.79% | 5.03% | 1.05x | ✅ | +| `hexbytes_getitem_index[1-b'abc']` | 2.3704651914080182e-05 | 2.2448525457870448e-05 | 5.30% | 5.60% | 1.06x | ✅ | +| `hexbytes_getitem_index[1-long alternating]` | 2.3598917101884618e-05 | 2.227244048933691e-05 | 5.62% | 5.96% | 1.06x | ✅ | +| `hexbytes_getitem_index[1-mixed pattern]` | 2.3621775771809625e-05 | 2.2583749485366612e-05 | 4.39% | 4.60% | 1.05x | ✅ | +| `hexbytes_getitem_index[1-multiples of 0x10]` | 2.3693149230133233e-05 | 2.252206198034193e-05 | 4.94% | 5.20% | 1.05x | ✅ | +| `hexbytes_getitem_index[1-palindrome ascii]` | 2.3691940669726937e-05 | 2.239498737455051e-05 | 5.47% | 5.79% | 1.06x | ✅ | +| `hexbytes_getitem_index[1-palindrome numeric]` | 2.365400554007733e-05 | 2.2371409895768863e-05 | 5.42% | 5.73% | 1.06x | ✅ | +| `hexbytes_getitem_index[1-palindrome]` | 2.3675183340500855e-05 | 2.2237579616887215e-05 | 6.07% | 6.46% | 1.06x | ✅ | +| `hexbytes_getitem_index[1-repeated 0-9]` | 2.3692106062427222e-05 | 2.2339301694125923e-05 | 5.71% | 6.06% | 1.06x | ✅ | +| `hexbytes_getitem_index[1-two patterns]` | 2.347440318738751e-05 | 2.2597520456767633e-05 | 3.74% | 3.88% | 1.04x | ✅ | +| `hexbytes_getitem_index[2-0-9]` | 2.355688845962313e-05 | 2.4261384212057037e-05 | -2.99% | -2.90% | 0.97x | ❌ | +| `hexbytes_getitem_index[2-4-byte pattern]` | 2.3608846660519697e-05 | 2.2332800032368067e-05 | 5.40% | 5.71% | 1.06x | ✅ | +| `hexbytes_getitem_index[2-all byte values]` | 2.36165716399943e-05 | 2.246791718745253e-05 | 4.86% | 5.11% | 1.05x | ✅ | +| `hexbytes_getitem_index[2-alternating 0x00/0xff]` | 2.3440142543499264e-05 | 2.2397256602394565e-05 | 4.45% | 4.66% | 1.05x | ✅ | +| `hexbytes_getitem_index[2-alternating 0xaa/0x55]` | 2.356465073497173e-05 | 2.243608283580368e-05 | 4.79% | 5.03% | 1.05x | ✅ | +| `hexbytes_getitem_index[2-ascii sentence]` | 2.3505508604959207e-05 | 2.241275927913798e-05 | 4.65% | 4.88% | 1.05x | ✅ | +| `hexbytes_getitem_index[2-b'\\x00'*32]` | 2.3589922841261772e-05 | 2.257320642403751e-05 | 4.31% | 4.50% | 1.05x | ✅ | +| `hexbytes_getitem_index[2-b'\\x00\\xff\\x00\\xff']` | 2.355475482912007e-05 | 2.2477188683986006e-05 | 4.57% | 4.79% | 1.05x | ✅ | +| `hexbytes_getitem_index[2-b'\\x01'*100]` | 2.346727600324626e-05 | 2.2506590017179802e-05 | 4.09% | 4.27% | 1.04x | ✅ | +| `hexbytes_getitem_index[2-b'\\x01'*2048]` | 2.353005129369121e-05 | 2.2395722305092045e-05 | 4.82% | 5.06% | 1.05x | ✅ | +| `hexbytes_getitem_index[2-b'\\x01\\x02\\x03']` | 2.33074531422992e-05 | 2.237412942444611e-05 | 4.00% | 4.17% | 1.04x | ✅ | +| `hexbytes_getitem_index[2-b'\\x10\\x20\\x30\\x40\\x50']` | 2.321343591275329e-05 | 2.254406730437095e-05 | 2.88% | 2.97% | 1.03x | ✅ | +| `hexbytes_getitem_index[2-b'\\x7f'*8]` | 2.3527214043220956e-05 | 2.2674214666592336e-05 | 3.63% | 3.76% | 1.04x | ✅ | +| `hexbytes_getitem_index[2-b'\\x80'*8]` | 2.337044839325868e-05 | 2.2452453944729094e-05 | 3.93% | 4.09% | 1.04x | ✅ | +| `hexbytes_getitem_index[2-b'\\xde\\xad\\xbe\\xef']` | 2.340673201496728e-05 | 2.240066612867552e-05 | 4.30% | 4.49% | 1.04x | ✅ | +| `hexbytes_getitem_index[2-b'\\xff'*64]` | 2.360131229298037e-05 | 2.2244556857409582e-05 | 5.75% | 6.10% | 1.06x | ✅ | +| `hexbytes_getitem_index[2-b'a'*1024]` | 2.3665018000383798e-05 | 2.5125172281399264e-05 | -6.17% | -5.81% | 0.94x | ❌ | +| `hexbytes_getitem_index[2-b'abc']` | 2.380289567004414e-05 | 2.245531909896443e-05 | 5.66% | 6.00% | 1.06x | ✅ | +| `hexbytes_getitem_index[2-long alternating]` | 2.3655027207555663e-05 | 2.2388121833366522e-05 | 5.36% | 5.66% | 1.06x | ✅ | +| `hexbytes_getitem_index[2-mixed pattern]` | 2.3737811757973662e-05 | 2.257145841923933e-05 | 4.91% | 5.17% | 1.05x | ✅ | +| `hexbytes_getitem_index[2-multiples of 0x10]` | 2.3642536640876452e-05 | 2.2526284317449725e-05 | 4.72% | 4.96% | 1.05x | ✅ | +| `hexbytes_getitem_index[2-palindrome ascii]` | 2.372753651435304e-05 | 2.2493329098700958e-05 | 5.20% | 5.49% | 1.05x | ✅ | +| `hexbytes_getitem_index[2-palindrome numeric]` | 2.3571672631195312e-05 | 2.253551626081466e-05 | 4.40% | 4.60% | 1.05x | ✅ | +| `hexbytes_getitem_index[2-palindrome]` | 2.3547101832961222e-05 | 2.268268239536875e-05 | 3.67% | 3.81% | 1.04x | ✅ | +| `hexbytes_getitem_index[2-repeated 0-9]` | 2.3513220158121124e-05 | 2.227612777128761e-05 | 5.26% | 5.55% | 1.06x | ✅ | +| `hexbytes_getitem_index[2-two patterns]` | 2.340848905314925e-05 | 2.272821272161723e-05 | 2.91% | 2.99% | 1.03x | ✅ | +| `hexbytes_getitem_index[3-0-9]` | 2.3576010352500134e-05 | 2.249933017323468e-05 | 4.57% | 4.79% | 1.05x | ✅ | +| `hexbytes_getitem_index[3-4-byte pattern]` | 2.385000037840209e-05 | 2.2461119585210943e-05 | 5.82% | 6.18% | 1.06x | ✅ | +| `hexbytes_getitem_index[3-all byte values]` | 2.3775252516393495e-05 | 2.248610239277294e-05 | 5.42% | 5.73% | 1.06x | ✅ | +| `hexbytes_getitem_index[3-alternating 0x00/0xff]` | 2.3620665725476133e-05 | 2.250075635537158e-05 | 4.74% | 4.98% | 1.05x | ✅ | +| `hexbytes_getitem_index[3-alternating 0xaa/0x55]` | 2.3541084222772135e-05 | 2.2464470518704077e-05 | 4.57% | 4.79% | 1.05x | ✅ | +| `hexbytes_getitem_index[3-ascii sentence]` | 2.346174931499305e-05 | 2.27957074799885e-05 | 2.84% | 2.92% | 1.03x | ✅ | +| `hexbytes_getitem_index[3-b'\\x00'*32]` | 2.3501243476908307e-05 | 2.2709342294336463e-05 | 3.37% | 3.49% | 1.03x | ✅ | +| `hexbytes_getitem_index[3-b'\\x00\\xff\\x00\\xff']` | 2.3555799904401475e-05 | 2.251219930254488e-05 | 4.43% | 4.64% | 1.05x | ✅ | +| `hexbytes_getitem_index[3-b'\\x01'*100]` | 2.36993936183925e-05 | 2.264406873357705e-05 | 4.45% | 4.66% | 1.05x | ✅ | +| `hexbytes_getitem_index[3-b'\\x01'*2048]` | 2.378989579510454e-05 | 2.2989998400409215e-05 | 3.36% | 3.48% | 1.03x | ✅ | +| `hexbytes_getitem_index[3-b'\\x10\\x20\\x30\\x40\\x50']` | 2.3634821435136594e-05 | 2.254072400583579e-05 | 4.63% | 4.85% | 1.05x | ✅ | +| `hexbytes_getitem_index[3-b'\\x7f'*8]` | 2.37200861957124e-05 | 2.2621822198159395e-05 | 4.63% | 4.85% | 1.05x | ✅ | +| `hexbytes_getitem_index[3-b'\\x80'*8]` | 2.360496022752374e-05 | 2.2543848811819762e-05 | 4.50% | 4.71% | 1.05x | ✅ | +| `hexbytes_getitem_index[3-b'\\xde\\xad\\xbe\\xef']` | 2.368350687795692e-05 | 2.2719638182910784e-05 | 4.07% | 4.24% | 1.04x | ✅ | +| `hexbytes_getitem_index[3-b'\\xff'*64]` | 2.3523289950363346e-05 | 2.248615551782306e-05 | 4.41% | 4.61% | 1.05x | ✅ | +| `hexbytes_getitem_index[3-b'a'*1024]` | 2.354283917780575e-05 | 2.2464599159274333e-05 | 4.58% | 4.80% | 1.05x | ✅ | +| `hexbytes_getitem_index[3-long alternating]` | 2.3579060017179824e-05 | 2.3978434677375887e-05 | -1.69% | -1.67% | 0.98x | ❌ | +| `hexbytes_getitem_index[3-mixed pattern]` | 2.3553754771224537e-05 | 2.282347126921508e-05 | 3.10% | 3.20% | 1.03x | ✅ | +| `hexbytes_getitem_index[3-multiples of 0x10]` | 2.3750767141469264e-05 | 2.252582817330135e-05 | 5.16% | 5.44% | 1.05x | ✅ | +| `hexbytes_getitem_index[3-palindrome ascii]` | 2.4650124072047144e-05 | 2.2396818517852645e-05 | 9.14% | 10.06% | 1.10x | ✅ | +| `hexbytes_getitem_index[3-palindrome numeric]` | 2.352077990326374e-05 | 2.274978676995817e-05 | 3.28% | 3.39% | 1.03x | ✅ | +| `hexbytes_getitem_index[3-palindrome]` | 2.3587277870466196e-05 | 2.2615664850080164e-05 | 4.12% | 4.30% | 1.04x | ✅ | +| `hexbytes_getitem_index[3-repeated 0-9]` | 2.408347461178827e-05 | 2.2835377243803067e-05 | 5.18% | 5.47% | 1.05x | ✅ | +| `hexbytes_getitem_index[3-two patterns]` | 2.3418577625506303e-05 | 2.2858807369489183e-05 | 2.39% | 2.45% | 1.02x | ✅ | +| `hexbytes_getitem_index[4-0-9]` | 2.3537196825790606e-05 | 2.2213506018573626e-05 | 5.62% | 5.96% | 1.06x | ✅ | +| `hexbytes_getitem_index[4-4-byte pattern]` | 2.3580105863717855e-05 | 2.230762278912365e-05 | 5.40% | 5.70% | 1.06x | ✅ | +| `hexbytes_getitem_index[4-all byte values]` | 2.3519478645725014e-05 | 2.2309578514028877e-05 | 5.14% | 5.42% | 1.05x | ✅ | +| `hexbytes_getitem_index[4-alternating 0x00/0xff]` | 2.350723066814595e-05 | 2.246099095156534e-05 | 4.45% | 4.66% | 1.05x | ✅ | +| `hexbytes_getitem_index[4-alternating 0xaa/0x55]` | 2.3685751734765844e-05 | 2.225148850941126e-05 | 6.06% | 6.45% | 1.06x | ✅ | +| `hexbytes_getitem_index[4-ascii sentence]` | 2.360457143146751e-05 | 2.2434029009138264e-05 | 4.96% | 5.22% | 1.05x | ✅ | +| `hexbytes_getitem_index[4-b'\\x00'*32]` | 2.3472392098610384e-05 | 2.2295223659813942e-05 | 5.02% | 5.28% | 1.05x | ✅ | +| `hexbytes_getitem_index[4-b'\\x01'*100]` | 2.3047541559492632e-05 | 2.2170109285260752e-05 | 3.81% | 3.96% | 1.04x | ✅ | +| `hexbytes_getitem_index[4-b'\\x01'*2048]` | 2.3743269875918887e-05 | 2.2303072436209178e-05 | 6.07% | 6.46% | 1.06x | ✅ | +| `hexbytes_getitem_index[4-b'\\x10\\x20\\x30\\x40\\x50']` | 2.3478806726330697e-05 | 2.2301505267799543e-05 | 5.01% | 5.28% | 1.05x | ✅ | +| `hexbytes_getitem_index[4-b'\\x7f'*8]` | 2.368720722307953e-05 | 2.2299659819566278e-05 | 5.86% | 6.22% | 1.06x | ✅ | +| `hexbytes_getitem_index[4-b'\\x80'*8]` | 2.3515450278779338e-05 | 2.2334273562173423e-05 | 5.02% | 5.29% | 1.05x | ✅ | +| `hexbytes_getitem_index[4-b'\\xff'*64]` | 2.3499989406680296e-05 | 2.2232979503789415e-05 | 5.39% | 5.70% | 1.06x | ✅ | +| `hexbytes_getitem_index[4-b'a'*1024]` | 2.343938543778619e-05 | 2.2285731820629667e-05 | 4.92% | 5.18% | 1.05x | ✅ | +| `hexbytes_getitem_index[4-long alternating]` | 2.3570199560485246e-05 | 2.238697799496658e-05 | 5.02% | 5.29% | 1.05x | ✅ | +| `hexbytes_getitem_index[4-mixed pattern]` | 2.3729716972989387e-05 | 2.2674647575012118e-05 | 4.45% | 4.65% | 1.05x | ✅ | +| `hexbytes_getitem_index[4-multiples of 0x10]` | 2.3545089639028536e-05 | 2.2284937116599952e-05 | 5.35% | 5.65% | 1.06x | ✅ | +| `hexbytes_getitem_index[4-palindrome ascii]` | 2.370522311246462e-05 | 2.226328353102064e-05 | 6.08% | 6.48% | 1.06x | ✅ | +| `hexbytes_getitem_index[4-palindrome numeric]` | 2.372963640010582e-05 | 2.2155294143450594e-05 | 6.63% | 7.11% | 1.07x | ✅ | +| `hexbytes_getitem_index[4-palindrome]` | 2.3624213413572695e-05 | 2.2213138820311965e-05 | 5.97% | 6.35% | 1.06x | ✅ | +| `hexbytes_getitem_index[4-repeated 0-9]` | 2.3628146410634584e-05 | 2.2408982601033284e-05 | 5.16% | 5.44% | 1.05x | ✅ | +| `hexbytes_getitem_index[4-two patterns]` | 2.373264530951133e-05 | 2.2480844769105957e-05 | 5.27% | 5.57% | 1.06x | ✅ | +| `hexbytes_getitem_index[5-0-9]` | 2.3602017481047336e-05 | 2.229941549805124e-05 | 5.52% | 5.84% | 1.06x | ✅ | +| `hexbytes_getitem_index[5-4-byte pattern]` | 2.3379511339428266e-05 | 2.247616470088032e-05 | 3.86% | 4.02% | 1.04x | ✅ | +| `hexbytes_getitem_index[5-all byte values]` | 2.3576271504153953e-05 | 2.2634634900502964e-05 | 3.99% | 4.16% | 1.04x | ✅ | +| `hexbytes_getitem_index[5-alternating 0x00/0xff]` | 2.373751669879084e-05 | 2.2234757221157685e-05 | 6.33% | 6.76% | 1.07x | ✅ | +| `hexbytes_getitem_index[5-alternating 0xaa/0x55]` | 2.3745904341684655e-05 | 2.2399087543428368e-05 | 5.67% | 6.01% | 1.06x | ✅ | +| `hexbytes_getitem_index[5-ascii sentence]` | 2.3691694466209017e-05 | 2.248142929640372e-05 | 5.11% | 5.38% | 1.05x | ✅ | +| `hexbytes_getitem_index[5-b'\\x00'*32]` | 2.3741275431181503e-05 | 2.2646020538464026e-05 | 4.61% | 4.84% | 1.05x | ✅ | +| `hexbytes_getitem_index[5-b'\\x01'*100]` | 2.3633107982612668e-05 | 2.2275880076416084e-05 | 5.74% | 6.09% | 1.06x | ✅ | +| `hexbytes_getitem_index[5-b'\\x01'*2048]` | 2.3710655249171262e-05 | 2.2344529408669472e-05 | 5.76% | 6.11% | 1.06x | ✅ | +| `hexbytes_getitem_index[5-b'\\x7f'*8]` | 2.3730829173121472e-05 | 2.2404394033385047e-05 | 5.59% | 5.92% | 1.06x | ✅ | +| `hexbytes_getitem_index[5-b'\\x80'*8]` | 2.3889296541693285e-05 | 2.2265206377808846e-05 | 6.80% | 7.29% | 1.07x | ✅ | +| `hexbytes_getitem_index[5-b'\\xff'*64]` | 2.36967651856715e-05 | 2.2562358699335254e-05 | 4.79% | 5.03% | 1.05x | ✅ | +| `hexbytes_getitem_index[5-b'a'*1024]` | 2.3507004000068462e-05 | 2.2543062239345965e-05 | 4.10% | 4.28% | 1.04x | ✅ | +| `hexbytes_getitem_index[5-long alternating]` | 2.3991399752071886e-05 | 2.2383703385345844e-05 | 6.70% | 7.18% | 1.07x | ✅ | +| `hexbytes_getitem_index[5-mixed pattern]` | 2.3742833746834207e-05 | 2.24864625182179e-05 | 5.29% | 5.59% | 1.06x | ✅ | +| `hexbytes_getitem_index[5-multiples of 0x10]` | 2.3786383813608743e-05 | 2.2349265596003387e-05 | 6.04% | 6.43% | 1.06x | ✅ | +| `hexbytes_getitem_index[5-palindrome ascii]` | 2.3569618000652596e-05 | 2.2358560365411047e-05 | 5.14% | 5.42% | 1.05x | ✅ | +| `hexbytes_getitem_index[5-palindrome]` | 2.3655680235117278e-05 | 2.239778922748858e-05 | 5.32% | 5.62% | 1.06x | ✅ | +| `hexbytes_getitem_index[5-repeated 0-9]` | 2.3812073408732064e-05 | 2.2412318671355585e-05 | 5.88% | 6.25% | 1.06x | ✅ | +| `hexbytes_getitem_index[5-two patterns]` | 2.3765649823838392e-05 | 2.2320559177681606e-05 | 6.08% | 6.47% | 1.06x | ✅ | +| `hexbytes_getitem_slice[slice(-3,None)-0-9]` | 8.30388151247685e-05 | 5.974196772849583e-05 | 28.06% | 39.00% | 1.39x | ✅ | +| `hexbytes_getitem_slice[slice(-3,None)-4-byte pattern]` | 8.375297990090131e-05 | 5.958217706474068e-05 | 28.86% | 40.57% | 1.41x | ✅ | +| `hexbytes_getitem_slice[slice(-3,None)-all byte values]` | 8.361016821467982e-05 | 6.0172421187179344e-05 | 28.03% | 38.95% | 1.39x | ✅ | +| `hexbytes_getitem_slice[slice(-3,None)-alternating 0x00/0xff]` | 8.30170166865535e-05 | 6.0370870116860724e-05 | 27.28% | 37.51% | 1.38x | ✅ | +| `hexbytes_getitem_slice[slice(-3,None)-alternating 0xaa/0x55]` | 8.313613171986278e-05 | 5.940580507392356e-05 | 28.54% | 39.95% | 1.40x | ✅ | +| `hexbytes_getitem_slice[slice(-3,None)-ascii sentence]` | 8.296036855893063e-05 | 6.025149743431761e-05 | 27.37% | 37.69% | 1.38x | ✅ | +| `hexbytes_getitem_slice[slice(-3,None)-b'']` | 8.135824719250991e-05 | 5.726857262743525e-05 | 29.61% | 42.06% | 1.42x | ✅ | +| `hexbytes_getitem_slice[slice(-3,None)-b'\\x00'*32]` | 8.220942673884756e-05 | 5.979658253378586e-05 | 27.26% | 37.48% | 1.37x | ✅ | +| `hexbytes_getitem_slice[slice(-3,None)-b'\\x00\\xff\\x00\\xff']` | 8.43643196448106e-05 | 6.004223358590643e-05 | 28.83% | 40.51% | 1.41x | ✅ | +| `hexbytes_getitem_slice[slice(-3,None)-b'\\x01'*100]` | 8.360289000301351e-05 | 5.962791279112184e-05 | 28.68% | 40.21% | 1.40x | ✅ | +| `hexbytes_getitem_slice[slice(-3,None)-b'\\x01'*2048]` | 8.265773682881185e-05 | 5.978796441306175e-05 | 27.67% | 38.25% | 1.38x | ✅ | +| `hexbytes_getitem_slice[slice(-3,None)-b'\\x01\\x02\\x03']` | 8.319841360473207e-05 | 6.030960284287987e-05 | 27.51% | 37.95% | 1.38x | ✅ | +| `hexbytes_getitem_slice[slice(-3,None)-b'\\x10\\x20\\x30\\x40\\x50']` | 8.344373454053871e-05 | 5.929052449074296e-05 | 28.95% | 40.74% | 1.41x | ✅ | +| `hexbytes_getitem_slice[slice(-3,None)-b'\\x7f'*8]` | 8.372106489945515e-05 | 5.920325731823158e-05 | 29.29% | 41.41% | 1.41x | ✅ | +| `hexbytes_getitem_slice[slice(-3,None)-b'\\x80'*8]` | 8.385600977202209e-05 | 5.9297395569426354e-05 | 29.29% | 41.42% | 1.41x | ✅ | +| `hexbytes_getitem_slice[slice(-3,None)-b'\\xde\\xad\\xbe\\xef']` | 8.314562369115489e-05 | 5.9369384408174854e-05 | 28.60% | 40.05% | 1.40x | ✅ | +| `hexbytes_getitem_slice[slice(-3,None)-b'\\xff'*64]` | 8.332756490504269e-05 | 5.900826063304261e-05 | 29.19% | 41.21% | 1.41x | ✅ | +| `hexbytes_getitem_slice[slice(-3,None)-b'a'*1024]` | 8.312618840000476e-05 | 5.979495487066626e-05 | 28.07% | 39.02% | 1.39x | ✅ | +| `hexbytes_getitem_slice[slice(-3,None)-b'abc']` | 8.385703515856632e-05 | 6.028367402120767e-05 | 28.11% | 39.10% | 1.39x | ✅ | +| `hexbytes_getitem_slice[slice(-3,None)-long alternating]` | 8.364521787093274e-05 | 5.958557071333933e-05 | 28.76% | 40.38% | 1.40x | ✅ | +| `hexbytes_getitem_slice[slice(-3,None)-mixed pattern]` | 8.32932185994307e-05 | 6.0332581149115977e-05 | 27.57% | 38.06% | 1.38x | ✅ | +| `hexbytes_getitem_slice[slice(-3,None)-multiples of 0x10]` | 8.242906111749164e-05 | 5.981759992529685e-05 | 27.43% | 37.80% | 1.38x | ✅ | +| `hexbytes_getitem_slice[slice(-3,None)-palindrome ascii]` | 8.385359967614687e-05 | 6.011068171486642e-05 | 28.31% | 39.50% | 1.39x | ✅ | +| `hexbytes_getitem_slice[slice(-3,None)-palindrome numeric]` | 8.40005908681848e-05 | 6.0068371114253004e-05 | 28.49% | 39.84% | 1.40x | ✅ | +| `hexbytes_getitem_slice[slice(-3,None)-palindrome]` | 8.518531691242643e-05 | 5.828737874627635e-05 | 31.58% | 46.15% | 1.46x | ✅ | +| `hexbytes_getitem_slice[slice(-3,None)-repeated 0-9]` | 8.538738885111364e-05 | 6.0281931253483786e-05 | 29.40% | 41.65% | 1.42x | ✅ | +| `hexbytes_getitem_slice[slice(-3,None)-single 0xff]` | 8.145036963290045e-05 | 5.8040992196251164e-05 | 28.74% | 40.33% | 1.40x | ✅ | +| `hexbytes_getitem_slice[slice(-3,None)-single null byte]` | 8.14418854953201e-05 | 5.8324130551876356e-05 | 28.39% | 39.64% | 1.40x | ✅ | +| `hexbytes_getitem_slice[slice(-3,None)-two patterns]` | 8.589874325598071e-05 | 6.030384954395382e-05 | 29.80% | 42.44% | 1.42x | ✅ | +| `hexbytes_getitem_slice[slice(0,3)-0-9]` | 8.454347599108936e-05 | 6.0587200907338523e-05 | 28.34% | 39.54% | 1.40x | ✅ | +| `hexbytes_getitem_slice[slice(0,3)-4-byte pattern]` | 8.45122004434002e-05 | 6.044426402384052e-05 | 28.48% | 39.82% | 1.40x | ✅ | +| `hexbytes_getitem_slice[slice(0,3)-all byte values]` | 8.392720968203999e-05 | 6.006694418480193e-05 | 28.43% | 39.72% | 1.40x | ✅ | +| `hexbytes_getitem_slice[slice(0,3)-alternating 0x00/0xff]` | 8.499767119133119e-05 | 6.039528397418928e-05 | 28.94% | 40.74% | 1.41x | ✅ | +| `hexbytes_getitem_slice[slice(0,3)-alternating 0xaa/0x55]` | 8.456780765164754e-05 | 6.047287582876879e-05 | 28.49% | 39.84% | 1.40x | ✅ | +| `hexbytes_getitem_slice[slice(0,3)-ascii sentence]` | 8.363027101268132e-05 | 6.001081544155575e-05 | 28.24% | 39.36% | 1.39x | ✅ | +| `hexbytes_getitem_slice[slice(0,3)-b'']` | 8.209503181091495e-05 | 5.7231600261878467e-05 | 30.29% | 43.44% | 1.43x | ✅ | +| `hexbytes_getitem_slice[slice(0,3)-b'\\x00'*32]` | 8.429138601626187e-05 | 5.986777553262876e-05 | 28.98% | 40.80% | 1.41x | ✅ | +| `hexbytes_getitem_slice[slice(0,3)-b'\\x00\\xff\\x00\\xff']` | 8.449139418748611e-05 | 5.981647480210914e-05 | 29.20% | 41.25% | 1.41x | ✅ | +| `hexbytes_getitem_slice[slice(0,3)-b'\\x01'*100]` | 8.41043787367813e-05 | 6.0102154281623076e-05 | 28.54% | 39.94% | 1.40x | ✅ | +| `hexbytes_getitem_slice[slice(0,3)-b'\\x01'*2048]` | 8.463946603446461e-05 | 6.072507685626701e-05 | 28.25% | 39.38% | 1.39x | ✅ | +| `hexbytes_getitem_slice[slice(0,3)-b'\\x01\\x02\\x03']` | 8.436062131286568e-05 | 6.042550742000852e-05 | 28.37% | 39.61% | 1.40x | ✅ | +| `hexbytes_getitem_slice[slice(0,3)-b'\\x10\\x20\\x30\\x40\\x50']` | 8.407275288164303e-05 | 6.0208376267930425e-05 | 28.39% | 39.64% | 1.40x | ✅ | +| `hexbytes_getitem_slice[slice(0,3)-b'\\x7f'*8]` | 8.40359606450767e-05 | 5.9637132612793676e-05 | 29.03% | 40.91% | 1.41x | ✅ | +| `hexbytes_getitem_slice[slice(0,3)-b'\\x80'*8]` | 8.446455676838324e-05 | 6.021461019475137e-05 | 28.71% | 40.27% | 1.40x | ✅ | +| `hexbytes_getitem_slice[slice(0,3)-b'\\xde\\xad\\xbe\\xef']` | 8.441565492876512e-05 | 5.981740930704092e-05 | 29.14% | 41.12% | 1.41x | ✅ | +| `hexbytes_getitem_slice[slice(0,3)-b'\\xff'*64]` | 8.432145460865879e-05 | 6.013070263305703e-05 | 28.69% | 40.23% | 1.40x | ✅ | +| `hexbytes_getitem_slice[slice(0,3)-b'a'*1024]` | 8.4256050816817e-05 | 6.055887485150245e-05 | 28.13% | 39.13% | 1.39x | ✅ | +| `hexbytes_getitem_slice[slice(0,3)-b'abc']` | 8.415672929454271e-05 | 6.040766485263629e-05 | 28.22% | 39.31% | 1.39x | ✅ | +| `hexbytes_getitem_slice[slice(0,3)-long alternating]` | 8.460227761173369e-05 | 5.989251035535988e-05 | 29.21% | 41.26% | 1.41x | ✅ | +| `hexbytes_getitem_slice[slice(0,3)-mixed pattern]` | 8.303167669890931e-05 | 6.095096365297069e-05 | 26.59% | 36.23% | 1.36x | ✅ | +| `hexbytes_getitem_slice[slice(0,3)-multiples of 0x10]` | 8.42567242483147e-05 | 6.0837107937451675e-05 | 27.80% | 38.50% | 1.38x | ✅ | +| `hexbytes_getitem_slice[slice(0,3)-palindrome ascii]` | 8.24238298322723e-05 | 6.026642387182083e-05 | 26.88% | 36.77% | 1.37x | ✅ | +| `hexbytes_getitem_slice[slice(0,3)-palindrome numeric]` | 8.289118892881509e-05 | 6.009400343034516e-05 | 27.50% | 37.94% | 1.38x | ✅ | +| `hexbytes_getitem_slice[slice(0,3)-palindrome]` | 8.420060892436717e-05 | 5.976776123120024e-05 | 29.02% | 40.88% | 1.41x | ✅ | +| `hexbytes_getitem_slice[slice(0,3)-repeated 0-9]` | 8.361435829002896e-05 | 5.988689040248024e-05 | 28.38% | 39.62% | 1.40x | ✅ | +| `hexbytes_getitem_slice[slice(0,3)-single 0xff]` | 8.207450641949347e-05 | 5.903174259825323e-05 | 28.08% | 39.03% | 1.39x | ✅ | +| `hexbytes_getitem_slice[slice(0,3)-single null byte]` | 8.15964000853899e-05 | 5.880622964172609e-05 | 27.93% | 38.75% | 1.39x | ✅ | +| `hexbytes_getitem_slice[slice(0,3)-two patterns]` | 8.324148780953776e-05 | 6.018653663487212e-05 | 27.70% | 38.31% | 1.38x | ✅ | +| `hexbytes_getitem_slice[slice(1,6)-0-9]` | 8.43259519664925e-05 | 6.0631605718717184e-05 | 28.10% | 39.08% | 1.39x | ✅ | +| `hexbytes_getitem_slice[slice(1,6)-4-byte pattern]` | 8.355265614590987e-05 | 6.049882645663349e-05 | 27.59% | 38.11% | 1.38x | ✅ | +| `hexbytes_getitem_slice[slice(1,6)-all byte values]` | 8.368752384188281e-05 | 6.0679565159777985e-05 | 27.49% | 37.92% | 1.38x | ✅ | +| `hexbytes_getitem_slice[slice(1,6)-alternating 0x00/0xff]` | 8.362879922802444e-05 | 6.089356041028733e-05 | 27.19% | 37.34% | 1.37x | ✅ | +| `hexbytes_getitem_slice[slice(1,6)-alternating 0xaa/0x55]` | 8.305002411217038e-05 | 6.083435095464481e-05 | 26.75% | 36.52% | 1.37x | ✅ | +| `hexbytes_getitem_slice[slice(1,6)-ascii sentence]` | 8.38274511249871e-05 | 6.219255540865889e-05 | 25.81% | 34.79% | 1.35x | ✅ | +| `hexbytes_getitem_slice[slice(1,6)-b'']` | 8.140288169666229e-05 | 5.787470290294113e-05 | 28.90% | 40.65% | 1.41x | ✅ | +| `hexbytes_getitem_slice[slice(1,6)-b'\\x00'*32]` | 8.30974847167894e-05 | 6.0225606615435476e-05 | 27.52% | 37.98% | 1.38x | ✅ | +| `hexbytes_getitem_slice[slice(1,6)-b'\\x00\\xff\\x00\\xff']` | 8.418443490975507e-05 | 5.958848967385628e-05 | 29.22% | 41.28% | 1.41x | ✅ | +| `hexbytes_getitem_slice[slice(1,6)-b'\\x01'*100]` | 8.39191268148017e-05 | 6.050497942396702e-05 | 27.90% | 38.70% | 1.39x | ✅ | +| `hexbytes_getitem_slice[slice(1,6)-b'\\x01'*2048]` | 8.377991672370648e-05 | 6.129063686565741e-05 | 26.84% | 36.69% | 1.37x | ✅ | +| `hexbytes_getitem_slice[slice(1,6)-b'\\x01\\x02\\x03']` | 8.429650567750775e-05 | 6.03085623201959e-05 | 28.46% | 39.78% | 1.40x | ✅ | +| `hexbytes_getitem_slice[slice(1,6)-b'\\x10\\x20\\x30\\x40\\x50']` | 8.212733293390555e-05 | 6.024597141305707e-05 | 26.64% | 36.32% | 1.36x | ✅ | +| `hexbytes_getitem_slice[slice(1,6)-b'\\x7f'*8]` | 8.349126006658662e-05 | 6.033781134604746e-05 | 27.73% | 38.37% | 1.38x | ✅ | +| `hexbytes_getitem_slice[slice(1,6)-b'\\x80'*8]` | 8.298766019753463e-05 | 6.0303527702103845e-05 | 27.33% | 37.62% | 1.38x | ✅ | +| `hexbytes_getitem_slice[slice(1,6)-b'\\xde\\xad\\xbe\\xef']` | 8.375833712101175e-05 | 6.025837024860317e-05 | 28.06% | 39.00% | 1.39x | ✅ | +| `hexbytes_getitem_slice[slice(1,6)-b'\\xff'*64]` | 8.279296606100152e-05 | 6.0354741832947256e-05 | 27.10% | 37.18% | 1.37x | ✅ | +| `hexbytes_getitem_slice[slice(1,6)-b'a'*1024]` | 8.369726598136753e-05 | 6.0787394416353865e-05 | 27.37% | 37.69% | 1.38x | ✅ | +| `hexbytes_getitem_slice[slice(1,6)-b'abc']` | 8.33975953078815e-05 | 6.0670448482286404e-05 | 27.25% | 37.46% | 1.37x | ✅ | +| `hexbytes_getitem_slice[slice(1,6)-long alternating]` | 8.325772790077907e-05 | 6.063150973065067e-05 | 27.18% | 37.32% | 1.37x | ✅ | +| `hexbytes_getitem_slice[slice(1,6)-mixed pattern]` | 8.336834648226309e-05 | 6.0960333270751124e-05 | 26.88% | 36.76% | 1.37x | ✅ | +| `hexbytes_getitem_slice[slice(1,6)-multiples of 0x10]` | 8.346109580505115e-05 | 6.075849272150297e-05 | 27.20% | 37.37% | 1.37x | ✅ | +| `hexbytes_getitem_slice[slice(1,6)-palindrome ascii]` | 8.367838453083825e-05 | 6.0235235916563827e-05 | 28.02% | 38.92% | 1.39x | ✅ | +| `hexbytes_getitem_slice[slice(1,6)-palindrome numeric]` | 8.401544476774352e-05 | 6.0745205829970156e-05 | 27.70% | 38.31% | 1.38x | ✅ | +| `hexbytes_getitem_slice[slice(1,6)-palindrome]` | 8.302556042199684e-05 | 6.036305062778827e-05 | 27.30% | 37.54% | 1.38x | ✅ | +| `hexbytes_getitem_slice[slice(1,6)-repeated 0-9]` | 8.389499292946268e-05 | 6.025498283485574e-05 | 28.18% | 39.23% | 1.39x | ✅ | +| `hexbytes_getitem_slice[slice(1,6)-single 0xff]` | 8.198046013101483e-05 | 5.807917593293117e-05 | 29.15% | 41.15% | 1.41x | ✅ | +| `hexbytes_getitem_slice[slice(1,6)-single null byte]` | 8.18057217505065e-05 | 5.801160666238077e-05 | 29.09% | 41.02% | 1.41x | ✅ | +| `hexbytes_getitem_slice[slice(1,6)-two patterns]` | 8.341036824341767e-05 | 6.058446907631278e-05 | 27.37% | 37.68% | 1.38x | ✅ | +| `hexbytes_getitem_slice[slice(2,None)-0-9]` | 8.056142928069139e-05 | 5.932610690953358e-05 | 26.36% | 35.79% | 1.36x | ✅ | +| `hexbytes_getitem_slice[slice(2,None)-4-byte pattern]` | 8.280384736939069e-05 | 6.0699500740082045e-05 | 26.69% | 36.42% | 1.36x | ✅ | +| `hexbytes_getitem_slice[slice(2,None)-all byte values]` | 8.318570478366326e-05 | 6.0518874594629106e-05 | 27.25% | 37.45% | 1.37x | ✅ | +| `hexbytes_getitem_slice[slice(2,None)-alternating 0x00/0xff]` | 8.340139295848626e-05 | 5.9419763708352866e-05 | 28.75% | 40.36% | 1.40x | ✅ | +| `hexbytes_getitem_slice[slice(2,None)-alternating 0xaa/0x55]` | 8.343246143411365e-05 | 5.907229085978559e-05 | 29.20% | 41.24% | 1.41x | ✅ | +| `hexbytes_getitem_slice[slice(2,None)-ascii sentence]` | 8.32739689693414e-05 | 5.872746802326737e-05 | 29.48% | 41.80% | 1.42x | ✅ | +| `hexbytes_getitem_slice[slice(2,None)-b'']` | 8.075462932427068e-05 | 5.7308668677736426e-05 | 29.03% | 40.91% | 1.41x | ✅ | +| `hexbytes_getitem_slice[slice(2,None)-b'\\x00'*32]` | 8.298614165392246e-05 | 6.0000392148342656e-05 | 27.70% | 38.31% | 1.38x | ✅ | +| `hexbytes_getitem_slice[slice(2,None)-b'\\x00\\xff\\x00\\xff']` | 8.262015444463298e-05 | 5.968463608963788e-05 | 27.76% | 38.43% | 1.38x | ✅ | +| `hexbytes_getitem_slice[slice(2,None)-b'\\x01'*100]` | 8.321795590988354e-05 | 6.018480210622123e-05 | 27.68% | 38.27% | 1.38x | ✅ | +| `hexbytes_getitem_slice[slice(2,None)-b'\\x01'*2048]` | 0.00010297547772419773 | 8.097321901724279e-05 | 21.37% | 27.17% | 1.27x | ✅ | +| `hexbytes_getitem_slice[slice(2,None)-b'\\x01\\x02\\x03']` | 8.044619363413883e-05 | 5.692465072729741e-05 | 29.24% | 41.32% | 1.41x | ✅ | +| `hexbytes_getitem_slice[slice(2,None)-b'\\x10\\x20\\x30\\x40\\x50']` | 8.327160135354066e-05 | 5.9627418448974144e-05 | 28.39% | 39.65% | 1.40x | ✅ | +| `hexbytes_getitem_slice[slice(2,None)-b'\\x7f'*8]` | 8.23954223852242e-05 | 5.924491540849989e-05 | 28.10% | 39.08% | 1.39x | ✅ | +| `hexbytes_getitem_slice[slice(2,None)-b'\\x80'*8]` | 8.255868352253954e-05 | 5.879546558138738e-05 | 28.78% | 40.42% | 1.40x | ✅ | +| `hexbytes_getitem_slice[slice(2,None)-b'\\xde\\xad\\xbe\\xef']` | 8.292055283612205e-05 | 5.9710332670067847e-05 | 27.99% | 38.87% | 1.39x | ✅ | +| `hexbytes_getitem_slice[slice(2,None)-b'\\xff'*64]` | 8.239734798712192e-05 | 5.922418072815931e-05 | 28.12% | 39.13% | 1.39x | ✅ | +| `hexbytes_getitem_slice[slice(2,None)-b'a'*1024]` | 9.886175605970168e-05 | 7.357511382990991e-05 | 25.58% | 34.37% | 1.34x | ✅ | +| `hexbytes_getitem_slice[slice(2,None)-b'abc']` | 8.137093460040369e-05 | 5.734148142472723e-05 | 29.53% | 41.91% | 1.42x | ✅ | +| `hexbytes_getitem_slice[slice(2,None)-long alternating]` | 0.00010120346073662373 | 7.309737544020189e-05 | 27.77% | 38.45% | 1.38x | ✅ | +| `hexbytes_getitem_slice[slice(2,None)-mixed pattern]` | 8.362987563184948e-05 | 5.9967447105371136e-05 | 28.29% | 39.46% | 1.39x | ✅ | +| `hexbytes_getitem_slice[slice(2,None)-multiples of 0x10]` | 8.15080897020665e-05 | 5.924169816872563e-05 | 27.32% | 37.59% | 1.38x | ✅ | +| `hexbytes_getitem_slice[slice(2,None)-palindrome ascii]` | 8.27725892009646e-05 | 5.923130601459847e-05 | 28.44% | 39.74% | 1.40x | ✅ | +| `hexbytes_getitem_slice[slice(2,None)-palindrome numeric]` | 8.26703357927777e-05 | 5.876092471873986e-05 | 28.92% | 40.69% | 1.41x | ✅ | +| `hexbytes_getitem_slice[slice(2,None)-palindrome]` | 8.208866877468639e-05 | 5.880220555716517e-05 | 28.37% | 39.60% | 1.40x | ✅ | +| `hexbytes_getitem_slice[slice(2,None)-repeated 0-9]` | 8.376995296961262e-05 | 5.999609341153718e-05 | 28.38% | 39.63% | 1.40x | ✅ | +| `hexbytes_getitem_slice[slice(2,None)-single 0xff]` | 8.133537076097424e-05 | 5.642052344160219e-05 | 30.63% | 44.16% | 1.44x | ✅ | +| `hexbytes_getitem_slice[slice(2,None)-single null byte]` | 8.13738318311498e-05 | 5.616877701865991e-05 | 30.97% | 44.87% | 1.45x | ✅ | +| `hexbytes_getitem_slice[slice(2,None)-two patterns]` | 8.373585746322378e-05 | 5.9153407585947314e-05 | 29.36% | 41.56% | 1.42x | ✅ | +| `hexbytes_getitem_slice[slice(None,None)-0-9]` | 8.194370514057105e-05 | 5.783746275315815e-05 | 29.42% | 41.68% | 1.42x | ✅ | +| `hexbytes_getitem_slice[slice(None,None)-4-byte pattern]` | 8.2155750785384e-05 | 5.928462178174182e-05 | 27.84% | 38.58% | 1.39x | ✅ | +| `hexbytes_getitem_slice[slice(None,None)-all byte values]` | 8.238038387224774e-05 | 5.941041951294707e-05 | 27.88% | 38.66% | 1.39x | ✅ | +| `hexbytes_getitem_slice[slice(None,None)-alternating 0x00/0xff]` | 8.213782279833962e-05 | 5.853302875060524e-05 | 28.74% | 40.33% | 1.40x | ✅ | +| `hexbytes_getitem_slice[slice(None,None)-alternating 0xaa/0x55]` | 8.166474895011831e-05 | 5.851202699107647e-05 | 28.35% | 39.57% | 1.40x | ✅ | +| `hexbytes_getitem_slice[slice(None,None)-ascii sentence]` | 8.127557261584109e-05 | 5.8510536960492956e-05 | 28.01% | 38.91% | 1.39x | ✅ | +| `hexbytes_getitem_slice[slice(None,None)-b'']` | 7.864901946742648e-05 | 5.491276865981801e-05 | 30.18% | 43.23% | 1.43x | ✅ | +| `hexbytes_getitem_slice[slice(None,None)-b'\\x00'*32]` | 8.140027224461524e-05 | 5.77354184890508e-05 | 29.07% | 40.99% | 1.41x | ✅ | +| `hexbytes_getitem_slice[slice(None,None)-b'\\x00\\xff\\x00\\xff']` | 8.136487169570919e-05 | 5.875159434414076e-05 | 27.79% | 38.49% | 1.38x | ✅ | +| `hexbytes_getitem_slice[slice(None,None)-b'\\x01'*100]` | 8.175923869798613e-05 | 5.8572683798405825e-05 | 28.36% | 39.59% | 1.40x | ✅ | +| `hexbytes_getitem_slice[slice(None,None)-b'\\x01'*2048]` | 0.00010602691890342189 | 7.939717078611532e-05 | 25.12% | 33.54% | 1.34x | ✅ | +| `hexbytes_getitem_slice[slice(None,None)-b'\\x01\\x02\\x03']` | 8.196324379198659e-05 | 5.82050245295629e-05 | 28.99% | 40.82% | 1.41x | ✅ | +| `hexbytes_getitem_slice[slice(None,None)-b'\\x10\\x20\\x30\\x40\\x50']` | 8.162627816565408e-05 | 5.843637970522368e-05 | 28.41% | 39.68% | 1.40x | ✅ | +| `hexbytes_getitem_slice[slice(None,None)-b'\\x7f'*8]` | 8.21471987960966e-05 | 5.77016628951427e-05 | 29.76% | 42.37% | 1.42x | ✅ | +| `hexbytes_getitem_slice[slice(None,None)-b'\\x80'*8]` | 8.176050058478607e-05 | 5.815095674391131e-05 | 28.88% | 40.60% | 1.41x | ✅ | +| `hexbytes_getitem_slice[slice(None,None)-b'\\xde\\xad\\xbe\\xef']` | 8.151977191004657e-05 | 5.835655718975721e-05 | 28.41% | 39.69% | 1.40x | ✅ | +| `hexbytes_getitem_slice[slice(None,None)-b'\\xff'*64]` | 8.113492237307905e-05 | 5.7470397829917084e-05 | 29.17% | 41.18% | 1.41x | ✅ | +| `hexbytes_getitem_slice[slice(None,None)-b'a'*1024]` | 9.883113051157147e-05 | 7.245412861541862e-05 | 26.69% | 36.41% | 1.36x | ✅ | +| `hexbytes_getitem_slice[slice(None,None)-b'abc']` | 8.202072545230366e-05 | 5.7844334915116016e-05 | 29.48% | 41.80% | 1.42x | ✅ | +| `hexbytes_getitem_slice[slice(None,None)-long alternating]` | 0.0001013935034848419 | 7.33083477501886e-05 | 27.70% | 38.31% | 1.38x | ✅ | +| `hexbytes_getitem_slice[slice(None,None)-mixed pattern]` | 8.186370183391493e-05 | 5.89571046497168e-05 | 27.98% | 38.85% | 1.39x | ✅ | +| `hexbytes_getitem_slice[slice(None,None)-multiples of 0x10]` | 8.191113723497395e-05 | 5.7948580598685945e-05 | 29.25% | 41.35% | 1.41x | ✅ | +| `hexbytes_getitem_slice[slice(None,None)-palindrome ascii]` | 8.214716583361791e-05 | 5.843134069166401e-05 | 28.87% | 40.59% | 1.41x | ✅ | +| `hexbytes_getitem_slice[slice(None,None)-palindrome numeric]` | 8.31435042714451e-05 | 5.8094353359514036e-05 | 30.13% | 43.12% | 1.43x | ✅ | +| `hexbytes_getitem_slice[slice(None,None)-palindrome]` | 8.12891802447415e-05 | 5.8349632564492215e-05 | 28.22% | 39.31% | 1.39x | ✅ | +| `hexbytes_getitem_slice[slice(None,None)-repeated 0-9]` | 8.17021352982232e-05 | 5.796983590232829e-05 | 29.05% | 40.94% | 1.41x | ✅ | +| `hexbytes_getitem_slice[slice(None,None)-single 0xff]` | 7.988367261327101e-05 | 5.598729192832613e-05 | 29.91% | 42.68% | 1.43x | ✅ | +| `hexbytes_getitem_slice[slice(None,None)-single null byte]` | 8.021587345609672e-05 | 5.5331935433973326e-05 | 31.02% | 44.97% | 1.45x | ✅ | +| `hexbytes_getitem_slice[slice(None,None)-two patterns]` | 8.190176510660492e-05 | 5.8478507299448175e-05 | 28.60% | 40.05% | 1.40x | ✅ | +| `hexbytes_new['']` | 7.14638036365002e-05 | 3.6254154599672435e-05 | 49.27% | 97.12% | 1.97x | ✅ | +| `hexbytes_new['0x'+'00'*64]` | 9.287994327804942e-05 | 4.905492313816793e-05 | 47.18% | 89.34% | 1.89x | ✅ | +| `hexbytes_new['0x'+'a'*128]` | 9.321101875013893e-05 | 4.907705730375601e-05 | 47.35% | 89.93% | 1.90x | ✅ | +| `hexbytes_new['0x'+'ff'*32]` | 8.872338912007005e-05 | 4.547720480524316e-05 | 48.74% | 95.09% | 1.95x | ✅ | +| `hexbytes_new['0x']` | 7.886365084985266e-05 | 3.715100207527047e-05 | 52.89% | 112.28% | 2.12x | ✅ | +| `hexbytes_new['0x1234']` | 8.623872816433201e-05 | 4.44025907047815e-05 | 48.51% | 94.22% | 1.94x | ✅ | +| `hexbytes_new['0xCAFEBABE']` | 8.614830473507889e-05 | 4.3958294405919485e-05 | 48.97% | 95.98% | 1.96x | ✅ | +| `hexbytes_new['0xabcdef']` | 8.660338990843487e-05 | 4.4100506224403834e-05 | 49.08% | 96.38% | 1.96x | ✅ | +| `hexbytes_new['0xdeadbeef']` | 8.635821698080613e-05 | 4.359479135929844e-05 | 49.52% | 98.09% | 1.98x | ✅ | +| `hexbytes_new['abc']` | 8.363837584385083e-05 | 4.6575349075679855e-05 | 44.31% | 79.58% | 1.80x | ✅ | +| `hexbytes_new['deadbeef']` | 7.768718423786706e-05 | 4.0718143640317914e-05 | 47.59% | 90.79% | 1.91x | ✅ | +| `hexbytes_new[0-9]` | 4.229327079289703e-05 | 2.6189287292384018e-05 | 38.08% | 61.49% | 1.61x | ✅ | +| `hexbytes_new[0]` | 0.00012447587940273987 | 6.0997476835458304e-05 | 51.00% | 104.07% | 2.04x | ✅ | +| `hexbytes_new[123456]` | 0.00012414348762016447 | 6.591816487667816e-05 | 46.90% | 88.33% | 1.88x | ✅ | +| `hexbytes_new[2**16]` | 0.00012762085052898652 | 6.546162987682679e-05 | 48.71% | 94.96% | 1.95x | ✅ | +| `hexbytes_new[2**256-1]` | 0.00013409927717393524 | 7.26471338089095e-05 | 45.83% | 84.59% | 1.85x | ✅ | +| `hexbytes_new[2**32]` | 0.00013075663267241125 | 6.891864001718936e-05 | 47.29% | 89.73% | 1.90x | ✅ | +| `hexbytes_new[2**64]` | 0.00013297397159393057 | 7.225898091470653e-05 | 45.66% | 84.02% | 1.84x | ✅ | +| `hexbytes_new[2**8]` | 0.0001269265283021604 | 6.288189451941512e-05 | 50.46% | 101.85% | 2.02x | ✅ | +| `hexbytes_new[4-byte pattern]` | 4.424933432149152e-05 | 2.7030373969690305e-05 | 38.91% | 63.70% | 1.64x | ✅ | +| `hexbytes_new[False]` | 6.206981214971313e-05 | 2.7338314186684588e-05 | 55.96% | 127.04% | 2.27x | ✅ | +| `hexbytes_new[True]` | 6.150845034740875e-05 | 2.7261251975765582e-05 | 55.68% | 125.63% | 2.26x | ✅ | +| `hexbytes_new[all byte values]` | 4.322321422405936e-05 | 2.7028676889111198e-05 | 37.47% | 59.92% | 1.60x | ✅ | +| `hexbytes_new[alternating 0x00/0xff]` | 4.318138167377625e-05 | 2.6125129045523777e-05 | 39.50% | 65.29% | 1.65x | ✅ | +| `hexbytes_new[alternating 0xaa/0x55]` | 4.491875282572908e-05 | 2.663429475686673e-05 | 40.71% | 68.65% | 1.69x | ✅ | +| `hexbytes_new[ascii sentence]` | 4.3688227632488575e-05 | 2.6074002344376176e-05 | 40.32% | 67.55% | 1.68x | ✅ | +| `hexbytes_new[b'']` | 4.27567283052601e-05 | 2.5998521918589314e-05 | 39.19% | 64.46% | 1.64x | ✅ | +| `hexbytes_new[b'\\x00'*32]` | 4.3667982472232435e-05 | 2.6417868318576768e-05 | 39.50% | 65.30% | 1.65x | ✅ | +| `hexbytes_new[b'\\x00\\xff\\x00\\xff']` | 4.2964947713059645e-05 | 2.6608183224598657e-05 | 38.07% | 61.47% | 1.61x | ✅ | +| `hexbytes_new[b'\\x01'*100]` | 4.376604389693765e-05 | 2.64491821237421e-05 | 39.57% | 65.47% | 1.65x | ✅ | +| `hexbytes_new[b'\\x01'*2048]` | 5.540759626494421e-05 | 3.874432058338106e-05 | 30.07% | 43.01% | 1.43x | ✅ | +| `hexbytes_new[b'\\x01\\x02\\x03']` | 4.2874337547385384e-05 | 2.6122196462722696e-05 | 39.07% | 64.13% | 1.64x | ✅ | +| `hexbytes_new[b'\\x10\\x20\\x30\\x40\\x50']` | 4.2539045725741594e-05 | 2.6071966965298128e-05 | 38.71% | 63.16% | 1.63x | ✅ | +| `hexbytes_new[b'\\x7f'*8]` | 4.271227931088447e-05 | 2.6085148895624344e-05 | 38.93% | 63.74% | 1.64x | ✅ | +| `hexbytes_new[b'\\x80'*8]` | 4.330706012723817e-05 | 2.612571216773257e-05 | 39.67% | 65.76% | 1.66x | ✅ | +| `hexbytes_new[b'\\xde\\xad\\xbe\\xef']` | 4.290179181665324e-05 | 2.617464481603589e-05 | 38.99% | 63.91% | 1.64x | ✅ | +| `hexbytes_new[b'\\xff'*64]` | 4.3763422880254916e-05 | 2.6631925494023984e-05 | 39.15% | 64.33% | 1.64x | ✅ | +| `hexbytes_new[b'a'*1024]` | 5.0996850466108756e-05 | 3.315920795510173e-05 | 34.98% | 53.79% | 1.54x | ✅ | +| `hexbytes_new[b'abc']` | 4.312344796893197e-05 | 2.6397335472610203e-05 | 38.79% | 63.36% | 1.63x | ✅ | +| `hexbytes_new[bytearray(0-9)]` | 6.95555467674014e-05 | 3.787057907977333e-05 | 45.55% | 83.67% | 1.84x | ✅ | +| `hexbytes_new[bytearray(4-byte pattern)]` | 7.033810763053322e-05 | 3.8262071396141393e-05 | 45.60% | 83.83% | 1.84x | ✅ | +| `hexbytes_new[bytearray(all byte values)]` | 6.992101743916858e-05 | 3.861889486211478e-05 | 44.77% | 81.05% | 1.81x | ✅ | +| `hexbytes_new[bytearray(alternating 0x00/0xff)]` | 6.975086024358698e-05 | 3.796567324586105e-05 | 45.57% | 83.72% | 1.84x | ✅ | +| `hexbytes_new[bytearray(alternating 0xaa/0x55)]` | 6.977925005524052e-05 | 3.8007883339629135e-05 | 45.53% | 83.59% | 1.84x | ✅ | +| `hexbytes_new[bytearray(ascii sentence)]` | 6.91287659557757e-05 | 3.75018620534071e-05 | 45.75% | 84.33% | 1.84x | ✅ | +| `hexbytes_new[bytearray(b'')]` | 6.733192041830041e-05 | 3.590439204503096e-05 | 46.68% | 87.53% | 1.88x | ✅ | +| `hexbytes_new[bytearray(b'\\x00'*32)]` | 7.004709397931802e-05 | 3.747602878282135e-05 | 46.50% | 86.91% | 1.87x | ✅ | +| `hexbytes_new[bytearray(b'\\x00\\xff\\x00\\xff')]` | 7.009933825365818e-05 | 3.7876488164147304e-05 | 45.97% | 85.07% | 1.85x | ✅ | +| `hexbytes_new[bytearray(b'\\x01'*100)]` | 6.983202728868121e-05 | 3.841461380354141e-05 | 44.99% | 81.79% | 1.82x | ✅ | +| `hexbytes_new[bytearray(b'\\x01'*2048)]` | 9.150336627404717e-05 | 5.591526537763019e-05 | 38.89% | 63.65% | 1.64x | ✅ | +| `hexbytes_new[bytearray(b'\\x01\\x02\\x03')]` | 7.063389487397726e-05 | 3.773388102263764e-05 | 46.58% | 87.19% | 1.87x | ✅ | +| `hexbytes_new[bytearray(b'\\x10\\x20\\x30\\x40\\x50')]` | 6.99340591666782e-05 | 3.816299995835928e-05 | 45.43% | 83.25% | 1.83x | ✅ | +| `hexbytes_new[bytearray(b'\\x7f'*8)]` | 6.913010985696697e-05 | 3.795018571018686e-05 | 45.10% | 82.16% | 1.82x | ✅ | +| `hexbytes_new[bytearray(b'\\x80'*8)]` | 6.94580309780633e-05 | 3.737236839794092e-05 | 46.19% | 85.85% | 1.86x | ✅ | +| `hexbytes_new[bytearray(b'\\xde\\xad\\xbe\\xef')]` | 6.98104776195999e-05 | 3.805968160332621e-05 | 45.48% | 83.42% | 1.83x | ✅ | +| `hexbytes_new[bytearray(b'\\xff'*64)]` | 6.93433961727389e-05 | 3.808602398676135e-05 | 45.08% | 82.07% | 1.82x | ✅ | +| `hexbytes_new[bytearray(b'a'*1024)]` | 8.577753287473044e-05 | 4.940095330343995e-05 | 42.41% | 73.64% | 1.74x | ✅ | +| `hexbytes_new[bytearray(b'abc')]` | 6.86498958009881e-05 | 3.740953128780973e-05 | 45.51% | 83.51% | 1.84x | ✅ | +| `hexbytes_new[bytearray(long alternating)]` | 8.583357432264511e-05 | 4.96066843390949e-05 | 42.21% | 73.03% | 1.73x | ✅ | +| `hexbytes_new[bytearray(mixed pattern)]` | 6.996455194799104e-05 | 3.8434577296362995e-05 | 45.07% | 82.04% | 1.82x | ✅ | +| `hexbytes_new[bytearray(multiples of 0x10)]` | 6.936167396151872e-05 | 3.770843136921391e-05 | 45.64% | 83.94% | 1.84x | ✅ | +| `hexbytes_new[bytearray(palindrome ascii)]` | 6.930844696518391e-05 | 3.7852213938648755e-05 | 45.39% | 83.10% | 1.83x | ✅ | +| `hexbytes_new[bytearray(palindrome numeric)]` | 7.001840905081622e-05 | 4.173124907948678e-05 | 40.40% | 67.78% | 1.68x | ✅ | +| `hexbytes_new[bytearray(palindrome)]` | 6.923400331803462e-05 | 3.766781415488292e-05 | 45.59% | 83.80% | 1.84x | ✅ | +| `hexbytes_new[bytearray(repeated 0-9)]` | 6.961646736643518e-05 | 3.8171665332991254e-05 | 45.17% | 82.38% | 1.82x | ✅ | +| `hexbytes_new[bytearray(single 0xff)]` | 6.951539313093669e-05 | 3.7905807957240355e-05 | 45.47% | 83.39% | 1.83x | ✅ | +| `hexbytes_new[bytearray(single null byte)]` | 7.002705185730866e-05 | 3.780377030057523e-05 | 46.02% | 85.24% | 1.85x | ✅ | +| `hexbytes_new[bytearray(two patterns)]` | 7.021730955006781e-05 | 3.819433051883357e-05 | 45.61% | 83.84% | 1.84x | ✅ | +| `hexbytes_new[long alternating]` | 5.152918805766896e-05 | 3.300556594521577e-05 | 35.95% | 56.12% | 1.56x | ✅ | +| `hexbytes_new[memoryview(0-9)]` | 8.022331148780298e-05 | 4.3579981072928074e-05 | 45.68% | 84.08% | 1.84x | ✅ | +| `hexbytes_new[memoryview(4-byte pattern)]` | 8.341540154237858e-05 | 4.38445649168893e-05 | 47.44% | 90.25% | 1.90x | ✅ | +| `hexbytes_new[memoryview(all byte values)]` | 8.293859730349804e-05 | 4.380901119766068e-05 | 47.18% | 89.32% | 1.89x | ✅ | +| `hexbytes_new[memoryview(alternating 0x00/0xff)]` | 8.1489545647376e-05 | 4.3979571726363436e-05 | 46.03% | 85.29% | 1.85x | ✅ | +| `hexbytes_new[memoryview(alternating 0xaa/0x55)]` | 8.099116148905616e-05 | 4.3424935085864754e-05 | 46.38% | 86.51% | 1.87x | ✅ | +| `hexbytes_new[memoryview(ascii sentence)]` | 8.310321258598485e-05 | 4.3297633791979736e-05 | 47.90% | 91.93% | 1.92x | ✅ | +| `hexbytes_new[memoryview(b'')]` | 8.188410303758324e-05 | 4.016491724069025e-05 | 50.95% | 103.87% | 2.04x | ✅ | +| `hexbytes_new[memoryview(b'\\x00'*32)]` | 8.338688091957809e-05 | 4.3429359304459876e-05 | 47.92% | 92.01% | 1.92x | ✅ | +| `hexbytes_new[memoryview(b'\\x00\\xff\\x00\\xff')]` | 8.340909693892604e-05 | 4.3500825943088554e-05 | 47.85% | 91.74% | 1.92x | ✅ | +| `hexbytes_new[memoryview(b'\\x01'*100)]` | 7.997783175652987e-05 | 4.388274631699859e-05 | 45.13% | 82.25% | 1.82x | ✅ | +| `hexbytes_new[memoryview(b'\\x01'*2048)]` | 0.00010169240252214409 | 6.311411081140181e-05 | 37.94% | 61.12% | 1.61x | ✅ | +| `hexbytes_new[memoryview(b'\\x01\\x02\\x03')]` | 8.4460586551187e-05 | 4.3752511320158954e-05 | 48.20% | 93.04% | 1.93x | ✅ | +| `hexbytes_new[memoryview(b'\\x10\\x20\\x30\\x40\\x50')]` | 8.22274015848023e-05 | 4.289337845164596e-05 | 47.84% | 91.70% | 1.92x | ✅ | +| `hexbytes_new[memoryview(b'\\x7f'*8)]` | 8.324568531610435e-05 | 4.351649760335474e-05 | 47.73% | 91.30% | 1.91x | ✅ | +| `hexbytes_new[memoryview(b'\\x80'*8)]` | 8.33645322052042e-05 | 4.338391968277489e-05 | 47.96% | 92.16% | 1.92x | ✅ | +| `hexbytes_new[memoryview(b'\\xde\\xad\\xbe\\xef')]` | 8.484956625465498e-05 | 4.353813319345513e-05 | 48.69% | 94.89% | 1.95x | ✅ | +| `hexbytes_new[memoryview(b'\\xff'*64)]` | 8.3430397782451e-05 | 4.3927261484952914e-05 | 47.35% | 89.93% | 1.90x | ✅ | +| `hexbytes_new[memoryview(b'a'*1024)]` | 0.00010047904689140954 | 5.6443398731331476e-05 | 43.83% | 78.02% | 1.78x | ✅ | +| `hexbytes_new[memoryview(b'abc')]` | 8.34114766484776e-05 | 4.346394261952448e-05 | 47.89% | 91.91% | 1.92x | ✅ | +| `hexbytes_new[memoryview(long alternating)]` | 9.787971164049838e-05 | 5.676548435978873e-05 | 42.00% | 72.43% | 1.72x | ✅ | +| `hexbytes_new[memoryview(mixed pattern)]` | 8.378598033602691e-05 | 4.328265993514059e-05 | 48.34% | 93.58% | 1.94x | ✅ | +| `hexbytes_new[memoryview(multiples of 0x10)]` | 8.20253774114009e-05 | 4.366698741190707e-05 | 46.76% | 87.84% | 1.88x | ✅ | +| `hexbytes_new[memoryview(palindrome ascii)]` | 8.268911083692241e-05 | 4.3133538000604524e-05 | 47.84% | 91.70% | 1.92x | ✅ | +| `hexbytes_new[memoryview(palindrome numeric)]` | 8.306993737839588e-05 | 4.3364824052142434e-05 | 47.80% | 91.56% | 1.92x | ✅ | +| `hexbytes_new[memoryview(palindrome)]` | 8.31876279291165e-05 | 4.370661270418656e-05 | 47.46% | 90.33% | 1.90x | ✅ | +| `hexbytes_new[memoryview(repeated 0-9)]` | 8.23495604683162e-05 | 4.3603825282673034e-05 | 47.05% | 88.86% | 1.89x | ✅ | +| `hexbytes_new[memoryview(single 0xff)]` | 8.268373658642514e-05 | 4.341736780573953e-05 | 47.49% | 90.44% | 1.90x | ✅ | +| `hexbytes_new[memoryview(single null byte)]` | 8.208563618100804e-05 | 4.3837933169361676e-05 | 46.59% | 87.25% | 1.87x | ✅ | +| `hexbytes_new[memoryview(two patterns)]` | 8.267537679797833e-05 | 4.333163509742315e-05 | 47.59% | 90.80% | 1.91x | ✅ | +| `hexbytes_new[mixed pattern]` | 4.392505894371362e-05 | 2.6601866589359637e-05 | 39.44% | 65.12% | 1.65x | ✅ | +| `hexbytes_new[multiples of 0x10]` | 4.343348036656633e-05 | 2.6273067206239062e-05 | 39.51% | 65.32% | 1.65x | ✅ | +| `hexbytes_new[palindrome ascii]` | 4.251207849330514e-05 | 2.6162733710625447e-05 | 38.46% | 62.49% | 1.62x | ✅ | +| `hexbytes_new[palindrome numeric]` | 4.2583072652377186e-05 | 2.62861354412074e-05 | 38.27% | 62.00% | 1.62x | ✅ | +| `hexbytes_new[palindrome]` | 4.2269347982501034e-05 | 2.6127132199485306e-05 | 38.19% | 61.78% | 1.62x | ✅ | +| `hexbytes_new[repeated 0-9]` | 4.382144246311918e-05 | 2.669771834215431e-05 | 39.08% | 64.14% | 1.64x | ✅ | +| `hexbytes_new[single 0xff]` | 4.285055823609423e-05 | 2.5757956684936326e-05 | 39.89% | 66.36% | 1.66x | ✅ | +| `hexbytes_new[single null byte]` | 4.315406991503432e-05 | 2.580524445125473e-05 | 40.20% | 67.23% | 1.67x | ✅ | +| `hexbytes_new[two patterns]` | 4.37496933715355e-05 | 2.6224226509567357e-05 | 40.06% | 66.83% | 1.67x | ✅ | +| `hexbytes_repr[0-9]` | 2.906798628681222e-05 | 1.4531913113973036e-05 | 50.01% | 100.03% | 2.00x | ✅ | +| `hexbytes_repr[4-byte pattern]` | 0.00011935082533055303 | 4.083441099235044e-05 | 65.79% | 192.28% | 2.92x | ✅ | +| `hexbytes_repr[all byte values]` | 0.00011953885360769618 | 4.0906192772751766e-05 | 65.78% | 192.23% | 2.92x | ✅ | +| `hexbytes_repr[alternating 0x00/0xff]` | 4.8766614966374895e-05 | 1.9830588723513578e-05 | 59.34% | 145.92% | 2.46x | ✅ | +| `hexbytes_repr[alternating 0xaa/0x55]` | 4.879737396349098e-05 | 1.991196490103694e-05 | 59.19% | 145.07% | 2.45x | ✅ | +| `hexbytes_repr[ascii sentence]` | 4.0355017432216155e-05 | 1.8182835967215847e-05 | 54.94% | 121.94% | 2.22x | ✅ | +| `hexbytes_repr[b'']` | 2.1396382325640314e-05 | 1.2031822807425543e-05 | 43.77% | 77.83% | 1.78x | ✅ | +| `hexbytes_repr[b'\\x00'*32]` | 3.636127133370274e-05 | 1.6711449068402516e-05 | 54.04% | 117.58% | 2.18x | ✅ | +| `hexbytes_repr[b'\\x00\\xff\\x00\\xff']` | 2.6344754874310393e-05 | 1.3998785811927036e-05 | 46.86% | 88.19% | 1.88x | ✅ | +| `hexbytes_repr[b'\\x01'*100]` | 6.141888043507738e-05 | 2.389577750429593e-05 | 61.09% | 157.03% | 2.57x | ✅ | +| `hexbytes_repr[b'\\x01'*2048]` | 0.0007651395210586643 | 0.00022305139081562906 | 70.85% | 243.03% | 3.43x | ✅ | +| `hexbytes_repr[b'\\x01\\x02\\x03']` | 2.632420191094396e-05 | 1.4028082142250416e-05 | 46.71% | 87.65% | 1.88x | ✅ | +| `hexbytes_repr[b'\\x10\\x20\\x30\\x40\\x50']` | 2.706277390156218e-05 | 1.403789537331631e-05 | 48.13% | 92.78% | 1.93x | ✅ | +| `hexbytes_repr[b'\\x7f'*8]` | 2.8376596198488254e-05 | 1.432204194824075e-05 | 49.53% | 98.13% | 1.98x | ✅ | +| `hexbytes_repr[b'\\x80'*8]` | 2.8549436341641795e-05 | 1.4395340086866826e-05 | 49.58% | 98.32% | 1.98x | ✅ | +| `hexbytes_repr[b'\\xde\\xad\\xbe\\xef']` | 2.6362181300417332e-05 | 1.396854297532199e-05 | 47.01% | 88.73% | 1.89x | ✅ | +| `hexbytes_repr[b'\\xff'*64]` | 4.8686630362055564e-05 | 1.9830965235271825e-05 | 59.27% | 145.51% | 2.46x | ✅ | +| `hexbytes_repr[b'a'*1024]` | 0.00039941884942643676 | 0.00012258952376106996 | 69.31% | 225.82% | 3.26x | ✅ | +| `hexbytes_repr[b'abc']` | 2.6385804359140176e-05 | 1.3872932654247955e-05 | 47.42% | 90.20% | 1.90x | ✅ | +| `hexbytes_repr[long alternating]` | 0.0003999947155260777 | 0.00012260052332378147 | 69.35% | 226.26% | 3.26x | ✅ | +| `hexbytes_repr[mixed pattern]` | 9.765705535730533e-05 | 3.3752756622427605e-05 | 65.44% | 189.33% | 2.89x | ✅ | +| `hexbytes_repr[multiples of 0x10]` | 2.9054582291393952e-05 | 1.4535057836989328e-05 | 49.97% | 99.89% | 2.00x | ✅ | +| `hexbytes_repr[palindrome ascii]` | 2.764780958800019e-05 | 1.3997407078561349e-05 | 49.37% | 97.52% | 1.98x | ✅ | +| `hexbytes_repr[palindrome numeric]` | 2.7119834752884084e-05 | 1.3884448310409815e-05 | 48.80% | 95.33% | 1.95x | ✅ | +| `hexbytes_repr[palindrome]` | 3.19139538471712e-05 | 1.5610305650399587e-05 | 51.09% | 104.44% | 2.04x | ✅ | +| `hexbytes_repr[repeated 0-9]` | 6.163221431809811e-05 | 2.339075241459804e-05 | 62.05% | 163.49% | 2.63x | ✅ | +| `hexbytes_repr[single 0xff]` | 2.556155348855207e-05 | 1.3534636647879307e-05 | 47.05% | 88.86% | 1.89x | ✅ | +| `hexbytes_repr[single null byte]` | 2.5477357675176088e-05 | 1.3488493283911999e-05 | 47.06% | 88.88% | 1.89x | ✅ | +| `hexbytes_repr[two patterns]` | 4.8746659369136945e-05 | 1.9840445470066074e-05 | 59.30% | 145.69% | 2.46x | ✅ | +| `hexbytes_to_0x_hex[0-9]` | 1.5751175843188188e-05 | 1.3512168268861273e-05 | 14.21% | 16.57% | 1.17x | ✅ | +| `hexbytes_to_0x_hex[4-byte pattern]` | 4.188944600410523e-05 | 3.972684342751932e-05 | 5.16% | 5.44% | 1.05x | ✅ | +| `hexbytes_to_0x_hex[all byte values]` | 4.198416473118811e-05 | 3.9905394372347894e-05 | 4.95% | 5.21% | 1.05x | ✅ | +| `hexbytes_to_0x_hex[alternating 0x00/0xff]` | 2.0729235575349237e-05 | 1.8759347999864966e-05 | 9.50% | 10.50% | 1.11x | ✅ | +| `hexbytes_to_0x_hex[alternating 0xaa/0x55]` | 2.0935197305447756e-05 | 1.9037620818789003e-05 | 9.06% | 9.97% | 1.10x | ✅ | +| `hexbytes_to_0x_hex[ascii sentence]` | 1.8680887434516488e-05 | 1.673122727529239e-05 | 10.44% | 11.65% | 1.12x | ✅ | +| `hexbytes_to_0x_hex[b'']` | 1.0129796390515284e-05 | 1.1230908929698665e-05 | -10.87% | -9.80% | 0.90x | ❌ | +| `hexbytes_to_0x_hex[b'\\x00'*32]` | 1.747934309800761e-05 | 1.5828109926636758e-05 | 9.45% | 10.43% | 1.10x | ✅ | +| `hexbytes_to_0x_hex[b'\\x00\\xff\\x00\\xff']` | 1.4976104490067639e-05 | 1.3079329502293043e-05 | 12.67% | 14.50% | 1.15x | ✅ | +| `hexbytes_to_0x_hex[b'\\x01'*100]` | 2.5136693060848967e-05 | 2.2702589812717672e-05 | 9.68% | 10.72% | 1.11x | ✅ | +| `hexbytes_to_0x_hex[b'\\x01'*2048]` | 0.0002229201516443345 | 0.0002219118834105949 | 0.45% | 0.45% | 1.00x | ✅ | +| `hexbytes_to_0x_hex[b'\\x01\\x02\\x03']` | 1.4759359703304708e-05 | 1.2904398127835308e-05 | 12.57% | 14.37% | 1.14x | ✅ | +| `hexbytes_to_0x_hex[b'\\x10\\x20\\x30\\x40\\x50']` | 1.5034359717442118e-05 | 1.3507130242500617e-05 | 10.16% | 11.31% | 1.11x | ✅ | +| `hexbytes_to_0x_hex[b'\\x7f'*8]` | 1.6442674135908144e-05 | 1.3449368062563744e-05 | 18.20% | 22.26% | 1.22x | ✅ | +| `hexbytes_to_0x_hex[b'\\x80'*8]` | 1.5284441435804402e-05 | 1.341387379371508e-05 | 12.24% | 13.95% | 1.14x | ✅ | +| `hexbytes_to_0x_hex[b'\\xde\\xad\\xbe\\xef']` | 1.4818882536857224e-05 | 1.3113785223065585e-05 | 11.51% | 13.00% | 1.13x | ✅ | +| `hexbytes_to_0x_hex[b'\\xff'*64]` | 2.0653224627941112e-05 | 1.880171410021685e-05 | 8.96% | 9.85% | 1.10x | ✅ | +| `hexbytes_to_0x_hex[b'a'*1024]` | 0.00012215348819907536 | 0.00012176789988852488 | 0.32% | 0.32% | 1.00x | ✅ | +| `hexbytes_to_0x_hex[b'abc']` | 1.476645561092787e-05 | 1.2842567312862918e-05 | 13.03% | 14.98% | 1.15x | ✅ | +| `hexbytes_to_0x_hex[long alternating]` | 0.00012236644545641535 | 0.00012102260530175359 | 1.10% | 1.11% | 1.01x | ✅ | +| `hexbytes_to_0x_hex[mixed pattern]` | 3.4963886205126254e-05 | 3.2889936730400586e-05 | 5.93% | 6.31% | 1.06x | ✅ | +| `hexbytes_to_0x_hex[multiples of 0x10]` | 1.5641651068076332e-05 | 1.409609734237564e-05 | 9.88% | 10.96% | 1.11x | ✅ | +| `hexbytes_to_0x_hex[palindrome ascii]` | 1.5071756320538221e-05 | 1.3222747996462207e-05 | 12.27% | 13.98% | 1.14x | ✅ | +| `hexbytes_to_0x_hex[palindrome numeric]` | 1.498200289295834e-05 | 1.327094536511816e-05 | 11.42% | 12.89% | 1.13x | ✅ | +| `hexbytes_to_0x_hex[palindrome]` | 1.643034873494635e-05 | 1.4635341821183812e-05 | 10.92% | 12.26% | 1.12x | ✅ | +| `hexbytes_to_0x_hex[repeated 0-9]` | 2.5167728154543546e-05 | 2.273393673682945e-05 | 9.67% | 10.71% | 1.11x | ✅ | +| `hexbytes_to_0x_hex[single 0xff]` | 1.4659952030930308e-05 | 1.2670889720289785e-05 | 13.57% | 15.70% | 1.16x | ✅ | +| `hexbytes_to_0x_hex[single null byte]` | 1.4580408318988365e-05 | 1.2707411692001782e-05 | 12.85% | 14.74% | 1.15x | ✅ | +| `hexbytes_to_0x_hex[two patterns]` | 2.071625963528691e-05 | 1.8746568542236906e-05 | 9.51% | 10.51% | 1.11x | ✅ | diff --git a/benchmarks/test__utils_benchmarks.py b/benchmarks/test__utils_benchmarks.py new file mode 100644 index 0000000..5049c14 --- /dev/null +++ b/benchmarks/test__utils_benchmarks.py @@ -0,0 +1,43 @@ +from typing import Any, Callable + +import hexbytes._utils +import pytest +from eth_typing import HexStr +from pytest_codspeed import BenchmarkFixture + +import faster_hexbytes._utils +from benchmarks.params import ( + TO_BYTES_VALS, + TO_BYTES_IDS, + HEXSTRINGS, + HEXSTRINGS_IDS, +) + + +def run_100(func: Callable[..., Any], *args: Any) -> None: + for i in range(100): + func(*args) + + +@pytest.mark.benchmark(group="to_bytes") +@pytest.mark.parametrize("val", TO_BYTES_VALS, ids=TO_BYTES_IDS) +def test_to_bytes(benchmark: BenchmarkFixture, val: Any) -> None: + benchmark(run_100, hexbytes._utils.to_bytes, val) + + +@pytest.mark.benchmark(group="to_bytes") +@pytest.mark.parametrize("val", TO_BYTES_VALS, ids=TO_BYTES_IDS) +def test_faster_to_bytes(benchmark: BenchmarkFixture, val: Any) -> None: + benchmark(run_100, faster_hexbytes._utils.to_bytes, val) + + +@pytest.mark.benchmark(group="hexstr_to_bytes") +@pytest.mark.parametrize("hexstr", HEXSTRINGS, ids=HEXSTRINGS_IDS) +def test_hexstr_to_bytes(benchmark: BenchmarkFixture, hexstr: HexStr) -> None: + benchmark(run_100, hexbytes._utils.hexstr_to_bytes, hexstr) + + +@pytest.mark.benchmark(group="hexstr_to_bytes") +@pytest.mark.parametrize("hexstr", HEXSTRINGS, ids=HEXSTRINGS_IDS) +def test_faster_hexstr_to_bytes(benchmark: BenchmarkFixture, hexstr: HexStr) -> None: + benchmark(run_100, faster_hexbytes._utils.hexstr_to_bytes, hexstr) diff --git a/benchmarks/test_main_benchmarks.py b/benchmarks/test_main_benchmarks.py new file mode 100644 index 0000000..0ed29c8 --- /dev/null +++ b/benchmarks/test_main_benchmarks.py @@ -0,0 +1,102 @@ +from typing import Any, Callable + +import hexbytes +import pytest +from pytest_codspeed import BenchmarkFixture + +import faster_hexbytes +from benchmarks.params import ( + CONSTRUCTOR_VALS, + CONSTRUCTOR_IDS, + BYTES_VALS, + BYTES_IDS, + SLICES, + SLICE_IDS, +) + + +def run_100(func: Callable[..., Any], *args: Any) -> None: + for i in range(100): + func(*args) + + +@pytest.mark.benchmark(group="HexBytes.__new__") +@pytest.mark.parametrize("val", CONSTRUCTOR_VALS, ids=CONSTRUCTOR_IDS) +def test_hexbytes_new(benchmark: BenchmarkFixture, val: Any) -> None: + benchmark(run_100, hexbytes.HexBytes, val) + + +@pytest.mark.benchmark(group="HexBytes.__new__") +@pytest.mark.parametrize("val", CONSTRUCTOR_VALS, ids=CONSTRUCTOR_IDS) +def test_faster_hexbytes_new(benchmark: BenchmarkFixture, val: Any) -> None: + benchmark(run_100, faster_hexbytes.HexBytes, val) + + +@pytest.mark.benchmark(group="HexBytes.__getitem__ (index)") +@pytest.mark.parametrize("val", BYTES_VALS, ids=BYTES_IDS) +@pytest.mark.parametrize("idx", [0, 1, 2, 3, 4, 5, -1]) +def test_hexbytes_getitem_index( + benchmark: BenchmarkFixture, val: bytes, idx: int +) -> None: + obj = hexbytes.HexBytes(val) + if len(val) > abs(idx): + benchmark(run_100, lambda: obj[idx]) + + +@pytest.mark.benchmark(group="HexBytes.__getitem__ (index)") +@pytest.mark.parametrize("val", BYTES_VALS, ids=BYTES_IDS) +@pytest.mark.parametrize("idx", [0, 1, 2, 3, 4, 5, -1]) +def test_faster_hexbytes_getitem_index( + benchmark: BenchmarkFixture, val: bytes, idx: int +) -> None: + obj = faster_hexbytes.HexBytes(val) + if len(val) > abs(idx): + benchmark(run_100, lambda: obj[idx]) + + +@pytest.mark.benchmark(group="HexBytes.__getitem__ (slice)") +@pytest.mark.parametrize("val", BYTES_VALS, ids=BYTES_IDS) +@pytest.mark.parametrize("slice_", SLICES, ids=SLICE_IDS) +def test_hexbytes_getitem_slice( + benchmark: BenchmarkFixture, val: bytes, slice_: slice +) -> None: + obj = hexbytes.HexBytes(val) + benchmark(run_100, lambda: obj[slice_]) + + +@pytest.mark.benchmark(group="HexBytes.__getitem__ (slice)") +@pytest.mark.parametrize("val", BYTES_VALS, ids=BYTES_IDS) +@pytest.mark.parametrize("slice_", SLICES, ids=SLICE_IDS) +def test_faster_hexbytes_getitem_slice( + benchmark: BenchmarkFixture, val: bytes, slice_: slice +) -> None: + obj = faster_hexbytes.HexBytes(val) + benchmark(run_100, lambda: obj[slice_]) + + +@pytest.mark.benchmark(group="HexBytes.__repr__") +@pytest.mark.parametrize("val", BYTES_VALS, ids=BYTES_IDS) +def test_hexbytes_repr(benchmark: BenchmarkFixture, val: bytes) -> None: + obj = hexbytes.HexBytes(val) + benchmark(run_100, obj.__repr__) + + +@pytest.mark.benchmark(group="HexBytes.__repr__") +@pytest.mark.parametrize("val", BYTES_VALS, ids=BYTES_IDS) +def test_faster_hexbytes_repr(benchmark: BenchmarkFixture, val: bytes) -> None: + obj = faster_hexbytes.HexBytes(val) + benchmark(run_100, obj.__repr__) + + +@pytest.mark.benchmark(group="HexBytes.to_0x_hex") +@pytest.mark.parametrize("val", BYTES_VALS, ids=BYTES_IDS) +def test_hexbytes_to_0x_hex(benchmark: BenchmarkFixture, val: bytes) -> None: + obj = hexbytes.HexBytes(val) + benchmark(run_100, obj.to_0x_hex) + + +@pytest.mark.benchmark(group="HexBytes.to_0x_hex") +@pytest.mark.parametrize("val", BYTES_VALS, ids=BYTES_IDS) +def test_faster_hexbytes_to_0x_hex(benchmark: BenchmarkFixture, val: bytes) -> None: + obj = faster_hexbytes.HexBytes(val) + benchmark(run_100, obj.to_0x_hex) diff --git a/build/__native_faster_hexbytes.c b/build/__native_faster_hexbytes.c new file mode 100644 index 0000000..11d0949 --- /dev/null +++ b/build/__native_faster_hexbytes.c @@ -0,0 +1,3611 @@ +#ifndef DIFFCHECK_PLACEHOLDER +#define DIFFCHECK_PLACEHOLDER 0 +#endif +#include "init.c" +#include "getargs.c" +#include "getargsfast.c" +#include "int_ops.c" +#include "float_ops.c" +#include "str_ops.c" +#include "bytes_ops.c" +#include "list_ops.c" +#include "dict_ops.c" +#include "set_ops.c" +#include "tuple_ops.c" +#include "exc_ops.c" +#include "misc_ops.c" +#include "generic_ops.c" +#include "pythonsupport.c" +#include "__native_faster_hexbytes.h" +#include "__native_internal_faster_hexbytes.h" +static PyMethodDef faster_hexbytesmodule_methods[] = { + {NULL, NULL, 0, NULL} +}; + +int CPyExec_faster_hexbytes(PyObject *module) +{ + PyObject* modname = NULL; + modname = PyObject_GetAttrString((PyObject *)CPyModule_faster_hexbytes__internal, "__name__"); + CPyStatic_faster_hexbytes___globals = PyModule_GetDict(CPyModule_faster_hexbytes__internal); + if (unlikely(CPyStatic_faster_hexbytes___globals == NULL)) + goto fail; + if (CPyGlobalsInit() < 0) + goto fail; + char result = CPyDef_faster_hexbytes_____top_level__(); + if (result == 2) + goto fail; + Py_DECREF(modname); + return 0; + fail: + Py_CLEAR(CPyModule_faster_hexbytes__internal); + Py_CLEAR(modname); + return -1; +} +static struct PyModuleDef faster_hexbytesmodule = { + PyModuleDef_HEAD_INIT, + "faster_hexbytes", + NULL, /* docstring */ + 0, /* size of per-interpreter state of the module */ + faster_hexbytesmodule_methods, + NULL, +}; + +PyObject *CPyInit_faster_hexbytes(void) +{ + if (CPyModule_faster_hexbytes__internal) { + Py_INCREF(CPyModule_faster_hexbytes__internal); + return CPyModule_faster_hexbytes__internal; + } + CPyModule_faster_hexbytes__internal = PyModule_Create(&faster_hexbytesmodule); + if (unlikely(CPyModule_faster_hexbytes__internal == NULL)) + goto fail; + if (CPyExec_faster_hexbytes(CPyModule_faster_hexbytes__internal) != 0) + goto fail; + return CPyModule_faster_hexbytes__internal; + fail: + return NULL; +} + +char CPyDef_faster_hexbytes_____top_level__(void) { + PyObject *cpy_r_r0; + PyObject *cpy_r_r1; + char cpy_r_r2; + PyObject *cpy_r_r3; + PyObject *cpy_r_r4; + PyObject *cpy_r_r5; + PyObject *cpy_r_r6; + PyObject *cpy_r_r7; + PyObject *cpy_r_r8; + PyObject *cpy_r_r9; + PyObject *cpy_r_r10; + PyObject *cpy_r_r11; + PyObject *cpy_r_r12; + PyObject *cpy_r_r13; + PyObject *cpy_r_r14; + PyObject *cpy_r_r15; + CPyPtr cpy_r_r16; + CPyPtr cpy_r_r17; + PyObject *cpy_r_r18; + PyObject *cpy_r_r19; + int32_t cpy_r_r20; + char cpy_r_r21; + PyObject *cpy_r_r22; + PyObject *cpy_r_r23; + PyObject *cpy_r_r24; + PyObject *cpy_r_r25; + PyObject **cpy_r_r27; + PyObject *cpy_r_r28; + PyObject *cpy_r_r29; + PyObject *cpy_r_r30; + PyObject *cpy_r_r31; + int32_t cpy_r_r32; + char cpy_r_r33; + char cpy_r_r34; + cpy_r_r0 = CPyModule_builtins; + cpy_r_r1 = (PyObject *)&_Py_NoneStruct; + cpy_r_r2 = cpy_r_r0 != cpy_r_r1; + if (cpy_r_r2) goto CPyL3; + cpy_r_r3 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* 'builtins' */ + cpy_r_r4 = PyImport_Import(cpy_r_r3); + if (unlikely(cpy_r_r4 == NULL)) { + CPy_AddTraceback("faster_hexbytes/__init__.py", "", -1, CPyStatic_faster_hexbytes___globals); + goto CPyL12; + } + CPyModule_builtins = cpy_r_r4; + CPy_INCREF(CPyModule_builtins); + CPy_DECREF(cpy_r_r4); +CPyL3: ; + cpy_r_r5 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* ('version',) */ + cpy_r_r6 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* ('__version',) */ + cpy_r_r7 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* 'importlib.metadata' */ + cpy_r_r8 = CPyStatic_faster_hexbytes___globals; + cpy_r_r9 = CPyImport_ImportFromMany(cpy_r_r7, cpy_r_r5, cpy_r_r6, cpy_r_r8); + if (unlikely(cpy_r_r9 == NULL)) { + CPy_AddTraceback("faster_hexbytes/__init__.py", "", DIFFCHECK_PLACEHOLDER, CPyStatic_faster_hexbytes___globals); + goto CPyL12; + } + CPyModule_importlib___metadata = cpy_r_r9; + CPy_INCREF(CPyModule_importlib___metadata); + CPy_DECREF(cpy_r_r9); + cpy_r_r10 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* ('HexBytes',) */ + cpy_r_r11 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* 'faster_hexbytes.main' */ + cpy_r_r12 = CPyStatic_faster_hexbytes___globals; + cpy_r_r13 = CPyImport_ImportFromMany(cpy_r_r11, cpy_r_r10, cpy_r_r10, cpy_r_r12); + if (unlikely(cpy_r_r13 == NULL)) { + CPy_AddTraceback("faster_hexbytes/__init__.py", "", DIFFCHECK_PLACEHOLDER, CPyStatic_faster_hexbytes___globals); + goto CPyL12; + } + CPyModule_faster_hexbytes___main = cpy_r_r13; + CPy_INCREF(CPyModule_faster_hexbytes___main); + CPy_DECREF(cpy_r_r13); + cpy_r_r14 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* 'HexBytes' */ + cpy_r_r15 = PyList_New(1); + if (unlikely(cpy_r_r15 == NULL)) { + CPy_AddTraceback("faster_hexbytes/__init__.py", "", DIFFCHECK_PLACEHOLDER, CPyStatic_faster_hexbytes___globals); + goto CPyL12; + } + cpy_r_r16 = (CPyPtr)&((PyListObject *)cpy_r_r15)->ob_item; + cpy_r_r17 = *(CPyPtr *)cpy_r_r16; + CPy_INCREF(cpy_r_r14); + *(PyObject * *)cpy_r_r17 = cpy_r_r14; + cpy_r_r18 = CPyStatic_faster_hexbytes___globals; + cpy_r_r19 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* '__all__' */ + cpy_r_r20 = CPyDict_SetItem(cpy_r_r18, cpy_r_r19, cpy_r_r15); + CPy_DECREF_NO_IMM(cpy_r_r15); + cpy_r_r21 = cpy_r_r20 >= 0; + if (unlikely(!cpy_r_r21)) { + CPy_AddTraceback("faster_hexbytes/__init__.py", "", DIFFCHECK_PLACEHOLDER, CPyStatic_faster_hexbytes___globals); + goto CPyL12; + } + cpy_r_r22 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* 'hexbytes' */ + cpy_r_r23 = CPyStatic_faster_hexbytes___globals; + cpy_r_r24 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* '__version' */ + cpy_r_r25 = CPyDict_GetItem(cpy_r_r23, cpy_r_r24); + if (unlikely(cpy_r_r25 == NULL)) { + CPy_AddTraceback("faster_hexbytes/__init__.py", "", DIFFCHECK_PLACEHOLDER, CPyStatic_faster_hexbytes___globals); + goto CPyL12; + } + PyObject *cpy_r_r26[1] = {cpy_r_r22}; + cpy_r_r27 = (PyObject **)&cpy_r_r26; + cpy_r_r28 = PyObject_Vectorcall(cpy_r_r25, cpy_r_r27, 1, 0); + CPy_DECREF(cpy_r_r25); + if (unlikely(cpy_r_r28 == NULL)) { + CPy_AddTraceback("faster_hexbytes/__init__.py", "", DIFFCHECK_PLACEHOLDER, CPyStatic_faster_hexbytes___globals); + goto CPyL12; + } + if (likely(PyUnicode_Check(cpy_r_r28))) + cpy_r_r29 = cpy_r_r28; + else { + CPy_TypeErrorTraceback("faster_hexbytes/__init__.py", "", 11, CPyStatic_faster_hexbytes___globals, "str", cpy_r_r28); + goto CPyL12; + } + cpy_r_r30 = CPyStatic_faster_hexbytes___globals; + cpy_r_r31 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* '__version__' */ + cpy_r_r32 = CPyDict_SetItem(cpy_r_r30, cpy_r_r31, cpy_r_r29); + CPy_DECREF(cpy_r_r29); + cpy_r_r33 = cpy_r_r32 >= 0; + if (unlikely(!cpy_r_r33)) { + CPy_AddTraceback("faster_hexbytes/__init__.py", "", DIFFCHECK_PLACEHOLDER, CPyStatic_faster_hexbytes___globals); + goto CPyL12; + } + return 1; +CPyL12: ; + cpy_r_r34 = 2; + return cpy_r_r34; +} +static PyMethodDef _utilsmodule_methods[] = { + {"to_bytes", (PyCFunction)CPyPy__utils___to_bytes, METH_FASTCALL | METH_KEYWORDS, PyDoc_STR("to_bytes(val)\n--\n\n") /* docstring */}, + {"hexstr_to_bytes", (PyCFunction)CPyPy__utils___hexstr_to_bytes, METH_FASTCALL | METH_KEYWORDS, PyDoc_STR("hexstr_to_bytes(hexstr)\n--\n\n") /* docstring */}, + {NULL, NULL, 0, NULL} +}; + +int CPyExec_faster_hexbytes____utils(PyObject *module) +{ + PyObject* modname = NULL; + modname = PyObject_GetAttrString((PyObject *)CPyModule_faster_hexbytes____utils__internal, "__name__"); + CPyStatic__utils___globals = PyModule_GetDict(CPyModule_faster_hexbytes____utils__internal); + if (unlikely(CPyStatic__utils___globals == NULL)) + goto fail; + if (CPyGlobalsInit() < 0) + goto fail; + char result = CPyDef__utils_____top_level__(); + if (result == 2) + goto fail; + Py_DECREF(modname); + return 0; + fail: + Py_CLEAR(CPyModule_faster_hexbytes____utils__internal); + Py_CLEAR(modname); + CPy_XDECREF(CPyStatic__utils___unhexlify); + CPyStatic__utils___unhexlify = NULL; + return -1; +} +static struct PyModuleDef _utilsmodule = { + PyModuleDef_HEAD_INIT, + "faster_hexbytes._utils", + NULL, /* docstring */ + 0, /* size of per-interpreter state of the module */ + _utilsmodule_methods, + NULL, +}; + +PyObject *CPyInit_faster_hexbytes____utils(void) +{ + if (CPyModule_faster_hexbytes____utils__internal) { + Py_INCREF(CPyModule_faster_hexbytes____utils__internal); + return CPyModule_faster_hexbytes____utils__internal; + } + CPyModule_faster_hexbytes____utils__internal = PyModule_Create(&_utilsmodule); + if (unlikely(CPyModule_faster_hexbytes____utils__internal == NULL)) + goto fail; + if (CPyExec_faster_hexbytes____utils(CPyModule_faster_hexbytes____utils__internal) != 0) + goto fail; + return CPyModule_faster_hexbytes____utils__internal; + fail: + return NULL; +} + +PyObject *CPyDef__utils___to_bytes(PyObject *cpy_r_val) { + char cpy_r_r0; + PyObject *cpy_r_r1; + char cpy_r_r2; + PyObject *cpy_r_r3; + PyObject *cpy_r_r4; + char cpy_r_r5; + PyObject *cpy_r_r6; + PyObject **cpy_r_r8; + PyObject *cpy_r_r9; + PyObject *cpy_r_r10; + char cpy_r_r11; + char cpy_r_r12; + PyObject *cpy_r_r13; + PyObject *cpy_r_r14; + PyObject *cpy_r_r15; + char cpy_r_r16; + CPyTagged cpy_r_r17; + int64_t cpy_r_r18; + char cpy_r_r19; + int64_t cpy_r_r20; + char cpy_r_r21; + char cpy_r_r22; + char cpy_r_r23; + char cpy_r_r24; + PyObject *cpy_r_r25; + CPyTagged cpy_r_r26; + PyObject *cpy_r_r27; + PyObject *cpy_r_r28; + PyObject *cpy_r_r29; + PyObject *cpy_r_r30; + PyObject *cpy_r_r31; + PyObject *cpy_r_r32; + PyObject **cpy_r_r34; + PyObject *cpy_r_r35; + CPyTagged cpy_r_r36; + PyObject *cpy_r_r37; + PyObject *cpy_r_r38; + PyObject *cpy_r_r39; + PyObject *cpy_r_r40; + PyObject **cpy_r_r42; + PyObject *cpy_r_r43; + PyObject *cpy_r_r44; + PyObject *cpy_r_r45; + PyObject *cpy_r_r46; + PyObject *cpy_r_r47; + PyObject *cpy_r_r48; + int32_t cpy_r_r49; + char cpy_r_r50; + char cpy_r_r51; + PyObject *cpy_r_r52; + PyObject **cpy_r_r54; + PyObject *cpy_r_r55; + PyObject *cpy_r_r56; + PyObject *cpy_r_r57; + PyObject *cpy_r_r58; + PyObject *cpy_r_r59; + PyObject *cpy_r_r60; + PyObject *cpy_r_r61; + PyObject **cpy_r_r63; + PyObject *cpy_r_r64; + PyObject *cpy_r_r65; + PyObject *cpy_r_r66; + PyObject *cpy_r_r67; + PyObject *cpy_r_r68; + PyObject *cpy_r_r69; + PyObject **cpy_r_r71; + PyObject *cpy_r_r72; + PyObject *cpy_r_r73; + PyObject *cpy_r_r74; + CPyPtr cpy_r_r75; + CPyPtr cpy_r_r76; + CPyPtr cpy_r_r77; + CPyPtr cpy_r_r78; + CPyPtr cpy_r_r79; + CPyPtr cpy_r_r80; + PyObject *cpy_r_r81; + PyObject *cpy_r_r82; + PyObject *cpy_r_r83; + PyObject *cpy_r_r84; + PyObject **cpy_r_r86; + PyObject *cpy_r_r87; + PyObject *cpy_r_r88; + cpy_r_r0 = PyBytes_Check(cpy_r_val); + if (!cpy_r_r0) goto CPyL3; + CPy_INCREF(cpy_r_val); + if (likely(PyBytes_Check(cpy_r_val) || PyByteArray_Check(cpy_r_val))) + cpy_r_r1 = cpy_r_val; + else { + CPy_TypeErrorTraceback("faster_hexbytes/_utils.py", "to_bytes", 19, CPyStatic__utils___globals, "bytes", cpy_r_val); + goto CPyL51; + } + return cpy_r_r1; +CPyL3: ; + cpy_r_r2 = PyUnicode_Check(cpy_r_val); + if (!cpy_r_r2) goto CPyL7; + CPy_INCREF(cpy_r_val); + if (likely(PyUnicode_Check(cpy_r_val))) + cpy_r_r3 = cpy_r_val; + else { + CPy_TypeErrorTraceback("faster_hexbytes/_utils.py", "to_bytes", 21, CPyStatic__utils___globals, "str", cpy_r_val); + goto CPyL51; + } + cpy_r_r4 = CPyDef__utils___hexstr_to_bytes(cpy_r_r3); + CPy_DECREF(cpy_r_r3); + if (unlikely(cpy_r_r4 == NULL)) { + CPy_AddTraceback("faster_hexbytes/_utils.py", "to_bytes", DIFFCHECK_PLACEHOLDER, CPyStatic__utils___globals); + goto CPyL51; + } + return cpy_r_r4; +CPyL7: ; + cpy_r_r5 = PyByteArray_Check(cpy_r_val); + if (!cpy_r_r5) goto CPyL11; + cpy_r_r6 = (PyObject *)&PyBytes_Type; + PyObject *cpy_r_r7[1] = {cpy_r_val}; + cpy_r_r8 = (PyObject **)&cpy_r_r7; + cpy_r_r9 = PyObject_Vectorcall(cpy_r_r6, cpy_r_r8, 1, 0); + if (unlikely(cpy_r_r9 == NULL)) { + CPy_AddTraceback("faster_hexbytes/_utils.py", "to_bytes", DIFFCHECK_PLACEHOLDER, CPyStatic__utils___globals); + goto CPyL51; + } + if (likely(PyBytes_Check(cpy_r_r9) || PyByteArray_Check(cpy_r_r9))) + cpy_r_r10 = cpy_r_r9; + else { + CPy_TypeErrorTraceback("faster_hexbytes/_utils.py", "to_bytes", 23, CPyStatic__utils___globals, "bytes", cpy_r_r9); + goto CPyL51; + } + return cpy_r_r10; +CPyL11: ; + cpy_r_r11 = PyBool_Check(cpy_r_val); + if (!cpy_r_r11) goto CPyL17; + if (unlikely(!PyBool_Check(cpy_r_val))) { + CPy_TypeError("bool", cpy_r_val); cpy_r_r12 = 2; + } else + cpy_r_r12 = cpy_r_val == Py_True; + if (unlikely(cpy_r_r12 == 2)) { + CPy_AddTraceback("faster_hexbytes/_utils.py", "to_bytes", DIFFCHECK_PLACEHOLDER, CPyStatic__utils___globals); + goto CPyL51; + } + if (!cpy_r_r12) goto CPyL15; + cpy_r_r13 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* b'\x01' */ + CPy_INCREF(cpy_r_r13); + cpy_r_r14 = cpy_r_r13; + goto CPyL16; +CPyL15: ; + cpy_r_r15 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* b'\x00' */ + CPy_INCREF(cpy_r_r15); + cpy_r_r14 = cpy_r_r15; +CPyL16: ; + return cpy_r_r14; +CPyL17: ; + cpy_r_r16 = PyLong_Check(cpy_r_val); + if (!cpy_r_r16) goto CPyL37; + if (likely(PyLong_Check(cpy_r_val))) + cpy_r_r17 = CPyTagged_FromObject(cpy_r_val); + else { + CPy_TypeError("int", cpy_r_val); cpy_r_r17 = CPY_INT_TAG; + } + if (unlikely(cpy_r_r17 == CPY_INT_TAG)) { + CPy_AddTraceback("faster_hexbytes/_utils.py", "to_bytes", DIFFCHECK_PLACEHOLDER, CPyStatic__utils___globals); + goto CPyL51; + } + cpy_r_r18 = cpy_r_r17 & 1; + cpy_r_r19 = cpy_r_r18 != 0; + if (cpy_r_r19) goto CPyL21; + cpy_r_r20 = 0 & 1; + cpy_r_r21 = cpy_r_r20 != 0; + if (!cpy_r_r21) goto CPyL22; +CPyL21: ; + cpy_r_r22 = CPyTagged_IsLt_(cpy_r_r17, 0); + cpy_r_r23 = cpy_r_r22; + goto CPyL23; +CPyL22: ; + cpy_r_r24 = (Py_ssize_t)cpy_r_r17 < (Py_ssize_t)0; + cpy_r_r23 = cpy_r_r24; +CPyL23: ; + CPyTagged_DECREF(cpy_r_r17); + if (!cpy_r_r23) goto CPyL31; + cpy_r_r25 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* 'Cannot convert negative integer ' */ + if (likely(PyLong_Check(cpy_r_val))) + cpy_r_r26 = CPyTagged_FromObject(cpy_r_val); + else { + CPy_TypeError("int", cpy_r_val); cpy_r_r26 = CPY_INT_TAG; + } + if (unlikely(cpy_r_r26 == CPY_INT_TAG)) { + CPy_AddTraceback("faster_hexbytes/_utils.py", "to_bytes", DIFFCHECK_PLACEHOLDER, CPyStatic__utils___globals); + goto CPyL51; + } + cpy_r_r27 = CPyTagged_Str(cpy_r_r26); + CPyTagged_DECREF(cpy_r_r26); + if (unlikely(cpy_r_r27 == NULL)) { + CPy_AddTraceback("faster_hexbytes/_utils.py", "to_bytes", DIFFCHECK_PLACEHOLDER, CPyStatic__utils___globals); + goto CPyL51; + } + cpy_r_r28 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* ' to bytes' */ + cpy_r_r29 = CPyStr_Build(3, cpy_r_r25, cpy_r_r27, cpy_r_r28); + CPy_DECREF(cpy_r_r27); + if (unlikely(cpy_r_r29 == NULL)) { + CPy_AddTraceback("faster_hexbytes/_utils.py", "to_bytes", DIFFCHECK_PLACEHOLDER, CPyStatic__utils___globals); + goto CPyL51; + } + cpy_r_r30 = CPyModule_builtins; + cpy_r_r31 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* 'ValueError' */ + cpy_r_r32 = CPyObject_GetAttr(cpy_r_r30, cpy_r_r31); + if (unlikely(cpy_r_r32 == NULL)) { + CPy_AddTraceback("faster_hexbytes/_utils.py", "to_bytes", DIFFCHECK_PLACEHOLDER, CPyStatic__utils___globals); + goto CPyL52; + } + PyObject *cpy_r_r33[1] = {cpy_r_r29}; + cpy_r_r34 = (PyObject **)&cpy_r_r33; + cpy_r_r35 = PyObject_Vectorcall(cpy_r_r32, cpy_r_r34, 1, 0); + CPy_DECREF(cpy_r_r32); + if (unlikely(cpy_r_r35 == NULL)) { + CPy_AddTraceback("faster_hexbytes/_utils.py", "to_bytes", DIFFCHECK_PLACEHOLDER, CPyStatic__utils___globals); + goto CPyL52; + } + CPy_DECREF(cpy_r_r29); + CPy_Raise(cpy_r_r35); + CPy_DECREF(cpy_r_r35); + if (unlikely(!0)) { + CPy_AddTraceback("faster_hexbytes/_utils.py", "to_bytes", DIFFCHECK_PLACEHOLDER, CPyStatic__utils___globals); + goto CPyL51; + } + CPy_Unreachable(); +CPyL31: ; + if (likely(PyLong_Check(cpy_r_val))) + cpy_r_r36 = CPyTagged_FromObject(cpy_r_val); + else { + CPy_TypeError("int", cpy_r_val); cpy_r_r36 = CPY_INT_TAG; + } + if (unlikely(cpy_r_r36 == CPY_INT_TAG)) { + CPy_AddTraceback("faster_hexbytes/_utils.py", "to_bytes", DIFFCHECK_PLACEHOLDER, CPyStatic__utils___globals); + goto CPyL51; + } + cpy_r_r37 = CPyModule_builtins; + cpy_r_r38 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* 'hex' */ + cpy_r_r39 = CPyObject_GetAttr(cpy_r_r37, cpy_r_r38); + if (unlikely(cpy_r_r39 == NULL)) { + CPy_AddTraceback("faster_hexbytes/_utils.py", "to_bytes", DIFFCHECK_PLACEHOLDER, CPyStatic__utils___globals); + goto CPyL53; + } + cpy_r_r40 = CPyTagged_StealAsObject(cpy_r_r36); + PyObject *cpy_r_r41[1] = {cpy_r_r40}; + cpy_r_r42 = (PyObject **)&cpy_r_r41; + cpy_r_r43 = PyObject_Vectorcall(cpy_r_r39, cpy_r_r42, 1, 0); + CPy_DECREF(cpy_r_r39); + if (unlikely(cpy_r_r43 == NULL)) { + CPy_AddTraceback("faster_hexbytes/_utils.py", "to_bytes", DIFFCHECK_PLACEHOLDER, CPyStatic__utils___globals); + goto CPyL54; + } + CPy_DECREF(cpy_r_r40); + if (likely(PyUnicode_Check(cpy_r_r43))) + cpy_r_r44 = cpy_r_r43; + else { + CPy_TypeErrorTraceback("faster_hexbytes/_utils.py", "to_bytes", 32, CPyStatic__utils___globals, "str", cpy_r_r43); + goto CPyL51; + } + cpy_r_r45 = CPyDef__utils___to_bytes(cpy_r_r44); + CPy_DECREF(cpy_r_r44); + if (unlikely(cpy_r_r45 == NULL)) { + CPy_AddTraceback("faster_hexbytes/_utils.py", "to_bytes", DIFFCHECK_PLACEHOLDER, CPyStatic__utils___globals); + goto CPyL51; + } + return cpy_r_r45; +CPyL37: ; + cpy_r_r46 = CPyModule_builtins; + cpy_r_r47 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* 'memoryview' */ + cpy_r_r48 = CPyObject_GetAttr(cpy_r_r46, cpy_r_r47); + if (unlikely(cpy_r_r48 == NULL)) { + CPy_AddTraceback("faster_hexbytes/_utils.py", "to_bytes", DIFFCHECK_PLACEHOLDER, CPyStatic__utils___globals); + goto CPyL51; + } + cpy_r_r49 = PyObject_IsInstance(cpy_r_val, cpy_r_r48); + CPy_DECREF(cpy_r_r48); + cpy_r_r50 = cpy_r_r49 >= 0; + if (unlikely(!cpy_r_r50)) { + CPy_AddTraceback("faster_hexbytes/_utils.py", "to_bytes", DIFFCHECK_PLACEHOLDER, CPyStatic__utils___globals); + goto CPyL51; + } + cpy_r_r51 = cpy_r_r49; + if (!cpy_r_r51) goto CPyL43; + cpy_r_r52 = (PyObject *)&PyBytes_Type; + PyObject *cpy_r_r53[1] = {cpy_r_val}; + cpy_r_r54 = (PyObject **)&cpy_r_r53; + cpy_r_r55 = PyObject_Vectorcall(cpy_r_r52, cpy_r_r54, 1, 0); + if (unlikely(cpy_r_r55 == NULL)) { + CPy_AddTraceback("faster_hexbytes/_utils.py", "to_bytes", DIFFCHECK_PLACEHOLDER, CPyStatic__utils___globals); + goto CPyL51; + } + if (likely(PyBytes_Check(cpy_r_r55) || PyByteArray_Check(cpy_r_r55))) + cpy_r_r56 = cpy_r_r55; + else { + CPy_TypeErrorTraceback("faster_hexbytes/_utils.py", "to_bytes", 34, CPyStatic__utils___globals, "bytes", cpy_r_r55); + goto CPyL51; + } + return cpy_r_r56; +CPyL43: ; + cpy_r_r57 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* '' */ + cpy_r_r58 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* 'Cannot convert ' */ + cpy_r_r59 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* '{!r:{}}' */ + cpy_r_r60 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* '' */ + cpy_r_r61 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* 'format' */ + PyObject *cpy_r_r62[3] = {cpy_r_r59, cpy_r_val, cpy_r_r60}; + cpy_r_r63 = (PyObject **)&cpy_r_r62; + cpy_r_r64 = PyObject_VectorcallMethod(cpy_r_r61, cpy_r_r63, 9223372036854775811ULL, 0); + if (unlikely(cpy_r_r64 == NULL)) { + CPy_AddTraceback("faster_hexbytes/_utils.py", "to_bytes", DIFFCHECK_PLACEHOLDER, CPyStatic__utils___globals); + goto CPyL51; + } + cpy_r_r65 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* ' of type ' */ + cpy_r_r66 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* '{:{}}' */ + cpy_r_r67 = CPy_TYPE(cpy_r_val); + cpy_r_r68 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* '' */ + cpy_r_r69 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* 'format' */ + PyObject *cpy_r_r70[3] = {cpy_r_r66, cpy_r_r67, cpy_r_r68}; + cpy_r_r71 = (PyObject **)&cpy_r_r70; + cpy_r_r72 = PyObject_VectorcallMethod(cpy_r_r69, cpy_r_r71, 9223372036854775811ULL, 0); + if (unlikely(cpy_r_r72 == NULL)) { + CPy_AddTraceback("faster_hexbytes/_utils.py", "to_bytes", DIFFCHECK_PLACEHOLDER, CPyStatic__utils___globals); + goto CPyL55; + } + CPy_DECREF(cpy_r_r67); + cpy_r_r73 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* ' to bytes' */ + cpy_r_r74 = PyList_New(5); + if (unlikely(cpy_r_r74 == NULL)) { + CPy_AddTraceback("faster_hexbytes/_utils.py", "to_bytes", DIFFCHECK_PLACEHOLDER, CPyStatic__utils___globals); + goto CPyL56; + } + cpy_r_r75 = (CPyPtr)&((PyListObject *)cpy_r_r74)->ob_item; + cpy_r_r76 = *(CPyPtr *)cpy_r_r75; + CPy_INCREF(cpy_r_r58); + *(PyObject * *)cpy_r_r76 = cpy_r_r58; + cpy_r_r77 = cpy_r_r76 + 8; + *(PyObject * *)cpy_r_r77 = cpy_r_r64; + CPy_INCREF(cpy_r_r65); + cpy_r_r78 = cpy_r_r76 + 16; + *(PyObject * *)cpy_r_r78 = cpy_r_r65; + cpy_r_r79 = cpy_r_r76 + 24; + *(PyObject * *)cpy_r_r79 = cpy_r_r72; + CPy_INCREF(cpy_r_r73); + cpy_r_r80 = cpy_r_r76 + 32; + *(PyObject * *)cpy_r_r80 = cpy_r_r73; + cpy_r_r81 = PyUnicode_Join(cpy_r_r57, cpy_r_r74); + CPy_DECREF_NO_IMM(cpy_r_r74); + if (unlikely(cpy_r_r81 == NULL)) { + CPy_AddTraceback("faster_hexbytes/_utils.py", "to_bytes", DIFFCHECK_PLACEHOLDER, CPyStatic__utils___globals); + goto CPyL51; + } + cpy_r_r82 = CPyModule_builtins; + cpy_r_r83 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* 'TypeError' */ + cpy_r_r84 = CPyObject_GetAttr(cpy_r_r82, cpy_r_r83); + if (unlikely(cpy_r_r84 == NULL)) { + CPy_AddTraceback("faster_hexbytes/_utils.py", "to_bytes", DIFFCHECK_PLACEHOLDER, CPyStatic__utils___globals); + goto CPyL57; + } + PyObject *cpy_r_r85[1] = {cpy_r_r81}; + cpy_r_r86 = (PyObject **)&cpy_r_r85; + cpy_r_r87 = PyObject_Vectorcall(cpy_r_r84, cpy_r_r86, 1, 0); + CPy_DECREF(cpy_r_r84); + if (unlikely(cpy_r_r87 == NULL)) { + CPy_AddTraceback("faster_hexbytes/_utils.py", "to_bytes", DIFFCHECK_PLACEHOLDER, CPyStatic__utils___globals); + goto CPyL57; + } + CPy_DECREF(cpy_r_r81); + CPy_Raise(cpy_r_r87); + CPy_DECREF(cpy_r_r87); + if (unlikely(!0)) { + CPy_AddTraceback("faster_hexbytes/_utils.py", "to_bytes", DIFFCHECK_PLACEHOLDER, CPyStatic__utils___globals); + goto CPyL51; + } + CPy_Unreachable(); +CPyL51: ; + cpy_r_r88 = NULL; + return cpy_r_r88; +CPyL52: ; + CPy_DecRef(cpy_r_r29); + goto CPyL51; +CPyL53: ; + CPyTagged_DecRef(cpy_r_r36); + goto CPyL51; +CPyL54: ; + CPy_DecRef(cpy_r_r40); + goto CPyL51; +CPyL55: ; + CPy_DecRef(cpy_r_r64); + CPy_DecRef(cpy_r_r67); + goto CPyL51; +CPyL56: ; + CPy_DecRef(cpy_r_r64); + CPy_DecRef(cpy_r_r72); + goto CPyL51; +CPyL57: ; + CPy_DecRef(cpy_r_r81); + goto CPyL51; +} + +PyObject *CPyPy__utils___to_bytes(PyObject *self, PyObject *const *args, size_t nargs, PyObject *kwnames) { + static const char * const kwlist[] = {"val", 0}; + static CPyArg_Parser parser = {"O:to_bytes", kwlist, 0}; + PyObject *obj_val; + if (!CPyArg_ParseStackAndKeywordsOneArg(args, nargs, kwnames, &parser, &obj_val)) { + return NULL; + } + PyObject *arg_val; + if (PyBytes_Check(obj_val) || PyByteArray_Check(obj_val)) + arg_val = obj_val; + else { + arg_val = NULL; + } + if (arg_val != NULL) goto __LL1; + if (PyUnicode_Check(obj_val)) + arg_val = obj_val; + else { + arg_val = NULL; + } + if (arg_val != NULL) goto __LL1; + arg_val = obj_val; + if (arg_val != NULL) goto __LL1; + if (PyBool_Check(obj_val)) + arg_val = obj_val; + else { + arg_val = NULL; + } + if (arg_val != NULL) goto __LL1; + if (PyLong_Check(obj_val)) + arg_val = obj_val; + else { + arg_val = NULL; + } + if (arg_val != NULL) goto __LL1; + CPy_TypeError("union[bytes, str, object, bool, int]", obj_val); + goto fail; +__LL1: ; + PyObject *retval = CPyDef__utils___to_bytes(arg_val); + return retval; +fail: ; + CPy_AddTraceback("faster_hexbytes/_utils.py", "to_bytes", DIFFCHECK_PLACEHOLDER, CPyStatic__utils___globals); + return NULL; +} + +PyObject *CPyDef__utils___hexstr_to_bytes(PyObject *cpy_r_hexstr) { + PyObject *cpy_r_r0; + PyObject *cpy_r_r1; + tuple_T2OO cpy_r_r2; + PyObject *cpy_r_r3; + char cpy_r_r4; + PyObject *cpy_r_r5; + PyObject *cpy_r_r6; + PyObject *cpy_r_non_prefixed_hex; + int64_t cpy_r_r7; + char cpy_r_r8; + CPyTagged cpy_r_r9; + CPyTagged cpy_r_r10; + char cpy_r_r11; + PyObject *cpy_r_r12; + PyObject *cpy_r_r13; + PyObject *cpy_r_padded_hex; + PyObject *cpy_r_r14; + tuple_T3OOO cpy_r_r15; + PyObject *cpy_r_r16; + PyObject *cpy_r_r17; + PyObject *cpy_r_r18; + char cpy_r_r19; + PyObject *cpy_r_r20; + PyObject *cpy_r_r21; + PyObject *cpy_r_r22; + PyObject *cpy_r_r23; + PyObject *cpy_r_r24; + PyObject *cpy_r_r25; + PyObject **cpy_r_r27; + PyObject *cpy_r_r28; + char cpy_r_r29; + PyObject *cpy_r_r30; + char cpy_r_r31; + PyObject **cpy_r_r33; + PyObject *cpy_r_r34; + PyObject *cpy_r_r35; + PyObject *cpy_r_r36; + cpy_r_r0 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* '0x' */ + cpy_r_r1 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* '0X' */ + CPy_INCREF(cpy_r_r0); + CPy_INCREF(cpy_r_r1); + cpy_r_r2.f0 = cpy_r_r0; + cpy_r_r2.f1 = cpy_r_r1; + cpy_r_r3 = PyTuple_New(2); + if (unlikely(cpy_r_r3 == NULL)) + CPyError_OutOfMemory(); + PyObject *__tmp2 = cpy_r_r2.f0; + PyTuple_SET_ITEM(cpy_r_r3, 0, __tmp2); + PyObject *__tmp3 = cpy_r_r2.f1; + PyTuple_SET_ITEM(cpy_r_r3, 1, __tmp3); + cpy_r_r4 = CPyStr_Startswith(cpy_r_hexstr, cpy_r_r3); + CPy_DECREF(cpy_r_r3); + if (unlikely(cpy_r_r4 == 2)) { + CPy_AddTraceback("faster_hexbytes/_utils.py", "hexstr_to_bytes", DIFFCHECK_PLACEHOLDER, CPyStatic__utils___globals); + goto CPyL31; + } + if (!cpy_r_r4) goto CPyL5; + cpy_r_r5 = CPyStr_GetSlice(cpy_r_hexstr, 4, 9223372036854775806LL); + if (unlikely(cpy_r_r5 == NULL)) { + CPy_AddTraceback("faster_hexbytes/_utils.py", "hexstr_to_bytes", DIFFCHECK_PLACEHOLDER, CPyStatic__utils___globals); + goto CPyL31; + } + if (likely(PyUnicode_Check(cpy_r_r5))) + cpy_r_r6 = cpy_r_r5; + else { + CPy_TypeErrorTraceback("faster_hexbytes/_utils.py", "hexstr_to_bytes", 41, CPyStatic__utils___globals, "str", cpy_r_r5); + goto CPyL31; + } + cpy_r_non_prefixed_hex = cpy_r_r6; + goto CPyL6; +CPyL5: ; + CPy_INCREF(cpy_r_hexstr); + cpy_r_non_prefixed_hex = cpy_r_hexstr; +CPyL6: ; + cpy_r_r7 = CPyStr_Size_size_t(cpy_r_hexstr); + cpy_r_r8 = cpy_r_r7 >= 0; + if (unlikely(!cpy_r_r8)) { + CPy_AddTraceback("faster_hexbytes/_utils.py", "hexstr_to_bytes", DIFFCHECK_PLACEHOLDER, CPyStatic__utils___globals); + goto CPyL32; + } + cpy_r_r9 = cpy_r_r7 << 1; + cpy_r_r10 = CPyTagged_Remainder(cpy_r_r9, 4); + if (unlikely(cpy_r_r10 == CPY_INT_TAG)) { + CPy_AddTraceback("faster_hexbytes/_utils.py", "hexstr_to_bytes", DIFFCHECK_PLACEHOLDER, CPyStatic__utils___globals); + goto CPyL32; + } + cpy_r_r11 = cpy_r_r10 != 0; + CPyTagged_DECREF(cpy_r_r10); + if (!cpy_r_r11) goto CPyL11; + cpy_r_r12 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* '0' */ + cpy_r_r13 = PyUnicode_Concat(cpy_r_r12, cpy_r_non_prefixed_hex); + CPy_DECREF(cpy_r_non_prefixed_hex); + if (unlikely(cpy_r_r13 == NULL)) { + CPy_AddTraceback("faster_hexbytes/_utils.py", "hexstr_to_bytes", DIFFCHECK_PLACEHOLDER, CPyStatic__utils___globals); + goto CPyL31; + } + cpy_r_padded_hex = cpy_r_r13; + goto CPyL12; +CPyL11: ; + cpy_r_padded_hex = cpy_r_non_prefixed_hex; +CPyL12: ; + cpy_r_r14 = PyUnicode_AsASCIIString(cpy_r_padded_hex); + if (unlikely(cpy_r_r14 == NULL)) { + CPy_AddTraceback("faster_hexbytes/_utils.py", "hexstr_to_bytes", DIFFCHECK_PLACEHOLDER, CPyStatic__utils___globals); + goto CPyL14; + } else + goto CPyL33; +CPyL13: ; + goto CPyL25; +CPyL14: ; + cpy_r_r15 = CPy_CatchError(); + cpy_r_r16 = CPyModule_builtins; + cpy_r_r17 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* 'UnicodeDecodeError' */ + cpy_r_r18 = CPyObject_GetAttr(cpy_r_r16, cpy_r_r17); + if (unlikely(cpy_r_r18 == NULL)) { + CPy_AddTraceback("faster_hexbytes/_utils.py", "hexstr_to_bytes", DIFFCHECK_PLACEHOLDER, CPyStatic__utils___globals); + goto CPyL34; + } + cpy_r_r19 = CPy_ExceptionMatches(cpy_r_r18); + CPy_DecRef(cpy_r_r18); + if (!cpy_r_r19) goto CPyL35; + cpy_r_r20 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* 'hex string ' */ + cpy_r_r21 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* ' may only contain [0-9a-fA-F] characters' */ + cpy_r_r22 = CPyStr_Build(3, cpy_r_r20, cpy_r_padded_hex, cpy_r_r21); + CPy_DecRef(cpy_r_padded_hex); + if (unlikely(cpy_r_r22 == NULL)) { + CPy_AddTraceback("faster_hexbytes/_utils.py", "hexstr_to_bytes", DIFFCHECK_PLACEHOLDER, CPyStatic__utils___globals); + goto CPyL23; + } + cpy_r_r23 = CPyModule_builtins; + cpy_r_r24 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* 'ValueError' */ + cpy_r_r25 = CPyObject_GetAttr(cpy_r_r23, cpy_r_r24); + if (unlikely(cpy_r_r25 == NULL)) { + CPy_AddTraceback("faster_hexbytes/_utils.py", "hexstr_to_bytes", DIFFCHECK_PLACEHOLDER, CPyStatic__utils___globals); + goto CPyL36; + } + PyObject *cpy_r_r26[1] = {cpy_r_r22}; + cpy_r_r27 = (PyObject **)&cpy_r_r26; + cpy_r_r28 = PyObject_Vectorcall(cpy_r_r25, cpy_r_r27, 1, 0); + CPy_DecRef(cpy_r_r25); + if (unlikely(cpy_r_r28 == NULL)) { + CPy_AddTraceback("faster_hexbytes/_utils.py", "hexstr_to_bytes", DIFFCHECK_PLACEHOLDER, CPyStatic__utils___globals); + goto CPyL36; + } + CPy_DecRef(cpy_r_r22); + CPy_Raise(cpy_r_r28); + CPy_DecRef(cpy_r_r28); + if (unlikely(!0)) { + CPy_AddTraceback("faster_hexbytes/_utils.py", "hexstr_to_bytes", DIFFCHECK_PLACEHOLDER, CPyStatic__utils___globals); + goto CPyL23; + } else + goto CPyL37; +CPyL20: ; + CPy_Unreachable(); +CPyL21: ; + CPy_Reraise(); + if (!0) { + goto CPyL23; + } else + goto CPyL38; +CPyL22: ; + CPy_Unreachable(); +CPyL23: ; + CPy_RestoreExcInfo(cpy_r_r15); + CPy_DecRef(cpy_r_r15.f0); + CPy_DecRef(cpy_r_r15.f1); + CPy_DecRef(cpy_r_r15.f2); + cpy_r_r29 = CPy_KeepPropagating(); + if (!cpy_r_r29) goto CPyL31; + CPy_Unreachable(); +CPyL25: ; + cpy_r_r30 = CPyStatic__utils___unhexlify; + if (unlikely(cpy_r_r30 == NULL)) { + goto CPyL39; + } else + goto CPyL28; +CPyL26: ; + PyErr_SetString(PyExc_NameError, "value for final name \"unhexlify\" was not set"); + cpy_r_r31 = 0; + if (unlikely(!cpy_r_r31)) { + CPy_AddTraceback("faster_hexbytes/_utils.py", "hexstr_to_bytes", DIFFCHECK_PLACEHOLDER, CPyStatic__utils___globals); + goto CPyL31; + } + CPy_Unreachable(); +CPyL28: ; + PyObject *cpy_r_r32[1] = {cpy_r_r14}; + cpy_r_r33 = (PyObject **)&cpy_r_r32; + cpy_r_r34 = PyObject_Vectorcall(cpy_r_r30, cpy_r_r33, 1, 0); + if (unlikely(cpy_r_r34 == NULL)) { + CPy_AddTraceback("faster_hexbytes/_utils.py", "hexstr_to_bytes", DIFFCHECK_PLACEHOLDER, CPyStatic__utils___globals); + goto CPyL40; + } + CPy_DECREF(cpy_r_r14); + if (likely(PyBytes_Check(cpy_r_r34) || PyByteArray_Check(cpy_r_r34))) + cpy_r_r35 = cpy_r_r34; + else { + CPy_TypeErrorTraceback("faster_hexbytes/_utils.py", "hexstr_to_bytes", 58, CPyStatic__utils___globals, "bytes", cpy_r_r34); + goto CPyL31; + } + return cpy_r_r35; +CPyL31: ; + cpy_r_r36 = NULL; + return cpy_r_r36; +CPyL32: ; + CPy_DecRef(cpy_r_non_prefixed_hex); + goto CPyL31; +CPyL33: ; + CPy_DECREF(cpy_r_padded_hex); + goto CPyL13; +CPyL34: ; + CPy_DecRef(cpy_r_padded_hex); + goto CPyL23; +CPyL35: ; + CPy_DecRef(cpy_r_padded_hex); + goto CPyL21; +CPyL36: ; + CPy_DecRef(cpy_r_r22); + goto CPyL23; +CPyL37: ; + CPy_DecRef(cpy_r_r15.f0); + CPy_DecRef(cpy_r_r15.f1); + CPy_DecRef(cpy_r_r15.f2); + goto CPyL20; +CPyL38: ; + CPy_DecRef(cpy_r_r15.f0); + CPy_DecRef(cpy_r_r15.f1); + CPy_DecRef(cpy_r_r15.f2); + goto CPyL22; +CPyL39: ; + CPy_DecRef(cpy_r_r14); + goto CPyL26; +CPyL40: ; + CPy_DecRef(cpy_r_r14); + goto CPyL31; +} + +PyObject *CPyPy__utils___hexstr_to_bytes(PyObject *self, PyObject *const *args, size_t nargs, PyObject *kwnames) { + static const char * const kwlist[] = {"hexstr", 0}; + static CPyArg_Parser parser = {"O:hexstr_to_bytes", kwlist, 0}; + PyObject *obj_hexstr; + if (!CPyArg_ParseStackAndKeywordsOneArg(args, nargs, kwnames, &parser, &obj_hexstr)) { + return NULL; + } + PyObject *arg_hexstr; + if (likely(PyUnicode_Check(obj_hexstr))) + arg_hexstr = obj_hexstr; + else { + CPy_TypeError("str", obj_hexstr); + goto fail; + } + PyObject *retval = CPyDef__utils___hexstr_to_bytes(arg_hexstr); + return retval; +fail: ; + CPy_AddTraceback("faster_hexbytes/_utils.py", "hexstr_to_bytes", DIFFCHECK_PLACEHOLDER, CPyStatic__utils___globals); + return NULL; +} + +char CPyDef__utils_____top_level__(void) { + PyObject *cpy_r_r0; + PyObject *cpy_r_r1; + char cpy_r_r2; + PyObject *cpy_r_r3; + PyObject *cpy_r_r4; + PyObject **cpy_r_r5; + void *cpy_r_r7; + void *cpy_r_r9; + PyObject *cpy_r_r10; + PyObject *cpy_r_r11; + PyObject *cpy_r_r12; + PyObject *cpy_r_r13; + char cpy_r_r14; + PyObject *cpy_r_r15; + PyObject *cpy_r_r16; + PyObject *cpy_r_r17; + PyObject *cpy_r_r18; + PyObject *cpy_r_r19; + PyObject *cpy_r_r20; + PyObject *cpy_r_r21; + PyObject *cpy_r_r22; + PyObject *cpy_r_r23; + int32_t cpy_r_r24; + char cpy_r_r25; + char cpy_r_r26; + cpy_r_r0 = CPyModule_builtins; + cpy_r_r1 = (PyObject *)&_Py_NoneStruct; + cpy_r_r2 = cpy_r_r0 != cpy_r_r1; + if (cpy_r_r2) goto CPyL3; + cpy_r_r3 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* 'builtins' */ + cpy_r_r4 = PyImport_Import(cpy_r_r3); + if (unlikely(cpy_r_r4 == NULL)) { + CPy_AddTraceback("faster_hexbytes/_utils.py", "", -1, CPyStatic__utils___globals); + goto CPyL8; + } + CPyModule_builtins = cpy_r_r4; + CPy_INCREF(CPyModule_builtins); + CPy_DECREF(cpy_r_r4); +CPyL3: ; + cpy_r_r5 = (PyObject **)&CPyModule_binascii; + PyObject **cpy_r_r6[1] = {cpy_r_r5}; + cpy_r_r7 = (void *)&cpy_r_r6; + int64_t cpy_r_r8[1] = {1}; + cpy_r_r9 = (void *)&cpy_r_r8; + cpy_r_r10 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* (('binascii', 'binascii', 'binascii'),) */ + cpy_r_r11 = CPyStatic__utils___globals; + cpy_r_r12 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* 'faster_hexbytes/_utils.py' */ + cpy_r_r13 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* '' */ + cpy_r_r14 = CPyImport_ImportMany(cpy_r_r10, cpy_r_r7, cpy_r_r11, cpy_r_r12, cpy_r_r13, cpy_r_r9); + if (!cpy_r_r14) goto CPyL8; + cpy_r_r15 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* ('Final', 'Union') */ + cpy_r_r16 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* 'typing' */ + cpy_r_r17 = CPyStatic__utils___globals; + cpy_r_r18 = CPyImport_ImportFromMany(cpy_r_r16, cpy_r_r15, cpy_r_r15, cpy_r_r17); + if (unlikely(cpy_r_r18 == NULL)) { + CPy_AddTraceback("faster_hexbytes/_utils.py", "", DIFFCHECK_PLACEHOLDER, CPyStatic__utils___globals); + goto CPyL8; + } + CPyModule_typing = cpy_r_r18; + CPy_INCREF(CPyModule_typing); + CPy_DECREF(cpy_r_r18); + cpy_r_r19 = CPyModule_binascii; + cpy_r_r20 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* 'unhexlify' */ + cpy_r_r21 = CPyObject_GetAttr(cpy_r_r19, cpy_r_r20); + if (unlikely(cpy_r_r21 == NULL)) { + CPy_AddTraceback("faster_hexbytes/_utils.py", "", DIFFCHECK_PLACEHOLDER, CPyStatic__utils___globals); + goto CPyL8; + } + CPyStatic__utils___unhexlify = cpy_r_r21; + CPy_INCREF(CPyStatic__utils___unhexlify); + cpy_r_r22 = CPyStatic__utils___globals; + cpy_r_r23 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* 'unhexlify' */ + cpy_r_r24 = CPyDict_SetItem(cpy_r_r22, cpy_r_r23, cpy_r_r21); + CPy_DECREF(cpy_r_r21); + cpy_r_r25 = cpy_r_r24 >= 0; + if (unlikely(!cpy_r_r25)) { + CPy_AddTraceback("faster_hexbytes/_utils.py", "", DIFFCHECK_PLACEHOLDER, CPyStatic__utils___globals); + goto CPyL8; + } + return 1; +CPyL8: ; + cpy_r_r26 = 2; + return cpy_r_r26; +} + +static PyObject *CPyDunder___get__main_____new___3_HexBytes_obj(PyObject *self, PyObject *instance, PyObject *owner) { + instance = instance ? instance : Py_None; + return CPyDef_main_____new___3_HexBytes_obj_____get__(self, instance, owner); +} +PyObject *CPyDef_main_____mypyc___3__new___3_HexBytes_obj_setup(PyObject *cpy_r_type); +PyObject *CPyDef_main_____new___3_HexBytes_obj(void); + +static PyObject * +main_____new___3_HexBytes_obj_new(PyTypeObject *type, PyObject *args, PyObject *kwds) +{ + if (type != CPyType_main_____new___3_HexBytes_obj) { + PyErr_SetString(PyExc_TypeError, "interpreted classes cannot inherit from compiled"); + return NULL; + } + PyObject *self = CPyDef_main_____mypyc___3__new___3_HexBytes_obj_setup((PyObject*)type); + if (self == NULL) + return NULL; + return self; +} + +static int +main_____new___3_HexBytes_obj_traverse(faster_hexbytes___main_____new___3_HexBytes_objObject *self, visitproc visit, void *arg) +{ + return 0; +} + +static int +main_____new___3_HexBytes_obj_clear(faster_hexbytes___main_____new___3_HexBytes_objObject *self) +{ + return 0; +} + +static void +main_____new___3_HexBytes_obj_dealloc(faster_hexbytes___main_____new___3_HexBytes_objObject *self) +{ + PyObject_GC_UnTrack(self); + if (main_____new___3_HexBytes_obj_free_instance == NULL) { + main_____new___3_HexBytes_obj_free_instance = self; + return; + } + CPy_TRASHCAN_BEGIN(self, main_____new___3_HexBytes_obj_dealloc) + main_____new___3_HexBytes_obj_clear(self); + Py_TYPE(self)->tp_free((PyObject *)self); + CPy_TRASHCAN_END(self) +} + +static CPyVTableItem main_____new___3_HexBytes_obj_vtable[2]; +static bool +CPyDef_main_____new___3_HexBytes_obj_trait_vtable_setup(void) +{ + CPyVTableItem main_____new___3_HexBytes_obj_vtable_scratch[] = { + (CPyVTableItem)CPyDef_main_____new___3_HexBytes_obj_____call__, + (CPyVTableItem)CPyDef_main_____new___3_HexBytes_obj_____get__, + }; + memcpy(main_____new___3_HexBytes_obj_vtable, main_____new___3_HexBytes_obj_vtable_scratch, sizeof(main_____new___3_HexBytes_obj_vtable)); + return 1; +} + +static PyMethodDef main_____new___3_HexBytes_obj_methods[] = { + {"__call__", + (PyCFunction)CPyPy_main_____new___3_HexBytes_obj_____call__, + METH_FASTCALL | METH_KEYWORDS, PyDoc_STR("__call__($cls, val)\n--\n\n")}, + {"__get__", + (PyCFunction)CPyPy_main_____new___3_HexBytes_obj_____get__, + METH_FASTCALL | METH_KEYWORDS, PyDoc_STR("__get__($instance, owner)\n--\n\n")}, + {"__setstate__", (PyCFunction)CPyPickle_SetState, METH_O, NULL}, + {"__getstate__", (PyCFunction)CPyPickle_GetState, METH_NOARGS, NULL}, + {NULL} /* Sentinel */ +}; + +static PyTypeObject CPyType_main_____new___3_HexBytes_obj_template_ = { + PyVarObject_HEAD_INIT(NULL, 0) + .tp_name = "__new___HexBytes_obj", + .tp_new = main_____new___3_HexBytes_obj_new, + .tp_dealloc = (destructor)main_____new___3_HexBytes_obj_dealloc, + .tp_traverse = (traverseproc)main_____new___3_HexBytes_obj_traverse, + .tp_clear = (inquiry)main_____new___3_HexBytes_obj_clear, + .tp_methods = main_____new___3_HexBytes_obj_methods, + .tp_call = PyVectorcall_Call, + .tp_descr_get = CPyDunder___get__main_____new___3_HexBytes_obj, + .tp_basicsize = sizeof(faster_hexbytes___main_____new___3_HexBytes_objObject), + .tp_vectorcall_offset = offsetof(faster_hexbytes___main_____new___3_HexBytes_objObject, vectorcall), + .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HEAPTYPE | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC | _Py_TPFLAGS_HAVE_VECTORCALL, + .tp_doc = PyDoc_STR("__new___HexBytes_obj()\n--\n\n"), +}; +static PyTypeObject *CPyType_main_____new___3_HexBytes_obj_template = &CPyType_main_____new___3_HexBytes_obj_template_; + +PyObject *CPyDef_main_____mypyc___3__new___3_HexBytes_obj_setup(PyObject *cpy_r_type) +{ + PyTypeObject *type = (PyTypeObject*)cpy_r_type; + faster_hexbytes___main_____new___3_HexBytes_objObject *self; + if (main_____new___3_HexBytes_obj_free_instance != NULL) { + self = main_____new___3_HexBytes_obj_free_instance; + main_____new___3_HexBytes_obj_free_instance = NULL; + Py_SET_REFCNT(self, 1); + PyObject_GC_Track(self); + return (PyObject *)self; + } + self = (faster_hexbytes___main_____new___3_HexBytes_objObject *)type->tp_alloc(type, 0); + if (self == NULL) + return NULL; + self->vtable = main_____new___3_HexBytes_obj_vtable; + self->vectorcall = CPyPy_main_____new___3_HexBytes_obj_____call__; + return (PyObject *)self; +} + +PyObject *CPyDef_main_____new___3_HexBytes_obj(void) +{ + PyObject *self = CPyDef_main_____mypyc___3__new___3_HexBytes_obj_setup((PyObject *)CPyType_main_____new___3_HexBytes_obj); + if (self == NULL) + return NULL; + return self; +} + + +static PyObject *CPyDunder___get__main_____getitem___3_HexBytes_obj(PyObject *self, PyObject *instance, PyObject *owner) { + instance = instance ? instance : Py_None; + return CPyDef_main_____getitem___3_HexBytes_obj_____get__(self, instance, owner); +} +PyObject *CPyDef_main_____mypyc___3__getitem___3_HexBytes_obj_setup(PyObject *cpy_r_type); +PyObject *CPyDef_main_____getitem___3_HexBytes_obj(void); + +static PyObject * +main_____getitem___3_HexBytes_obj_new(PyTypeObject *type, PyObject *args, PyObject *kwds) +{ + if (type != CPyType_main_____getitem___3_HexBytes_obj) { + PyErr_SetString(PyExc_TypeError, "interpreted classes cannot inherit from compiled"); + return NULL; + } + PyObject *self = CPyDef_main_____mypyc___3__getitem___3_HexBytes_obj_setup((PyObject*)type); + if (self == NULL) + return NULL; + return self; +} + +static int +main_____getitem___3_HexBytes_obj_traverse(faster_hexbytes___main_____getitem___3_HexBytes_objObject *self, visitproc visit, void *arg) +{ + return 0; +} + +static int +main_____getitem___3_HexBytes_obj_clear(faster_hexbytes___main_____getitem___3_HexBytes_objObject *self) +{ + return 0; +} + +static void +main_____getitem___3_HexBytes_obj_dealloc(faster_hexbytes___main_____getitem___3_HexBytes_objObject *self) +{ + PyObject_GC_UnTrack(self); + if (main_____getitem___3_HexBytes_obj_free_instance == NULL) { + main_____getitem___3_HexBytes_obj_free_instance = self; + return; + } + CPy_TRASHCAN_BEGIN(self, main_____getitem___3_HexBytes_obj_dealloc) + main_____getitem___3_HexBytes_obj_clear(self); + Py_TYPE(self)->tp_free((PyObject *)self); + CPy_TRASHCAN_END(self) +} + +static CPyVTableItem main_____getitem___3_HexBytes_obj_vtable[2]; +static bool +CPyDef_main_____getitem___3_HexBytes_obj_trait_vtable_setup(void) +{ + CPyVTableItem main_____getitem___3_HexBytes_obj_vtable_scratch[] = { + (CPyVTableItem)CPyDef_main_____getitem___3_HexBytes_obj_____call__, + (CPyVTableItem)CPyDef_main_____getitem___3_HexBytes_obj_____get__, + }; + memcpy(main_____getitem___3_HexBytes_obj_vtable, main_____getitem___3_HexBytes_obj_vtable_scratch, sizeof(main_____getitem___3_HexBytes_obj_vtable)); + return 1; +} + +static PyMethodDef main_____getitem___3_HexBytes_obj_methods[] = { + {"__call__", + (PyCFunction)CPyPy_main_____getitem___3_HexBytes_obj_____call__, + METH_FASTCALL | METH_KEYWORDS, PyDoc_STR("__call__($self, key, /)\n--\n\n")}, + {"__get__", + (PyCFunction)CPyPy_main_____getitem___3_HexBytes_obj_____get__, + METH_FASTCALL | METH_KEYWORDS, PyDoc_STR("__get__($instance, owner)\n--\n\n")}, + {"__setstate__", (PyCFunction)CPyPickle_SetState, METH_O, NULL}, + {"__getstate__", (PyCFunction)CPyPickle_GetState, METH_NOARGS, NULL}, + {NULL} /* Sentinel */ +}; + +static PyTypeObject CPyType_main_____getitem___3_HexBytes_obj_template_ = { + PyVarObject_HEAD_INIT(NULL, 0) + .tp_name = "__getitem___HexBytes_obj", + .tp_new = main_____getitem___3_HexBytes_obj_new, + .tp_dealloc = (destructor)main_____getitem___3_HexBytes_obj_dealloc, + .tp_traverse = (traverseproc)main_____getitem___3_HexBytes_obj_traverse, + .tp_clear = (inquiry)main_____getitem___3_HexBytes_obj_clear, + .tp_methods = main_____getitem___3_HexBytes_obj_methods, + .tp_call = PyVectorcall_Call, + .tp_descr_get = CPyDunder___get__main_____getitem___3_HexBytes_obj, + .tp_basicsize = sizeof(faster_hexbytes___main_____getitem___3_HexBytes_objObject), + .tp_vectorcall_offset = offsetof(faster_hexbytes___main_____getitem___3_HexBytes_objObject, vectorcall), + .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HEAPTYPE | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC | _Py_TPFLAGS_HAVE_VECTORCALL, + .tp_doc = PyDoc_STR("__getitem___HexBytes_obj()\n--\n\n"), +}; +static PyTypeObject *CPyType_main_____getitem___3_HexBytes_obj_template = &CPyType_main_____getitem___3_HexBytes_obj_template_; + +PyObject *CPyDef_main_____mypyc___3__getitem___3_HexBytes_obj_setup(PyObject *cpy_r_type) +{ + PyTypeObject *type = (PyTypeObject*)cpy_r_type; + faster_hexbytes___main_____getitem___3_HexBytes_objObject *self; + if (main_____getitem___3_HexBytes_obj_free_instance != NULL) { + self = main_____getitem___3_HexBytes_obj_free_instance; + main_____getitem___3_HexBytes_obj_free_instance = NULL; + Py_SET_REFCNT(self, 1); + PyObject_GC_Track(self); + return (PyObject *)self; + } + self = (faster_hexbytes___main_____getitem___3_HexBytes_objObject *)type->tp_alloc(type, 0); + if (self == NULL) + return NULL; + self->vtable = main_____getitem___3_HexBytes_obj_vtable; + self->vectorcall = CPyPy_main_____getitem___3_HexBytes_obj_____call__; + return (PyObject *)self; +} + +PyObject *CPyDef_main_____getitem___3_HexBytes_obj(void) +{ + PyObject *self = CPyDef_main_____mypyc___3__getitem___3_HexBytes_obj_setup((PyObject *)CPyType_main_____getitem___3_HexBytes_obj); + if (self == NULL) + return NULL; + return self; +} + + +static PyObject *CPyDunder___get__main_____repr___3_HexBytes_obj(PyObject *self, PyObject *instance, PyObject *owner) { + instance = instance ? instance : Py_None; + return CPyDef_main_____repr___3_HexBytes_obj_____get__(self, instance, owner); +} +PyObject *CPyDef_main_____mypyc___3__repr___3_HexBytes_obj_setup(PyObject *cpy_r_type); +PyObject *CPyDef_main_____repr___3_HexBytes_obj(void); + +static PyObject * +main_____repr___3_HexBytes_obj_new(PyTypeObject *type, PyObject *args, PyObject *kwds) +{ + if (type != CPyType_main_____repr___3_HexBytes_obj) { + PyErr_SetString(PyExc_TypeError, "interpreted classes cannot inherit from compiled"); + return NULL; + } + PyObject *self = CPyDef_main_____mypyc___3__repr___3_HexBytes_obj_setup((PyObject*)type); + if (self == NULL) + return NULL; + return self; +} + +static int +main_____repr___3_HexBytes_obj_traverse(faster_hexbytes___main_____repr___3_HexBytes_objObject *self, visitproc visit, void *arg) +{ + return 0; +} + +static int +main_____repr___3_HexBytes_obj_clear(faster_hexbytes___main_____repr___3_HexBytes_objObject *self) +{ + return 0; +} + +static void +main_____repr___3_HexBytes_obj_dealloc(faster_hexbytes___main_____repr___3_HexBytes_objObject *self) +{ + PyObject_GC_UnTrack(self); + if (main_____repr___3_HexBytes_obj_free_instance == NULL) { + main_____repr___3_HexBytes_obj_free_instance = self; + return; + } + CPy_TRASHCAN_BEGIN(self, main_____repr___3_HexBytes_obj_dealloc) + main_____repr___3_HexBytes_obj_clear(self); + Py_TYPE(self)->tp_free((PyObject *)self); + CPy_TRASHCAN_END(self) +} + +static CPyVTableItem main_____repr___3_HexBytes_obj_vtable[2]; +static bool +CPyDef_main_____repr___3_HexBytes_obj_trait_vtable_setup(void) +{ + CPyVTableItem main_____repr___3_HexBytes_obj_vtable_scratch[] = { + (CPyVTableItem)CPyDef_main_____repr___3_HexBytes_obj_____call__, + (CPyVTableItem)CPyDef_main_____repr___3_HexBytes_obj_____get__, + }; + memcpy(main_____repr___3_HexBytes_obj_vtable, main_____repr___3_HexBytes_obj_vtable_scratch, sizeof(main_____repr___3_HexBytes_obj_vtable)); + return 1; +} + +static PyMethodDef main_____repr___3_HexBytes_obj_methods[] = { + {"__call__", + (PyCFunction)CPyPy_main_____repr___3_HexBytes_obj_____call__, + METH_FASTCALL | METH_KEYWORDS, PyDoc_STR("__call__($self, /)\n--\n\n")}, + {"__get__", + (PyCFunction)CPyPy_main_____repr___3_HexBytes_obj_____get__, + METH_FASTCALL | METH_KEYWORDS, PyDoc_STR("__get__($instance, owner)\n--\n\n")}, + {"__setstate__", (PyCFunction)CPyPickle_SetState, METH_O, NULL}, + {"__getstate__", (PyCFunction)CPyPickle_GetState, METH_NOARGS, NULL}, + {NULL} /* Sentinel */ +}; + +static PyTypeObject CPyType_main_____repr___3_HexBytes_obj_template_ = { + PyVarObject_HEAD_INIT(NULL, 0) + .tp_name = "__repr___HexBytes_obj", + .tp_new = main_____repr___3_HexBytes_obj_new, + .tp_dealloc = (destructor)main_____repr___3_HexBytes_obj_dealloc, + .tp_traverse = (traverseproc)main_____repr___3_HexBytes_obj_traverse, + .tp_clear = (inquiry)main_____repr___3_HexBytes_obj_clear, + .tp_methods = main_____repr___3_HexBytes_obj_methods, + .tp_call = PyVectorcall_Call, + .tp_descr_get = CPyDunder___get__main_____repr___3_HexBytes_obj, + .tp_basicsize = sizeof(faster_hexbytes___main_____repr___3_HexBytes_objObject), + .tp_vectorcall_offset = offsetof(faster_hexbytes___main_____repr___3_HexBytes_objObject, vectorcall), + .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HEAPTYPE | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC | _Py_TPFLAGS_HAVE_VECTORCALL, + .tp_doc = PyDoc_STR("__repr___HexBytes_obj()\n--\n\n"), +}; +static PyTypeObject *CPyType_main_____repr___3_HexBytes_obj_template = &CPyType_main_____repr___3_HexBytes_obj_template_; + +PyObject *CPyDef_main_____mypyc___3__repr___3_HexBytes_obj_setup(PyObject *cpy_r_type) +{ + PyTypeObject *type = (PyTypeObject*)cpy_r_type; + faster_hexbytes___main_____repr___3_HexBytes_objObject *self; + if (main_____repr___3_HexBytes_obj_free_instance != NULL) { + self = main_____repr___3_HexBytes_obj_free_instance; + main_____repr___3_HexBytes_obj_free_instance = NULL; + Py_SET_REFCNT(self, 1); + PyObject_GC_Track(self); + return (PyObject *)self; + } + self = (faster_hexbytes___main_____repr___3_HexBytes_objObject *)type->tp_alloc(type, 0); + if (self == NULL) + return NULL; + self->vtable = main_____repr___3_HexBytes_obj_vtable; + self->vectorcall = CPyPy_main_____repr___3_HexBytes_obj_____call__; + return (PyObject *)self; +} + +PyObject *CPyDef_main_____repr___3_HexBytes_obj(void) +{ + PyObject *self = CPyDef_main_____mypyc___3__repr___3_HexBytes_obj_setup((PyObject *)CPyType_main_____repr___3_HexBytes_obj); + if (self == NULL) + return NULL; + return self; +} + + +static PyObject *CPyDunder___get__main___to_0x_hex_HexBytes_obj(PyObject *self, PyObject *instance, PyObject *owner) { + instance = instance ? instance : Py_None; + return CPyDef_main___to_0x_hex_HexBytes_obj_____get__(self, instance, owner); +} +PyObject *CPyDef_main_____mypyc__to_0x_hex_HexBytes_obj_setup(PyObject *cpy_r_type); +PyObject *CPyDef_main___to_0x_hex_HexBytes_obj(void); + +static PyObject * +main___to_0x_hex_HexBytes_obj_new(PyTypeObject *type, PyObject *args, PyObject *kwds) +{ + if (type != CPyType_main___to_0x_hex_HexBytes_obj) { + PyErr_SetString(PyExc_TypeError, "interpreted classes cannot inherit from compiled"); + return NULL; + } + PyObject *self = CPyDef_main_____mypyc__to_0x_hex_HexBytes_obj_setup((PyObject*)type); + if (self == NULL) + return NULL; + return self; +} + +static int +main___to_0x_hex_HexBytes_obj_traverse(faster_hexbytes___main___to_0x_hex_HexBytes_objObject *self, visitproc visit, void *arg) +{ + return 0; +} + +static int +main___to_0x_hex_HexBytes_obj_clear(faster_hexbytes___main___to_0x_hex_HexBytes_objObject *self) +{ + return 0; +} + +static void +main___to_0x_hex_HexBytes_obj_dealloc(faster_hexbytes___main___to_0x_hex_HexBytes_objObject *self) +{ + PyObject_GC_UnTrack(self); + if (main___to_0x_hex_HexBytes_obj_free_instance == NULL) { + main___to_0x_hex_HexBytes_obj_free_instance = self; + return; + } + CPy_TRASHCAN_BEGIN(self, main___to_0x_hex_HexBytes_obj_dealloc) + main___to_0x_hex_HexBytes_obj_clear(self); + Py_TYPE(self)->tp_free((PyObject *)self); + CPy_TRASHCAN_END(self) +} + +static CPyVTableItem main___to_0x_hex_HexBytes_obj_vtable[2]; +static bool +CPyDef_main___to_0x_hex_HexBytes_obj_trait_vtable_setup(void) +{ + CPyVTableItem main___to_0x_hex_HexBytes_obj_vtable_scratch[] = { + (CPyVTableItem)CPyDef_main___to_0x_hex_HexBytes_obj_____call__, + (CPyVTableItem)CPyDef_main___to_0x_hex_HexBytes_obj_____get__, + }; + memcpy(main___to_0x_hex_HexBytes_obj_vtable, main___to_0x_hex_HexBytes_obj_vtable_scratch, sizeof(main___to_0x_hex_HexBytes_obj_vtable)); + return 1; +} + +static PyMethodDef main___to_0x_hex_HexBytes_obj_methods[] = { + {"__call__", + (PyCFunction)CPyPy_main___to_0x_hex_HexBytes_obj_____call__, + METH_FASTCALL | METH_KEYWORDS, PyDoc_STR("__call__($self)\n--\n\n")}, + {"__get__", + (PyCFunction)CPyPy_main___to_0x_hex_HexBytes_obj_____get__, + METH_FASTCALL | METH_KEYWORDS, PyDoc_STR("__get__($instance, owner)\n--\n\n")}, + {"__setstate__", (PyCFunction)CPyPickle_SetState, METH_O, NULL}, + {"__getstate__", (PyCFunction)CPyPickle_GetState, METH_NOARGS, NULL}, + {NULL} /* Sentinel */ +}; + +static PyTypeObject CPyType_main___to_0x_hex_HexBytes_obj_template_ = { + PyVarObject_HEAD_INIT(NULL, 0) + .tp_name = "to_0x_hex_HexBytes_obj", + .tp_new = main___to_0x_hex_HexBytes_obj_new, + .tp_dealloc = (destructor)main___to_0x_hex_HexBytes_obj_dealloc, + .tp_traverse = (traverseproc)main___to_0x_hex_HexBytes_obj_traverse, + .tp_clear = (inquiry)main___to_0x_hex_HexBytes_obj_clear, + .tp_methods = main___to_0x_hex_HexBytes_obj_methods, + .tp_call = PyVectorcall_Call, + .tp_descr_get = CPyDunder___get__main___to_0x_hex_HexBytes_obj, + .tp_basicsize = sizeof(faster_hexbytes___main___to_0x_hex_HexBytes_objObject), + .tp_vectorcall_offset = offsetof(faster_hexbytes___main___to_0x_hex_HexBytes_objObject, vectorcall), + .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HEAPTYPE | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC | _Py_TPFLAGS_HAVE_VECTORCALL, + .tp_doc = PyDoc_STR("to_0x_hex_HexBytes_obj()\n--\n\n"), +}; +static PyTypeObject *CPyType_main___to_0x_hex_HexBytes_obj_template = &CPyType_main___to_0x_hex_HexBytes_obj_template_; + +PyObject *CPyDef_main_____mypyc__to_0x_hex_HexBytes_obj_setup(PyObject *cpy_r_type) +{ + PyTypeObject *type = (PyTypeObject*)cpy_r_type; + faster_hexbytes___main___to_0x_hex_HexBytes_objObject *self; + if (main___to_0x_hex_HexBytes_obj_free_instance != NULL) { + self = main___to_0x_hex_HexBytes_obj_free_instance; + main___to_0x_hex_HexBytes_obj_free_instance = NULL; + Py_SET_REFCNT(self, 1); + PyObject_GC_Track(self); + return (PyObject *)self; + } + self = (faster_hexbytes___main___to_0x_hex_HexBytes_objObject *)type->tp_alloc(type, 0); + if (self == NULL) + return NULL; + self->vtable = main___to_0x_hex_HexBytes_obj_vtable; + self->vectorcall = CPyPy_main___to_0x_hex_HexBytes_obj_____call__; + return (PyObject *)self; +} + +PyObject *CPyDef_main___to_0x_hex_HexBytes_obj(void) +{ + PyObject *self = CPyDef_main_____mypyc__to_0x_hex_HexBytes_obj_setup((PyObject *)CPyType_main___to_0x_hex_HexBytes_obj); + if (self == NULL) + return NULL; + return self; +} + + +static PyObject *CPyDunder___get__main_____reduce___3_HexBytes_obj(PyObject *self, PyObject *instance, PyObject *owner) { + instance = instance ? instance : Py_None; + return CPyDef_main_____reduce___3_HexBytes_obj_____get__(self, instance, owner); +} +PyObject *CPyDef_main_____mypyc___3__reduce___3_HexBytes_obj_setup(PyObject *cpy_r_type); +PyObject *CPyDef_main_____reduce___3_HexBytes_obj(void); + +static PyObject * +main_____reduce___3_HexBytes_obj_new(PyTypeObject *type, PyObject *args, PyObject *kwds) +{ + if (type != CPyType_main_____reduce___3_HexBytes_obj) { + PyErr_SetString(PyExc_TypeError, "interpreted classes cannot inherit from compiled"); + return NULL; + } + PyObject *self = CPyDef_main_____mypyc___3__reduce___3_HexBytes_obj_setup((PyObject*)type); + if (self == NULL) + return NULL; + return self; +} + +static int +main_____reduce___3_HexBytes_obj_traverse(faster_hexbytes___main_____reduce___3_HexBytes_objObject *self, visitproc visit, void *arg) +{ + return 0; +} + +static int +main_____reduce___3_HexBytes_obj_clear(faster_hexbytes___main_____reduce___3_HexBytes_objObject *self) +{ + return 0; +} + +static void +main_____reduce___3_HexBytes_obj_dealloc(faster_hexbytes___main_____reduce___3_HexBytes_objObject *self) +{ + PyObject_GC_UnTrack(self); + if (main_____reduce___3_HexBytes_obj_free_instance == NULL) { + main_____reduce___3_HexBytes_obj_free_instance = self; + return; + } + CPy_TRASHCAN_BEGIN(self, main_____reduce___3_HexBytes_obj_dealloc) + main_____reduce___3_HexBytes_obj_clear(self); + Py_TYPE(self)->tp_free((PyObject *)self); + CPy_TRASHCAN_END(self) +} + +static CPyVTableItem main_____reduce___3_HexBytes_obj_vtable[2]; +static bool +CPyDef_main_____reduce___3_HexBytes_obj_trait_vtable_setup(void) +{ + CPyVTableItem main_____reduce___3_HexBytes_obj_vtable_scratch[] = { + (CPyVTableItem)CPyDef_main_____reduce___3_HexBytes_obj_____call__, + (CPyVTableItem)CPyDef_main_____reduce___3_HexBytes_obj_____get__, + }; + memcpy(main_____reduce___3_HexBytes_obj_vtable, main_____reduce___3_HexBytes_obj_vtable_scratch, sizeof(main_____reduce___3_HexBytes_obj_vtable)); + return 1; +} + +static PyMethodDef main_____reduce___3_HexBytes_obj_methods[] = { + {"__call__", + (PyCFunction)CPyPy_main_____reduce___3_HexBytes_obj_____call__, + METH_FASTCALL | METH_KEYWORDS, PyDoc_STR("__call__($self)\n--\n\n")}, + {"__get__", + (PyCFunction)CPyPy_main_____reduce___3_HexBytes_obj_____get__, + METH_FASTCALL | METH_KEYWORDS, PyDoc_STR("__get__($instance, owner)\n--\n\n")}, + {"__setstate__", (PyCFunction)CPyPickle_SetState, METH_O, NULL}, + {"__getstate__", (PyCFunction)CPyPickle_GetState, METH_NOARGS, NULL}, + {NULL} /* Sentinel */ +}; + +static PyTypeObject CPyType_main_____reduce___3_HexBytes_obj_template_ = { + PyVarObject_HEAD_INIT(NULL, 0) + .tp_name = "__reduce___HexBytes_obj", + .tp_new = main_____reduce___3_HexBytes_obj_new, + .tp_dealloc = (destructor)main_____reduce___3_HexBytes_obj_dealloc, + .tp_traverse = (traverseproc)main_____reduce___3_HexBytes_obj_traverse, + .tp_clear = (inquiry)main_____reduce___3_HexBytes_obj_clear, + .tp_methods = main_____reduce___3_HexBytes_obj_methods, + .tp_call = PyVectorcall_Call, + .tp_descr_get = CPyDunder___get__main_____reduce___3_HexBytes_obj, + .tp_basicsize = sizeof(faster_hexbytes___main_____reduce___3_HexBytes_objObject), + .tp_vectorcall_offset = offsetof(faster_hexbytes___main_____reduce___3_HexBytes_objObject, vectorcall), + .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HEAPTYPE | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC | _Py_TPFLAGS_HAVE_VECTORCALL, + .tp_doc = PyDoc_STR("__reduce___HexBytes_obj()\n--\n\n"), +}; +static PyTypeObject *CPyType_main_____reduce___3_HexBytes_obj_template = &CPyType_main_____reduce___3_HexBytes_obj_template_; + +PyObject *CPyDef_main_____mypyc___3__reduce___3_HexBytes_obj_setup(PyObject *cpy_r_type) +{ + PyTypeObject *type = (PyTypeObject*)cpy_r_type; + faster_hexbytes___main_____reduce___3_HexBytes_objObject *self; + if (main_____reduce___3_HexBytes_obj_free_instance != NULL) { + self = main_____reduce___3_HexBytes_obj_free_instance; + main_____reduce___3_HexBytes_obj_free_instance = NULL; + Py_SET_REFCNT(self, 1); + PyObject_GC_Track(self); + return (PyObject *)self; + } + self = (faster_hexbytes___main_____reduce___3_HexBytes_objObject *)type->tp_alloc(type, 0); + if (self == NULL) + return NULL; + self->vtable = main_____reduce___3_HexBytes_obj_vtable; + self->vectorcall = CPyPy_main_____reduce___3_HexBytes_obj_____call__; + return (PyObject *)self; +} + +PyObject *CPyDef_main_____reduce___3_HexBytes_obj(void) +{ + PyObject *self = CPyDef_main_____mypyc___3__reduce___3_HexBytes_obj_setup((PyObject *)CPyType_main_____reduce___3_HexBytes_obj); + if (self == NULL) + return NULL; + return self; +} + +static PyMethodDef mainmodule_methods[] = { + {NULL, NULL, 0, NULL} +}; + +int CPyExec_faster_hexbytes___main(PyObject *module) +{ + PyObject* modname = NULL; + modname = PyObject_GetAttrString((PyObject *)CPyModule_faster_hexbytes___main__internal, "__name__"); + CPyStatic_main___globals = PyModule_GetDict(CPyModule_faster_hexbytes___main__internal); + if (unlikely(CPyStatic_main___globals == NULL)) + goto fail; + CPyType_main_____new___3_HexBytes_obj = (PyTypeObject *)CPyType_FromTemplate((PyObject *)CPyType_main_____new___3_HexBytes_obj_template, NULL, modname); + if (unlikely(!CPyType_main_____new___3_HexBytes_obj)) + goto fail; + CPyType_main_____getitem___3_HexBytes_obj = (PyTypeObject *)CPyType_FromTemplate((PyObject *)CPyType_main_____getitem___3_HexBytes_obj_template, NULL, modname); + if (unlikely(!CPyType_main_____getitem___3_HexBytes_obj)) + goto fail; + CPyType_main_____repr___3_HexBytes_obj = (PyTypeObject *)CPyType_FromTemplate((PyObject *)CPyType_main_____repr___3_HexBytes_obj_template, NULL, modname); + if (unlikely(!CPyType_main_____repr___3_HexBytes_obj)) + goto fail; + CPyType_main___to_0x_hex_HexBytes_obj = (PyTypeObject *)CPyType_FromTemplate((PyObject *)CPyType_main___to_0x_hex_HexBytes_obj_template, NULL, modname); + if (unlikely(!CPyType_main___to_0x_hex_HexBytes_obj)) + goto fail; + CPyType_main_____reduce___3_HexBytes_obj = (PyTypeObject *)CPyType_FromTemplate((PyObject *)CPyType_main_____reduce___3_HexBytes_obj_template, NULL, modname); + if (unlikely(!CPyType_main_____reduce___3_HexBytes_obj)) + goto fail; + if (CPyGlobalsInit() < 0) + goto fail; + char result = CPyDef_main_____top_level__(); + if (result == 2) + goto fail; + Py_DECREF(modname); + return 0; + fail: + Py_CLEAR(CPyModule_faster_hexbytes___main__internal); + Py_CLEAR(modname); + CPy_XDECREF(CPyStatic_main____bytes_new); + CPyStatic_main____bytes_new = NULL; + Py_CLEAR(CPyType_main___HexBytes); + Py_CLEAR(CPyType_main____HexBytesSubclass1); + Py_CLEAR(CPyType_main____HexBytesSubclass2); + Py_CLEAR(CPyType_main____HexBytesSubclass3); + Py_CLEAR(CPyType_main_____new___3_HexBytes_obj); + Py_CLEAR(CPyType_main_____getitem___3_HexBytes_obj); + Py_CLEAR(CPyType_main_____repr___3_HexBytes_obj); + Py_CLEAR(CPyType_main___to_0x_hex_HexBytes_obj); + Py_CLEAR(CPyType_main_____reduce___3_HexBytes_obj); + return -1; +} +static struct PyModuleDef mainmodule = { + PyModuleDef_HEAD_INIT, + "faster_hexbytes.main", + NULL, /* docstring */ + 0, /* size of per-interpreter state of the module */ + mainmodule_methods, + NULL, +}; + +PyObject *CPyInit_faster_hexbytes___main(void) +{ + if (CPyModule_faster_hexbytes___main__internal) { + Py_INCREF(CPyModule_faster_hexbytes___main__internal); + return CPyModule_faster_hexbytes___main__internal; + } + CPyModule_faster_hexbytes___main__internal = PyModule_Create(&mainmodule); + if (unlikely(CPyModule_faster_hexbytes___main__internal == NULL)) + goto fail; + if (CPyExec_faster_hexbytes___main(CPyModule_faster_hexbytes___main__internal) != 0) + goto fail; + return CPyModule_faster_hexbytes___main__internal; + fail: + return NULL; +} + +PyObject *CPyDef_main_____new___3_HexBytes_obj_____get__(PyObject *cpy_r___mypyc_self__, PyObject *cpy_r_instance, PyObject *cpy_r_owner) { + PyObject *cpy_r_r0; + char cpy_r_r1; + PyObject *cpy_r_r2; + PyObject *cpy_r_r3; + cpy_r_r0 = (PyObject *)&_Py_NoneStruct; + cpy_r_r1 = cpy_r_instance == cpy_r_r0; + if (!cpy_r_r1) goto CPyL2; + CPy_INCREF(cpy_r___mypyc_self__); + return cpy_r___mypyc_self__; +CPyL2: ; + cpy_r_r2 = PyMethod_New(cpy_r___mypyc_self__, cpy_r_instance); + if (cpy_r_r2 == NULL) goto CPyL4; + return cpy_r_r2; +CPyL4: ; + cpy_r_r3 = NULL; + return cpy_r_r3; +} + +PyObject *CPyPy_main_____new___3_HexBytes_obj_____get__(PyObject *self, PyObject *const *args, size_t nargs, PyObject *kwnames) { + PyObject *obj___mypyc_self__ = self; + static const char * const kwlist[] = {"instance", "owner", 0}; + static CPyArg_Parser parser = {"OO:__get__", kwlist, 0}; + PyObject *obj_instance; + PyObject *obj_owner; + if (!CPyArg_ParseStackAndKeywordsSimple(args, nargs, kwnames, &parser, &obj_instance, &obj_owner)) { + return NULL; + } + PyObject *arg___mypyc_self__ = obj___mypyc_self__; + PyObject *arg_instance = obj_instance; + PyObject *arg_owner = obj_owner; + PyObject *retval = CPyDef_main_____new___3_HexBytes_obj_____get__(arg___mypyc_self__, arg_instance, arg_owner); + return retval; +fail: ; + CPy_AddTraceback("faster_hexbytes/main.py", "__get__", -1, CPyStatic_main___globals); + return NULL; +} + +PyObject *CPyDef_main_____new___3_HexBytes_obj_____call__(PyObject *cpy_r___mypyc_self__, PyObject *cpy_r_cls, PyObject *cpy_r_val) { + PyObject *cpy_r_r0; + PyObject *cpy_r_r1; + char cpy_r_r2; + PyObject **cpy_r_r4; + PyObject *cpy_r_r5; + PyObject *cpy_r_r6; + PyObject *cpy_r_r7; + cpy_r_r0 = CPyDef__utils___to_bytes(cpy_r_val); + if (unlikely(cpy_r_r0 == NULL)) { + CPy_AddTraceback("faster_hexbytes/main.py", "__new__", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL7; + } + cpy_r_r1 = CPyStatic_main____bytes_new; + if (unlikely(cpy_r_r1 == NULL)) { + goto CPyL8; + } else + goto CPyL4; +CPyL2: ; + PyErr_SetString(PyExc_NameError, "value for final name \"_bytes_new\" was not set"); + cpy_r_r2 = 0; + if (unlikely(!cpy_r_r2)) { + CPy_AddTraceback("faster_hexbytes/main.py", "__new__", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL7; + } + CPy_Unreachable(); +CPyL4: ; + PyObject *cpy_r_r3[2] = {cpy_r_cls, cpy_r_r0}; + cpy_r_r4 = (PyObject **)&cpy_r_r3; + cpy_r_r5 = PyObject_Vectorcall(cpy_r_r1, cpy_r_r4, 2, 0); + if (unlikely(cpy_r_r5 == NULL)) { + CPy_AddTraceback("faster_hexbytes/main.py", "__new__", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL9; + } + CPy_DECREF(cpy_r_r0); + if (likely(PyObject_TypeCheck(cpy_r_r5, CPyType_main___HexBytes))) + cpy_r_r6 = cpy_r_r5; + else { + CPy_TypeErrorTraceback("faster_hexbytes/main.py", "__new__", 51, CPyStatic_main___globals, "faster_hexbytes.main.HexBytes", cpy_r_r5); + goto CPyL7; + } + return cpy_r_r6; +CPyL7: ; + cpy_r_r7 = NULL; + return cpy_r_r7; +CPyL8: ; + CPy_DecRef(cpy_r_r0); + goto CPyL2; +CPyL9: ; + CPy_DecRef(cpy_r_r0); + goto CPyL7; +} + +PyObject *CPyPy_main_____new___3_HexBytes_obj_____call__(PyObject *self, PyObject *const *args, size_t nargs, PyObject *kwnames) { + PyObject *obj___mypyc_self__ = self; + static const char * const kwlist[] = {"cls", "val", 0}; + static CPyArg_Parser parser = {"OO:__call__", kwlist, 0}; + PyObject *obj_cls; + PyObject *obj_val; + if (!CPyArg_ParseStackAndKeywordsSimple(args, PyVectorcall_NARGS(nargs), kwnames, &parser, &obj_cls, &obj_val)) { + return NULL; + } + PyObject *arg___mypyc_self__ = obj___mypyc_self__; + PyObject *arg_cls = obj_cls; + PyObject *arg_val; + if (PyBytes_Check(obj_val) || PyByteArray_Check(obj_val)) + arg_val = obj_val; + else { + arg_val = NULL; + } + if (arg_val != NULL) goto __LL4; + if (PyUnicode_Check(obj_val)) + arg_val = obj_val; + else { + arg_val = NULL; + } + if (arg_val != NULL) goto __LL4; + if (PyBool_Check(obj_val)) + arg_val = obj_val; + else { + arg_val = NULL; + } + if (arg_val != NULL) goto __LL4; + arg_val = obj_val; + if (arg_val != NULL) goto __LL4; + if (PyLong_Check(obj_val)) + arg_val = obj_val; + else { + arg_val = NULL; + } + if (arg_val != NULL) goto __LL4; + CPy_TypeError("union[bytes, str, bool, object, int]", obj_val); + goto fail; +__LL4: ; + PyObject *retval = CPyDef_main_____new___3_HexBytes_obj_____call__(arg___mypyc_self__, arg_cls, arg_val); + return retval; +fail: ; + CPy_AddTraceback("faster_hexbytes/main.py", "__new__", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + return NULL; +} + +PyObject *CPyDef_main_____getitem___3_HexBytes_obj_____get__(PyObject *cpy_r___mypyc_self__, PyObject *cpy_r_instance, PyObject *cpy_r_owner) { + PyObject *cpy_r_r0; + char cpy_r_r1; + PyObject *cpy_r_r2; + PyObject *cpy_r_r3; + cpy_r_r0 = (PyObject *)&_Py_NoneStruct; + cpy_r_r1 = cpy_r_instance == cpy_r_r0; + if (!cpy_r_r1) goto CPyL2; + CPy_INCREF(cpy_r___mypyc_self__); + return cpy_r___mypyc_self__; +CPyL2: ; + cpy_r_r2 = PyMethod_New(cpy_r___mypyc_self__, cpy_r_instance); + if (cpy_r_r2 == NULL) goto CPyL4; + return cpy_r_r2; +CPyL4: ; + cpy_r_r3 = NULL; + return cpy_r_r3; +} + +PyObject *CPyPy_main_____getitem___3_HexBytes_obj_____get__(PyObject *self, PyObject *const *args, size_t nargs, PyObject *kwnames) { + PyObject *obj___mypyc_self__ = self; + static const char * const kwlist[] = {"instance", "owner", 0}; + static CPyArg_Parser parser = {"OO:__get__", kwlist, 0}; + PyObject *obj_instance; + PyObject *obj_owner; + if (!CPyArg_ParseStackAndKeywordsSimple(args, nargs, kwnames, &parser, &obj_instance, &obj_owner)) { + return NULL; + } + PyObject *arg___mypyc_self__ = obj___mypyc_self__; + PyObject *arg_instance = obj_instance; + PyObject *arg_owner = obj_owner; + PyObject *retval = CPyDef_main_____getitem___3_HexBytes_obj_____get__(arg___mypyc_self__, arg_instance, arg_owner); + return retval; +fail: ; + CPy_AddTraceback("faster_hexbytes/main.py", "__get__", -1, CPyStatic_main___globals); + return NULL; +} + +PyObject *CPyDef_main_____getitem___3_HexBytes_obj_____call__(PyObject *cpy_r___mypyc_self__, PyObject *cpy_r_self, PyObject *cpy_r_key) { + PyObject *cpy_r_r0; + PyObject *cpy_r_r1; + PyObject **cpy_r_r3; + PyObject *cpy_r_r4; + PyObject *cpy_r_r5; + char cpy_r_r6; + CPyTagged cpy_r_r7; + PyObject *cpy_r_r8; + PyObject *cpy_r_r9; + PyObject *cpy_r_r10; + char cpy_r_r11; + PyObject *cpy_r_r12; + PyObject *cpy_r_r13; + PyObject **cpy_r_r15; + PyObject *cpy_r_r16; + PyObject *cpy_r_r17; + PyObject *cpy_r_r18; + PyObject **cpy_r_r20; + PyObject *cpy_r_r21; + PyObject *cpy_r_r22; + PyObject *cpy_r_r23; + cpy_r_r0 = (PyObject *)&PyBytes_Type; + cpy_r_r1 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* '__getitem__' */ + PyObject *cpy_r_r2[3] = {cpy_r_r0, cpy_r_self, cpy_r_key}; + cpy_r_r3 = (PyObject **)&cpy_r_r2; + cpy_r_r4 = PyObject_VectorcallMethod(cpy_r_r1, cpy_r_r3, 9223372036854775811ULL, 0); + if (unlikely(cpy_r_r4 == NULL)) { + CPy_AddTraceback("faster_hexbytes/main.py", "__getitem__", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL14; + } + if (PyLong_Check(cpy_r_r4)) + cpy_r_r5 = cpy_r_r4; + else { + cpy_r_r5 = NULL; + } + if (cpy_r_r5 != NULL) goto __LL5; + if (PyBytes_Check(cpy_r_r4) || PyByteArray_Check(cpy_r_r4)) + cpy_r_r5 = cpy_r_r4; + else { + cpy_r_r5 = NULL; + } + if (cpy_r_r5 != NULL) goto __LL5; + CPy_TypeErrorTraceback("faster_hexbytes/main.py", "__getitem__", 64, CPyStatic_main___globals, "union[int, bytes]", cpy_r_r4); + goto CPyL14; +__LL5: ; + cpy_r_r6 = PyLong_Check(cpy_r_r5); + if (!cpy_r_r6) goto CPyL5; + if (likely(PyLong_Check(cpy_r_r5))) + cpy_r_r7 = CPyTagged_FromObject(cpy_r_r5); + else { + CPy_TypeError("int", cpy_r_r5); cpy_r_r7 = CPY_INT_TAG; + } + CPy_DECREF(cpy_r_r5); + if (unlikely(cpy_r_r7 == CPY_INT_TAG)) { + CPy_AddTraceback("faster_hexbytes/main.py", "__getitem__", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL14; + } + cpy_r_r8 = CPyTagged_StealAsObject(cpy_r_r7); + return cpy_r_r8; +CPyL5: ; + cpy_r_r9 = CPy_TYPE(cpy_r_self); + cpy_r_r10 = (PyObject *)CPyType_main___HexBytes; + cpy_r_r11 = cpy_r_r9 == cpy_r_r10; + if (cpy_r_r11) { + goto CPyL15; + } else + goto CPyL10; +CPyL6: ; + if (likely(PyBytes_Check(cpy_r_r5) || PyByteArray_Check(cpy_r_r5))) + cpy_r_r12 = cpy_r_r5; + else { + CPy_TypeErrorTraceback("faster_hexbytes/main.py", "__getitem__", 70, CPyStatic_main___globals, "bytes", cpy_r_r5); + goto CPyL14; + } + cpy_r_r13 = (PyObject *)CPyType_main___HexBytes; + PyObject *cpy_r_r14[1] = {cpy_r_r12}; + cpy_r_r15 = (PyObject **)&cpy_r_r14; + cpy_r_r16 = PyObject_Vectorcall(cpy_r_r13, cpy_r_r15, 1, 0); + if (unlikely(cpy_r_r16 == NULL)) { + CPy_AddTraceback("faster_hexbytes/main.py", "__getitem__", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL16; + } + CPy_DECREF(cpy_r_r12); + if (likely(PyObject_TypeCheck(cpy_r_r16, CPyType_main___HexBytes))) + cpy_r_r17 = cpy_r_r16; + else { + CPy_TypeErrorTraceback("faster_hexbytes/main.py", "__getitem__", 70, CPyStatic_main___globals, "faster_hexbytes.main.HexBytes", cpy_r_r16); + goto CPyL14; + } + return cpy_r_r17; +CPyL10: ; + if (likely(PyBytes_Check(cpy_r_r5) || PyByteArray_Check(cpy_r_r5))) + cpy_r_r18 = cpy_r_r5; + else { + CPy_TypeErrorTraceback("faster_hexbytes/main.py", "__getitem__", 71, CPyStatic_main___globals, "bytes", cpy_r_r5); + goto CPyL17; + } + PyObject *cpy_r_r19[1] = {cpy_r_r18}; + cpy_r_r20 = (PyObject **)&cpy_r_r19; + cpy_r_r21 = PyObject_Vectorcall(cpy_r_r9, cpy_r_r20, 1, 0); + CPy_DECREF(cpy_r_r9); + if (unlikely(cpy_r_r21 == NULL)) { + CPy_AddTraceback("faster_hexbytes/main.py", "__getitem__", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL18; + } + CPy_DECREF(cpy_r_r18); + if (likely(PyObject_TypeCheck(cpy_r_r21, CPyType_main___HexBytes))) + cpy_r_r22 = cpy_r_r21; + else { + CPy_TypeErrorTraceback("faster_hexbytes/main.py", "__getitem__", 71, CPyStatic_main___globals, "faster_hexbytes.main.HexBytes", cpy_r_r21); + goto CPyL14; + } + return cpy_r_r22; +CPyL14: ; + cpy_r_r23 = NULL; + return cpy_r_r23; +CPyL15: ; + CPy_DECREF(cpy_r_r9); + goto CPyL6; +CPyL16: ; + CPy_DecRef(cpy_r_r12); + goto CPyL14; +CPyL17: ; + CPy_DecRef(cpy_r_r9); + goto CPyL14; +CPyL18: ; + CPy_DecRef(cpy_r_r18); + goto CPyL14; +} + +PyObject *CPyPy_main_____getitem___3_HexBytes_obj_____call__(PyObject *self, PyObject *const *args, size_t nargs, PyObject *kwnames) { + PyObject *obj___mypyc_self__ = self; + static const char * const kwlist[] = {"self", "key", 0}; + static CPyArg_Parser parser = {"OO:__call__", kwlist, 0}; + PyObject *obj_self; + PyObject *obj_key; + if (!CPyArg_ParseStackAndKeywordsSimple(args, PyVectorcall_NARGS(nargs), kwnames, &parser, &obj_self, &obj_key)) { + return NULL; + } + PyObject *arg___mypyc_self__ = obj___mypyc_self__; + PyObject *arg_self; + if (likely(PyObject_TypeCheck(obj_self, CPyType_main___HexBytes))) + arg_self = obj_self; + else { + CPy_TypeError("faster_hexbytes.main.HexBytes", obj_self); + goto fail; + } + PyObject *arg_key = obj_key; + PyObject *retval = CPyDef_main_____getitem___3_HexBytes_obj_____call__(arg___mypyc_self__, arg_self, arg_key); + return retval; +fail: ; + CPy_AddTraceback("faster_hexbytes/main.py", "__getitem__", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + return NULL; +} + +PyObject *CPyDef_main_____repr___3_HexBytes_obj_____get__(PyObject *cpy_r___mypyc_self__, PyObject *cpy_r_instance, PyObject *cpy_r_owner) { + PyObject *cpy_r_r0; + char cpy_r_r1; + PyObject *cpy_r_r2; + PyObject *cpy_r_r3; + cpy_r_r0 = (PyObject *)&_Py_NoneStruct; + cpy_r_r1 = cpy_r_instance == cpy_r_r0; + if (!cpy_r_r1) goto CPyL2; + CPy_INCREF(cpy_r___mypyc_self__); + return cpy_r___mypyc_self__; +CPyL2: ; + cpy_r_r2 = PyMethod_New(cpy_r___mypyc_self__, cpy_r_instance); + if (cpy_r_r2 == NULL) goto CPyL4; + return cpy_r_r2; +CPyL4: ; + cpy_r_r3 = NULL; + return cpy_r_r3; +} + +PyObject *CPyPy_main_____repr___3_HexBytes_obj_____get__(PyObject *self, PyObject *const *args, size_t nargs, PyObject *kwnames) { + PyObject *obj___mypyc_self__ = self; + static const char * const kwlist[] = {"instance", "owner", 0}; + static CPyArg_Parser parser = {"OO:__get__", kwlist, 0}; + PyObject *obj_instance; + PyObject *obj_owner; + if (!CPyArg_ParseStackAndKeywordsSimple(args, nargs, kwnames, &parser, &obj_instance, &obj_owner)) { + return NULL; + } + PyObject *arg___mypyc_self__ = obj___mypyc_self__; + PyObject *arg_instance = obj_instance; + PyObject *arg_owner = obj_owner; + PyObject *retval = CPyDef_main_____repr___3_HexBytes_obj_____get__(arg___mypyc_self__, arg_instance, arg_owner); + return retval; +fail: ; + CPy_AddTraceback("faster_hexbytes/main.py", "__get__", -1, CPyStatic_main___globals); + return NULL; +} + +PyObject *CPyDef_main_____repr___3_HexBytes_obj_____call__(PyObject *cpy_r___mypyc_self__, PyObject *cpy_r_self) { + PyObject *cpy_r_r0; + PyObject *cpy_r_r1; + PyObject **cpy_r_r3; + PyObject *cpy_r_r4; + PyObject *cpy_r_r5; + PyObject *cpy_r_r6; + PyObject *cpy_r_r7; + PyObject *cpy_r_r8; + cpy_r_r0 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* "HexBytes('0x" */ + cpy_r_r1 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* 'hex' */ + PyObject *cpy_r_r2[1] = {cpy_r_self}; + cpy_r_r3 = (PyObject **)&cpy_r_r2; + cpy_r_r4 = PyObject_VectorcallMethod(cpy_r_r1, cpy_r_r3, 9223372036854775809ULL, 0); + if (unlikely(cpy_r_r4 == NULL)) { + CPy_AddTraceback("faster_hexbytes/main.py", "__repr__", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL4; + } + if (likely(PyUnicode_Check(cpy_r_r4))) + cpy_r_r5 = cpy_r_r4; + else { + CPy_TypeErrorTraceback("faster_hexbytes/main.py", "__repr__", 74, CPyStatic_main___globals, "str", cpy_r_r4); + goto CPyL4; + } + cpy_r_r6 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* "')" */ + cpy_r_r7 = CPyStr_Build(3, cpy_r_r0, cpy_r_r5, cpy_r_r6); + CPy_DECREF(cpy_r_r5); + if (unlikely(cpy_r_r7 == NULL)) { + CPy_AddTraceback("faster_hexbytes/main.py", "__repr__", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL4; + } + return cpy_r_r7; +CPyL4: ; + cpy_r_r8 = NULL; + return cpy_r_r8; +} + +PyObject *CPyPy_main_____repr___3_HexBytes_obj_____call__(PyObject *self, PyObject *const *args, size_t nargs, PyObject *kwnames) { + PyObject *obj___mypyc_self__ = self; + static const char * const kwlist[] = {"self", 0}; + static CPyArg_Parser parser = {"O:__call__", kwlist, 0}; + PyObject *obj_self; + if (!CPyArg_ParseStackAndKeywordsOneArg(args, PyVectorcall_NARGS(nargs), kwnames, &parser, &obj_self)) { + return NULL; + } + PyObject *arg___mypyc_self__ = obj___mypyc_self__; + PyObject *arg_self; + if (likely(PyObject_TypeCheck(obj_self, CPyType_main___HexBytes))) + arg_self = obj_self; + else { + CPy_TypeError("faster_hexbytes.main.HexBytes", obj_self); + goto fail; + } + PyObject *retval = CPyDef_main_____repr___3_HexBytes_obj_____call__(arg___mypyc_self__, arg_self); + return retval; +fail: ; + CPy_AddTraceback("faster_hexbytes/main.py", "__repr__", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + return NULL; +} + +PyObject *CPyDef_main___to_0x_hex_HexBytes_obj_____get__(PyObject *cpy_r___mypyc_self__, PyObject *cpy_r_instance, PyObject *cpy_r_owner) { + PyObject *cpy_r_r0; + char cpy_r_r1; + PyObject *cpy_r_r2; + PyObject *cpy_r_r3; + cpy_r_r0 = (PyObject *)&_Py_NoneStruct; + cpy_r_r1 = cpy_r_instance == cpy_r_r0; + if (!cpy_r_r1) goto CPyL2; + CPy_INCREF(cpy_r___mypyc_self__); + return cpy_r___mypyc_self__; +CPyL2: ; + cpy_r_r2 = PyMethod_New(cpy_r___mypyc_self__, cpy_r_instance); + if (cpy_r_r2 == NULL) goto CPyL4; + return cpy_r_r2; +CPyL4: ; + cpy_r_r3 = NULL; + return cpy_r_r3; +} + +PyObject *CPyPy_main___to_0x_hex_HexBytes_obj_____get__(PyObject *self, PyObject *const *args, size_t nargs, PyObject *kwnames) { + PyObject *obj___mypyc_self__ = self; + static const char * const kwlist[] = {"instance", "owner", 0}; + static CPyArg_Parser parser = {"OO:__get__", kwlist, 0}; + PyObject *obj_instance; + PyObject *obj_owner; + if (!CPyArg_ParseStackAndKeywordsSimple(args, nargs, kwnames, &parser, &obj_instance, &obj_owner)) { + return NULL; + } + PyObject *arg___mypyc_self__ = obj___mypyc_self__; + PyObject *arg_instance = obj_instance; + PyObject *arg_owner = obj_owner; + PyObject *retval = CPyDef_main___to_0x_hex_HexBytes_obj_____get__(arg___mypyc_self__, arg_instance, arg_owner); + return retval; +fail: ; + CPy_AddTraceback("faster_hexbytes/main.py", "__get__", -1, CPyStatic_main___globals); + return NULL; +} + +PyObject *CPyDef_main___to_0x_hex_HexBytes_obj_____call__(PyObject *cpy_r___mypyc_self__, PyObject *cpy_r_self) { + PyObject *cpy_r_r0; + PyObject *cpy_r_r1; + PyObject **cpy_r_r3; + PyObject *cpy_r_r4; + PyObject *cpy_r_r5; + PyObject *cpy_r_r6; + PyObject *cpy_r_r7; + cpy_r_r0 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* '0x' */ + cpy_r_r1 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* 'hex' */ + PyObject *cpy_r_r2[1] = {cpy_r_self}; + cpy_r_r3 = (PyObject **)&cpy_r_r2; + cpy_r_r4 = PyObject_VectorcallMethod(cpy_r_r1, cpy_r_r3, 9223372036854775809ULL, 0); + if (unlikely(cpy_r_r4 == NULL)) { + CPy_AddTraceback("faster_hexbytes/main.py", "to_0x_hex", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL4; + } + if (likely(PyUnicode_Check(cpy_r_r4))) + cpy_r_r5 = cpy_r_r4; + else { + CPy_TypeErrorTraceback("faster_hexbytes/main.py", "to_0x_hex", 80, CPyStatic_main___globals, "str", cpy_r_r4); + goto CPyL4; + } + cpy_r_r6 = CPyStr_Build(2, cpy_r_r0, cpy_r_r5); + CPy_DECREF(cpy_r_r5); + if (unlikely(cpy_r_r6 == NULL)) { + CPy_AddTraceback("faster_hexbytes/main.py", "to_0x_hex", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL4; + } + return cpy_r_r6; +CPyL4: ; + cpy_r_r7 = NULL; + return cpy_r_r7; +} + +PyObject *CPyPy_main___to_0x_hex_HexBytes_obj_____call__(PyObject *self, PyObject *const *args, size_t nargs, PyObject *kwnames) { + PyObject *obj___mypyc_self__ = self; + static const char * const kwlist[] = {"self", 0}; + static CPyArg_Parser parser = {"O:__call__", kwlist, 0}; + PyObject *obj_self; + if (!CPyArg_ParseStackAndKeywordsOneArg(args, PyVectorcall_NARGS(nargs), kwnames, &parser, &obj_self)) { + return NULL; + } + PyObject *arg___mypyc_self__ = obj___mypyc_self__; + PyObject *arg_self; + if (likely(PyObject_TypeCheck(obj_self, CPyType_main___HexBytes))) + arg_self = obj_self; + else { + CPy_TypeError("faster_hexbytes.main.HexBytes", obj_self); + goto fail; + } + PyObject *retval = CPyDef_main___to_0x_hex_HexBytes_obj_____call__(arg___mypyc_self__, arg_self); + return retval; +fail: ; + CPy_AddTraceback("faster_hexbytes/main.py", "to_0x_hex", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + return NULL; +} + +PyObject *CPyDef_main_____reduce___3_HexBytes_obj_____get__(PyObject *cpy_r___mypyc_self__, PyObject *cpy_r_instance, PyObject *cpy_r_owner) { + PyObject *cpy_r_r0; + char cpy_r_r1; + PyObject *cpy_r_r2; + PyObject *cpy_r_r3; + cpy_r_r0 = (PyObject *)&_Py_NoneStruct; + cpy_r_r1 = cpy_r_instance == cpy_r_r0; + if (!cpy_r_r1) goto CPyL2; + CPy_INCREF(cpy_r___mypyc_self__); + return cpy_r___mypyc_self__; +CPyL2: ; + cpy_r_r2 = PyMethod_New(cpy_r___mypyc_self__, cpy_r_instance); + if (cpy_r_r2 == NULL) goto CPyL4; + return cpy_r_r2; +CPyL4: ; + cpy_r_r3 = NULL; + return cpy_r_r3; +} + +PyObject *CPyPy_main_____reduce___3_HexBytes_obj_____get__(PyObject *self, PyObject *const *args, size_t nargs, PyObject *kwnames) { + PyObject *obj___mypyc_self__ = self; + static const char * const kwlist[] = {"instance", "owner", 0}; + static CPyArg_Parser parser = {"OO:__get__", kwlist, 0}; + PyObject *obj_instance; + PyObject *obj_owner; + if (!CPyArg_ParseStackAndKeywordsSimple(args, nargs, kwnames, &parser, &obj_instance, &obj_owner)) { + return NULL; + } + PyObject *arg___mypyc_self__ = obj___mypyc_self__; + PyObject *arg_instance = obj_instance; + PyObject *arg_owner = obj_owner; + PyObject *retval = CPyDef_main_____reduce___3_HexBytes_obj_____get__(arg___mypyc_self__, arg_instance, arg_owner); + return retval; +fail: ; + CPy_AddTraceback("faster_hexbytes/main.py", "__get__", -1, CPyStatic_main___globals); + return NULL; +} + +tuple_T2OT2OO CPyDef_main_____reduce___3_HexBytes_obj_____call__(PyObject *cpy_r___mypyc_self__, PyObject *cpy_r_self) { + PyObject *cpy_r_r0; + char cpy_r_r1; + PyObject *cpy_r_r2; + PyObject *cpy_r_r3; + PyObject **cpy_r_r5; + PyObject *cpy_r_r6; + PyObject *cpy_r_r7; + tuple_T2OO cpy_r_r8; + tuple_T2OT2OO cpy_r_r9; + tuple_T2OT2OO cpy_r_r10; + cpy_r_r0 = CPyStatic_main____bytes_new; + if (likely(cpy_r_r0 != NULL)) goto CPyL3; + PyErr_SetString(PyExc_NameError, "value for final name \"_bytes_new\" was not set"); + cpy_r_r1 = 0; + if (unlikely(!cpy_r_r1)) { + CPy_AddTraceback("faster_hexbytes/main.py", "__reduce__", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL6; + } + CPy_Unreachable(); +CPyL3: ; + cpy_r_r2 = CPy_TYPE(cpy_r_self); + cpy_r_r3 = (PyObject *)&PyBytes_Type; + PyObject *cpy_r_r4[1] = {cpy_r_self}; + cpy_r_r5 = (PyObject **)&cpy_r_r4; + cpy_r_r6 = PyObject_Vectorcall(cpy_r_r3, cpy_r_r5, 1, 0); + if (unlikely(cpy_r_r6 == NULL)) { + CPy_AddTraceback("faster_hexbytes/main.py", "__reduce__", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL7; + } + if (likely(PyBytes_Check(cpy_r_r6) || PyByteArray_Check(cpy_r_r6))) + cpy_r_r7 = cpy_r_r6; + else { + CPy_TypeErrorTraceback("faster_hexbytes/main.py", "__reduce__", 90, CPyStatic_main___globals, "bytes", cpy_r_r6); + goto CPyL7; + } + cpy_r_r8.f0 = cpy_r_r2; + cpy_r_r8.f1 = cpy_r_r7; + CPy_INCREF(cpy_r_r0); + cpy_r_r9.f0 = cpy_r_r0; + cpy_r_r9.f1 = cpy_r_r8; + return cpy_r_r9; +CPyL6: ; + tuple_T2OT2OO __tmp6 = { NULL, (tuple_T2OO) { NULL, NULL } }; + cpy_r_r10 = __tmp6; + return cpy_r_r10; +CPyL7: ; + CPy_DecRef(cpy_r_r2); + goto CPyL6; +} + +PyObject *CPyPy_main_____reduce___3_HexBytes_obj_____call__(PyObject *self, PyObject *const *args, size_t nargs, PyObject *kwnames) { + PyObject *obj___mypyc_self__ = self; + static const char * const kwlist[] = {"self", 0}; + static CPyArg_Parser parser = {"O:__call__", kwlist, 0}; + PyObject *obj_self; + if (!CPyArg_ParseStackAndKeywordsOneArg(args, PyVectorcall_NARGS(nargs), kwnames, &parser, &obj_self)) { + return NULL; + } + PyObject *arg___mypyc_self__ = obj___mypyc_self__; + PyObject *arg_self; + if (likely(PyObject_TypeCheck(obj_self, CPyType_main___HexBytes))) + arg_self = obj_self; + else { + CPy_TypeError("faster_hexbytes.main.HexBytes", obj_self); + goto fail; + } + tuple_T2OT2OO retval = CPyDef_main_____reduce___3_HexBytes_obj_____call__(arg___mypyc_self__, arg_self); + if (retval.f0 == NULL) { + return NULL; + } + PyObject *retbox = PyTuple_New(2); + if (unlikely(retbox == NULL)) + CPyError_OutOfMemory(); + PyObject *__tmp7 = retval.f0; + PyTuple_SET_ITEM(retbox, 0, __tmp7); + PyObject *__tmp8 = PyTuple_New(2); + if (unlikely(__tmp8 == NULL)) + CPyError_OutOfMemory(); + PyObject *__tmp9 = retval.f1.f0; + PyTuple_SET_ITEM(__tmp8, 0, __tmp9); + PyObject *__tmp10 = retval.f1.f1; + PyTuple_SET_ITEM(__tmp8, 1, __tmp10); + PyTuple_SET_ITEM(retbox, 1, __tmp8); + return retbox; +fail: ; + CPy_AddTraceback("faster_hexbytes/main.py", "__reduce__", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + return NULL; +} + +char CPyDef_main_____top_level__(void) { + PyObject *cpy_r_r0; + PyObject *cpy_r_r1; + char cpy_r_r2; + PyObject *cpy_r_r3; + PyObject *cpy_r_r4; + PyObject *cpy_r_r5; + PyObject *cpy_r_r6; + PyObject *cpy_r_r7; + PyObject *cpy_r_r8; + PyObject **cpy_r_r9; + void *cpy_r_r11; + void *cpy_r_r13; + PyObject *cpy_r_r14; + PyObject *cpy_r_r15; + PyObject *cpy_r_r16; + PyObject *cpy_r_r17; + char cpy_r_r18; + PyObject *cpy_r_r19; + PyObject *cpy_r_r20; + PyObject *cpy_r_r21; + PyObject *cpy_r_r22; + PyObject *cpy_r_r23; + PyObject *cpy_r_r24; + PyObject *cpy_r_r25; + PyObject *cpy_r_r26; + PyObject *cpy_r_r27; + PyObject *cpy_r_r28; + PyObject *cpy_r_r29; + PyObject *cpy_r_r30; + PyObject *cpy_r_r31; + PyObject *cpy_r_r32; + PyObject *cpy_r_r33; + PyObject *cpy_r_r34; + PyObject *cpy_r_r35; + PyObject *cpy_r_r36; + PyObject *cpy_r_r37; + PyObject *cpy_r_r38; + PyObject *cpy_r_r39; + PyObject *cpy_r_r40; + PyObject *cpy_r_r41; + PyObject *cpy_r_r42; + PyObject *cpy_r_r43; + tuple_T6OOOOOO cpy_r_r44; + PyObject *cpy_r_r45; + PyObject *cpy_r_r46; + PyObject *cpy_r_r47; + PyObject *cpy_r_r48; + int32_t cpy_r_r49; + char cpy_r_r50; + PyObject *cpy_r_r51; + PyObject *cpy_r_r52; + PyObject *cpy_r_r53; + PyObject *cpy_r_r54; + PyObject *cpy_r_r55; + int32_t cpy_r_r56; + char cpy_r_r57; + PyObject *cpy_r_r58; + PyObject *cpy_r_r59; + PyObject *cpy_r_r60; + PyObject *cpy_r_r61; + PyObject *cpy_r_r62; + PyObject *cpy_r_r63; + PyObject *cpy_r_r64; + char cpy_r_r65; + PyObject *cpy_r_r66; + PyObject *cpy_r_r67; + PyObject *cpy_r_r68; + PyObject **cpy_r_r70; + PyObject *cpy_r_r71; + PyObject *cpy_r_r72; + PyObject *cpy_r_r73; + PyObject *cpy_r_r74; + PyObject *cpy_r_r75; + PyObject *cpy_r_r76; + PyObject *cpy_r_r77; + PyObject *cpy_r_r78; + PyObject *cpy_r_r79; + PyObject **cpy_r_r81; + PyObject *cpy_r_r82; + PyObject *cpy_r_r83; + int32_t cpy_r_r84; + char cpy_r_r85; + PyObject *cpy_r_r86; + PyObject *cpy_r_r87; + int32_t cpy_r_r88; + char cpy_r_r89; + PyObject *cpy_r_r90; + PyObject *cpy_r_r91; + int32_t cpy_r_r92; + char cpy_r_r93; + PyObject *cpy_r_r94; + PyObject *cpy_r_r95; + int32_t cpy_r_r96; + char cpy_r_r97; + PyObject *cpy_r_r98; + PyObject *cpy_r_r99; + int32_t cpy_r_r100; + char cpy_r_r101; + PyObject *cpy_r_r102; + PyObject *cpy_r_r103; + int32_t cpy_r_r104; + char cpy_r_r105; + PyObject *cpy_r_r106; + PyObject *cpy_r_r107; + int32_t cpy_r_r108; + char cpy_r_r109; + PyObject *cpy_r_r110; + PyObject *cpy_r_r111; + int32_t cpy_r_r112; + char cpy_r_r113; + PyObject **cpy_r_r115; + PyObject *cpy_r_r116; + PyObject *cpy_r_r117; + PyObject *cpy_r_r118; + PyObject *cpy_r_r119; + PyObject *cpy_r_r120; + PyObject *cpy_r_r121; + PyObject **cpy_r_r123; + PyObject *cpy_r_r124; + PyObject *cpy_r_r125; + PyObject **cpy_r_r127; + PyObject *cpy_r_r128; + PyObject *cpy_r_r129; + PyObject *cpy_r_r130; + int32_t cpy_r_r131; + char cpy_r_r132; + PyObject *cpy_r_r133; + PyObject *cpy_r_r134; + PyObject *cpy_r_r135; + PyObject *cpy_r_r136; + PyObject *cpy_r_r137; + PyObject *cpy_r_r138; + PyObject *cpy_r_r139; + PyObject *cpy_r_r140; + char cpy_r_r141; + PyObject *cpy_r_r142; + PyObject *cpy_r_r143; + PyObject *cpy_r_r144; + PyObject **cpy_r_r146; + PyObject *cpy_r_r147; + PyObject *cpy_r_r148; + PyObject *cpy_r_r149; + PyObject *cpy_r_r150; + PyObject *cpy_r_r151; + PyObject *cpy_r_r152; + PyObject *cpy_r_r153; + int32_t cpy_r_r154; + char cpy_r_r155; + PyObject *cpy_r_r156; + PyObject *cpy_r_r157; + int32_t cpy_r_r158; + char cpy_r_r159; + PyObject *cpy_r_r160; + PyObject *cpy_r_r161; + int32_t cpy_r_r162; + char cpy_r_r163; + PyObject **cpy_r_r165; + PyObject *cpy_r_r166; + PyObject *cpy_r_r167; + PyObject *cpy_r_r168; + PyObject *cpy_r_r169; + PyObject *cpy_r_r170; + PyObject **cpy_r_r172; + PyObject *cpy_r_r173; + PyObject *cpy_r_r174; + PyObject **cpy_r_r176; + PyObject *cpy_r_r177; + PyObject *cpy_r_r178; + PyObject *cpy_r_r179; + int32_t cpy_r_r180; + char cpy_r_r181; + PyObject *cpy_r_r182; + PyObject *cpy_r_r183; + PyObject *cpy_r_r184; + PyObject *cpy_r_r185; + PyObject *cpy_r_r186; + PyObject *cpy_r_r187; + PyObject *cpy_r_r188; + PyObject *cpy_r_r189; + char cpy_r_r190; + PyObject *cpy_r_r191; + PyObject *cpy_r_r192; + PyObject *cpy_r_r193; + PyObject **cpy_r_r195; + PyObject *cpy_r_r196; + PyObject *cpy_r_r197; + PyObject *cpy_r_r198; + PyObject *cpy_r_r199; + PyObject *cpy_r_r200; + PyObject *cpy_r_r201; + PyObject *cpy_r_r202; + int32_t cpy_r_r203; + char cpy_r_r204; + PyObject *cpy_r_r205; + PyObject *cpy_r_r206; + int32_t cpy_r_r207; + char cpy_r_r208; + PyObject *cpy_r_r209; + PyObject *cpy_r_r210; + int32_t cpy_r_r211; + char cpy_r_r212; + PyObject **cpy_r_r214; + PyObject *cpy_r_r215; + PyObject *cpy_r_r216; + PyObject *cpy_r_r217; + PyObject *cpy_r_r218; + PyObject *cpy_r_r219; + PyObject **cpy_r_r221; + PyObject *cpy_r_r222; + PyObject *cpy_r_r223; + PyObject **cpy_r_r225; + PyObject *cpy_r_r226; + PyObject *cpy_r_r227; + PyObject *cpy_r_r228; + int32_t cpy_r_r229; + char cpy_r_r230; + PyObject *cpy_r_r231; + PyObject *cpy_r_r232; + PyObject *cpy_r_r233; + PyObject *cpy_r_r234; + PyObject *cpy_r_r235; + PyObject *cpy_r_r236; + PyObject *cpy_r_r237; + PyObject *cpy_r_r238; + char cpy_r_r239; + PyObject *cpy_r_r240; + PyObject *cpy_r_r241; + PyObject *cpy_r_r242; + PyObject **cpy_r_r244; + PyObject *cpy_r_r245; + PyObject *cpy_r_r246; + PyObject *cpy_r_r247; + PyObject *cpy_r_r248; + PyObject *cpy_r_r249; + PyObject *cpy_r_r250; + PyObject *cpy_r_r251; + int32_t cpy_r_r252; + char cpy_r_r253; + PyObject *cpy_r_r254; + PyObject *cpy_r_r255; + int32_t cpy_r_r256; + char cpy_r_r257; + PyObject *cpy_r_r258; + PyObject *cpy_r_r259; + int32_t cpy_r_r260; + char cpy_r_r261; + PyObject **cpy_r_r263; + PyObject *cpy_r_r264; + PyObject *cpy_r_r265; + PyObject *cpy_r_r266; + PyObject *cpy_r_r267; + PyObject *cpy_r_r268; + PyObject **cpy_r_r270; + PyObject *cpy_r_r271; + PyObject *cpy_r_r272; + PyObject **cpy_r_r274; + PyObject *cpy_r_r275; + PyObject *cpy_r_r276; + PyObject *cpy_r_r277; + int32_t cpy_r_r278; + char cpy_r_r279; + PyObject *cpy_r_r280; + char cpy_r_r281; + cpy_r_r0 = CPyModule_builtins; + cpy_r_r1 = (PyObject *)&_Py_NoneStruct; + cpy_r_r2 = cpy_r_r0 != cpy_r_r1; + if (cpy_r_r2) goto CPyL3; + cpy_r_r3 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* 'builtins' */ + cpy_r_r4 = PyImport_Import(cpy_r_r3); + if (unlikely(cpy_r_r4 == NULL)) { + CPy_AddTraceback("faster_hexbytes/main.py", "", -1, CPyStatic_main___globals); + goto CPyL105; + } + CPyModule_builtins = cpy_r_r4; + CPy_INCREF(CPyModule_builtins); + CPy_DECREF(cpy_r_r4); +CPyL3: ; + cpy_r_r5 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* ('TYPE_CHECKING', 'Callable', 'Final', 'Tuple', 'Type', + 'Union', 'overload') */ + cpy_r_r6 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* 'typing' */ + cpy_r_r7 = CPyStatic_main___globals; + cpy_r_r8 = CPyImport_ImportFromMany(cpy_r_r6, cpy_r_r5, cpy_r_r5, cpy_r_r7); + if (unlikely(cpy_r_r8 == NULL)) { + CPy_AddTraceback("faster_hexbytes/main.py", "", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL105; + } + CPyModule_typing = cpy_r_r8; + CPy_INCREF(CPyModule_typing); + CPy_DECREF(cpy_r_r8); + cpy_r_r9 = (PyObject **)&CPyModule_hexbytes___main; + PyObject **cpy_r_r10[1] = {cpy_r_r9}; + cpy_r_r11 = (void *)&cpy_r_r10; + int64_t cpy_r_r12[1] = {14}; + cpy_r_r13 = (void *)&cpy_r_r12; + cpy_r_r14 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* (('hexbytes.main', 'hexbytes.main', 'hexbytes'),) */ + cpy_r_r15 = CPyStatic_main___globals; + cpy_r_r16 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* 'faster_hexbytes/main.py' */ + cpy_r_r17 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* '' */ + cpy_r_r18 = CPyImport_ImportMany(cpy_r_r14, cpy_r_r11, cpy_r_r15, cpy_r_r16, cpy_r_r17, cpy_r_r13); + if (!cpy_r_r18) goto CPyL105; + cpy_r_r19 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* ('mypyc_attr',) */ + cpy_r_r20 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* 'mypy_extensions' */ + cpy_r_r21 = CPyStatic_main___globals; + cpy_r_r22 = CPyImport_ImportFromMany(cpy_r_r20, cpy_r_r19, cpy_r_r19, cpy_r_r21); + if (unlikely(cpy_r_r22 == NULL)) { + CPy_AddTraceback("faster_hexbytes/main.py", "", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL105; + } + CPyModule_mypy_extensions = cpy_r_r22; + CPy_INCREF(CPyModule_mypy_extensions); + CPy_DECREF(cpy_r_r22); + cpy_r_r23 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* ('Self',) */ + cpy_r_r24 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* 'typing_extensions' */ + cpy_r_r25 = CPyStatic_main___globals; + cpy_r_r26 = CPyImport_ImportFromMany(cpy_r_r24, cpy_r_r23, cpy_r_r23, cpy_r_r25); + if (unlikely(cpy_r_r26 == NULL)) { + CPy_AddTraceback("faster_hexbytes/main.py", "", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL105; + } + CPyModule_typing_extensions = cpy_r_r26; + CPy_INCREF(CPyModule_typing_extensions); + CPy_DECREF(cpy_r_r26); + cpy_r_r27 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* ('to_bytes',) */ + cpy_r_r28 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* 'faster_hexbytes._utils' */ + cpy_r_r29 = CPyStatic_main___globals; + cpy_r_r30 = CPyImport_ImportFromMany(cpy_r_r28, cpy_r_r27, cpy_r_r27, cpy_r_r29); + if (unlikely(cpy_r_r30 == NULL)) { + CPy_AddTraceback("faster_hexbytes/main.py", "", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL105; + } + CPyModule_faster_hexbytes____utils = cpy_r_r30; + CPy_INCREF(CPyModule_faster_hexbytes____utils); + CPy_DECREF(cpy_r_r30); + cpy_r_r31 = CPyStatic_main___globals; + cpy_r_r32 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* 'Union' */ + cpy_r_r33 = CPyDict_GetItem(cpy_r_r31, cpy_r_r32); + if (unlikely(cpy_r_r33 == NULL)) { + CPy_AddTraceback("faster_hexbytes/main.py", "", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL105; + } + cpy_r_r34 = (PyObject *)&PyBytes_Type; + cpy_r_r35 = (PyObject *)&PyUnicode_Type; + cpy_r_r36 = (PyObject *)&PyBool_Type; + cpy_r_r37 = CPyModule_builtins; + cpy_r_r38 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* 'bytearray' */ + cpy_r_r39 = CPyObject_GetAttr(cpy_r_r37, cpy_r_r38); + if (unlikely(cpy_r_r39 == NULL)) { + CPy_AddTraceback("faster_hexbytes/main.py", "", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL106; + } + cpy_r_r40 = (PyObject *)&PyLong_Type; + cpy_r_r41 = CPyModule_builtins; + cpy_r_r42 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* 'memoryview' */ + cpy_r_r43 = CPyObject_GetAttr(cpy_r_r41, cpy_r_r42); + if (unlikely(cpy_r_r43 == NULL)) { + CPy_AddTraceback("faster_hexbytes/main.py", "", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL107; + } + CPy_INCREF(cpy_r_r34); + CPy_INCREF(cpy_r_r35); + CPy_INCREF(cpy_r_r36); + CPy_INCREF(cpy_r_r40); + cpy_r_r44.f0 = cpy_r_r34; + cpy_r_r44.f1 = cpy_r_r35; + cpy_r_r44.f2 = cpy_r_r36; + cpy_r_r44.f3 = cpy_r_r39; + cpy_r_r44.f4 = cpy_r_r40; + cpy_r_r44.f5 = cpy_r_r43; + cpy_r_r45 = PyTuple_New(6); + if (unlikely(cpy_r_r45 == NULL)) + CPyError_OutOfMemory(); + PyObject *__tmp11 = cpy_r_r44.f0; + PyTuple_SET_ITEM(cpy_r_r45, 0, __tmp11); + PyObject *__tmp12 = cpy_r_r44.f1; + PyTuple_SET_ITEM(cpy_r_r45, 1, __tmp12); + PyObject *__tmp13 = cpy_r_r44.f2; + PyTuple_SET_ITEM(cpy_r_r45, 2, __tmp13); + PyObject *__tmp14 = cpy_r_r44.f3; + PyTuple_SET_ITEM(cpy_r_r45, 3, __tmp14); + PyObject *__tmp15 = cpy_r_r44.f4; + PyTuple_SET_ITEM(cpy_r_r45, 4, __tmp15); + PyObject *__tmp16 = cpy_r_r44.f5; + PyTuple_SET_ITEM(cpy_r_r45, 5, __tmp16); + cpy_r_r46 = PyObject_GetItem(cpy_r_r33, cpy_r_r45); + CPy_DECREF(cpy_r_r33); + CPy_DECREF(cpy_r_r45); + if (unlikely(cpy_r_r46 == NULL)) { + CPy_AddTraceback("faster_hexbytes/main.py", "", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL105; + } + cpy_r_r47 = CPyStatic_main___globals; + cpy_r_r48 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* 'BytesLike' */ + cpy_r_r49 = CPyDict_SetItem(cpy_r_r47, cpy_r_r48, cpy_r_r46); + CPy_DECREF(cpy_r_r46); + cpy_r_r50 = cpy_r_r49 >= 0; + if (unlikely(!cpy_r_r50)) { + CPy_AddTraceback("faster_hexbytes/main.py", "", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL105; + } + cpy_r_r51 = (PyObject *)&PyBytes_Type; + cpy_r_r52 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* '__new__' */ + cpy_r_r53 = CPyObject_GetAttr(cpy_r_r51, cpy_r_r52); + if (unlikely(cpy_r_r53 == NULL)) { + CPy_AddTraceback("faster_hexbytes/main.py", "", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL105; + } + CPyStatic_main____bytes_new = cpy_r_r53; + CPy_INCREF(CPyStatic_main____bytes_new); + cpy_r_r54 = CPyStatic_main___globals; + cpy_r_r55 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* '_bytes_new' */ + cpy_r_r56 = CPyDict_SetItem(cpy_r_r54, cpy_r_r55, cpy_r_r53); + CPy_DECREF(cpy_r_r53); + cpy_r_r57 = cpy_r_r56 >= 0; + if (unlikely(!cpy_r_r57)) { + CPy_AddTraceback("faster_hexbytes/main.py", "", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL105; + } + cpy_r_r58 = CPyModule_hexbytes___main; + cpy_r_r59 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* 'HexBytes' */ + cpy_r_r60 = CPyObject_GetAttr(cpy_r_r58, cpy_r_r59); + if (unlikely(cpy_r_r60 == NULL)) { + CPy_AddTraceback("faster_hexbytes/main.py", "", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL105; + } + cpy_r_r61 = PyTuple_Pack(1, cpy_r_r60); + CPy_DECREF(cpy_r_r60); + if (unlikely(cpy_r_r61 == NULL)) { + CPy_AddTraceback("faster_hexbytes/main.py", "", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL105; + } + cpy_r_r62 = (PyObject *)&PyType_Type; + cpy_r_r63 = CPy_CalculateMetaclass(cpy_r_r62, cpy_r_r61); + if (unlikely(cpy_r_r63 == NULL)) { + CPy_AddTraceback("faster_hexbytes/main.py", "", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL108; + } + cpy_r_r64 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* '__prepare__' */ + cpy_r_r65 = PyObject_HasAttr(cpy_r_r63, cpy_r_r64); + if (!cpy_r_r65) goto CPyL24; + cpy_r_r66 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* 'HexBytes' */ + cpy_r_r67 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* '__prepare__' */ + cpy_r_r68 = CPyObject_GetAttr(cpy_r_r63, cpy_r_r67); + if (unlikely(cpy_r_r68 == NULL)) { + CPy_AddTraceback("faster_hexbytes/main.py", "", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL108; + } + PyObject *cpy_r_r69[2] = {cpy_r_r66, cpy_r_r61}; + cpy_r_r70 = (PyObject **)&cpy_r_r69; + cpy_r_r71 = PyObject_Vectorcall(cpy_r_r68, cpy_r_r70, 2, 0); + CPy_DECREF(cpy_r_r68); + if (unlikely(cpy_r_r71 == NULL)) { + CPy_AddTraceback("faster_hexbytes/main.py", "", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL108; + } + if (likely(PyDict_Check(cpy_r_r71))) + cpy_r_r72 = cpy_r_r71; + else { + CPy_TypeErrorTraceback("faster_hexbytes/main.py", "", 38, CPyStatic_main___globals, "dict", cpy_r_r71); + goto CPyL108; + } + cpy_r_r73 = cpy_r_r72; + goto CPyL26; +CPyL24: ; + cpy_r_r74 = PyDict_New(); + if (unlikely(cpy_r_r74 == NULL)) { + CPy_AddTraceback("faster_hexbytes/main.py", "", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL108; + } + cpy_r_r73 = cpy_r_r74; +CPyL26: ; + cpy_r_r75 = PyDict_New(); + if (unlikely(cpy_r_r75 == NULL)) { + CPy_AddTraceback("faster_hexbytes/main.py", "", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL109; + } + cpy_r_r76 = CPyDef_main_____new___3_HexBytes_obj(); + if (unlikely(cpy_r_r76 == NULL)) { + CPy_AddTraceback("faster_hexbytes/main.py", "", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL110; + } + cpy_r_r77 = CPyModule_builtins; + cpy_r_r78 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* 'staticmethod' */ + cpy_r_r79 = CPyObject_GetAttr(cpy_r_r77, cpy_r_r78); + if (unlikely(cpy_r_r79 == NULL)) { + CPy_AddTraceback("faster_hexbytes/main.py", "", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL111; + } + PyObject *cpy_r_r80[1] = {cpy_r_r76}; + cpy_r_r81 = (PyObject **)&cpy_r_r80; + cpy_r_r82 = PyObject_Vectorcall(cpy_r_r79, cpy_r_r81, 1, 0); + CPy_DECREF(cpy_r_r79); + if (unlikely(cpy_r_r82 == NULL)) { + CPy_AddTraceback("faster_hexbytes/main.py", "", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL111; + } + CPy_DECREF_NO_IMM(cpy_r_r76); + cpy_r_r83 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* '__new__' */ + cpy_r_r84 = CPyDict_SetItem(cpy_r_r73, cpy_r_r83, cpy_r_r82); + CPy_DECREF(cpy_r_r82); + cpy_r_r85 = cpy_r_r84 >= 0; + if (unlikely(!cpy_r_r85)) { + CPy_AddTraceback("faster_hexbytes/main.py", "", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL110; + } + cpy_r_r86 = CPyDef_main_____getitem___3_HexBytes_obj(); + if (unlikely(cpy_r_r86 == NULL)) { + CPy_AddTraceback("faster_hexbytes/main.py", "", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL110; + } + cpy_r_r87 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* '__getitem__' */ + cpy_r_r88 = CPyDict_SetItem(cpy_r_r73, cpy_r_r87, cpy_r_r86); + CPy_DECREF_NO_IMM(cpy_r_r86); + cpy_r_r89 = cpy_r_r88 >= 0; + if (unlikely(!cpy_r_r89)) { + CPy_AddTraceback("faster_hexbytes/main.py", "", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL110; + } + cpy_r_r90 = CPyDef_main_____repr___3_HexBytes_obj(); + if (unlikely(cpy_r_r90 == NULL)) { + CPy_AddTraceback("faster_hexbytes/main.py", "", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL110; + } + cpy_r_r91 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* '__repr__' */ + cpy_r_r92 = CPyDict_SetItem(cpy_r_r73, cpy_r_r91, cpy_r_r90); + CPy_DECREF_NO_IMM(cpy_r_r90); + cpy_r_r93 = cpy_r_r92 >= 0; + if (unlikely(!cpy_r_r93)) { + CPy_AddTraceback("faster_hexbytes/main.py", "", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL110; + } + cpy_r_r94 = CPyDef_main___to_0x_hex_HexBytes_obj(); + if (unlikely(cpy_r_r94 == NULL)) { + CPy_AddTraceback("faster_hexbytes/main.py", "", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL110; + } + cpy_r_r95 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* 'to_0x_hex' */ + cpy_r_r96 = CPyDict_SetItem(cpy_r_r73, cpy_r_r95, cpy_r_r94); + CPy_DECREF_NO_IMM(cpy_r_r94); + cpy_r_r97 = cpy_r_r96 >= 0; + if (unlikely(!cpy_r_r97)) { + CPy_AddTraceback("faster_hexbytes/main.py", "", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL110; + } + cpy_r_r98 = CPyDef_main_____reduce___3_HexBytes_obj(); + if (unlikely(cpy_r_r98 == NULL)) { + CPy_AddTraceback("faster_hexbytes/main.py", "", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL110; + } + cpy_r_r99 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* '__reduce__' */ + cpy_r_r100 = CPyDict_SetItem(cpy_r_r73, cpy_r_r99, cpy_r_r98); + CPy_DECREF_NO_IMM(cpy_r_r98); + cpy_r_r101 = cpy_r_r100 >= 0; + if (unlikely(!cpy_r_r101)) { + CPy_AddTraceback("faster_hexbytes/main.py", "", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL110; + } + cpy_r_r102 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* 'HexBytes' */ + cpy_r_r103 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* '__annotations__' */ + cpy_r_r104 = CPyDict_SetItem(cpy_r_r73, cpy_r_r103, cpy_r_r75); + CPy_DECREF(cpy_r_r75); + cpy_r_r105 = cpy_r_r104 >= 0; + if (unlikely(!cpy_r_r105)) { + CPy_AddTraceback("faster_hexbytes/main.py", "", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL109; + } + cpy_r_r106 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* 'mypyc filler docstring' */ + cpy_r_r107 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* '__doc__' */ + cpy_r_r108 = CPyDict_SetItem(cpy_r_r73, cpy_r_r107, cpy_r_r106); + cpy_r_r109 = cpy_r_r108 >= 0; + if (unlikely(!cpy_r_r109)) { + CPy_AddTraceback("faster_hexbytes/main.py", "", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL109; + } + cpy_r_r110 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* 'faster_hexbytes.main' */ + cpy_r_r111 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* '__module__' */ + cpy_r_r112 = CPyDict_SetItem(cpy_r_r73, cpy_r_r111, cpy_r_r110); + cpy_r_r113 = cpy_r_r112 >= 0; + if (unlikely(!cpy_r_r113)) { + CPy_AddTraceback("faster_hexbytes/main.py", "", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL109; + } + PyObject *cpy_r_r114[3] = {cpy_r_r102, cpy_r_r61, cpy_r_r73}; + cpy_r_r115 = (PyObject **)&cpy_r_r114; + cpy_r_r116 = PyObject_Vectorcall(cpy_r_r63, cpy_r_r115, 3, 0); + if (unlikely(cpy_r_r116 == NULL)) { + CPy_AddTraceback("faster_hexbytes/main.py", "", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL109; + } + CPy_DECREF(cpy_r_r73); + CPy_DECREF(cpy_r_r61); + cpy_r_r117 = CPyStatic_main___globals; + cpy_r_r118 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* 'mypyc_attr' */ + cpy_r_r119 = CPyDict_GetItem(cpy_r_r117, cpy_r_r118); + if (unlikely(cpy_r_r119 == NULL)) { + CPy_AddTraceback("faster_hexbytes/main.py", "", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL112; + } + cpy_r_r120 = 0 ? Py_True : Py_False; + cpy_r_r121 = 1 ? Py_True : Py_False; + PyObject *cpy_r_r122[2] = {cpy_r_r120, cpy_r_r121}; + cpy_r_r123 = (PyObject **)&cpy_r_r122; + cpy_r_r124 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* ('native_class', 'allow_interpreted_subclasses') */ + cpy_r_r125 = PyObject_Vectorcall(cpy_r_r119, cpy_r_r123, 0, cpy_r_r124); + CPy_DECREF(cpy_r_r119); + if (unlikely(cpy_r_r125 == NULL)) { + CPy_AddTraceback("faster_hexbytes/main.py", "", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL112; + } + PyObject *cpy_r_r126[1] = {cpy_r_r116}; + cpy_r_r127 = (PyObject **)&cpy_r_r126; + cpy_r_r128 = PyObject_Vectorcall(cpy_r_r125, cpy_r_r127, 1, 0); + CPy_DECREF(cpy_r_r125); + if (unlikely(cpy_r_r128 == NULL)) { + CPy_AddTraceback("faster_hexbytes/main.py", "", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL112; + } + CPy_DECREF(cpy_r_r116); + CPyType_main___HexBytes = (PyTypeObject *)cpy_r_r128; + CPy_INCREF(CPyType_main___HexBytes); + cpy_r_r129 = CPyStatic_main___globals; + cpy_r_r130 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* 'HexBytes' */ + cpy_r_r131 = PyDict_SetItem(cpy_r_r129, cpy_r_r130, cpy_r_r128); + CPy_DECREF(cpy_r_r128); + cpy_r_r132 = cpy_r_r131 >= 0; + if (unlikely(!cpy_r_r132)) { + CPy_AddTraceback("faster_hexbytes/main.py", "", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL105; + } + cpy_r_r133 = (PyObject *)CPyType_main___HexBytes; + cpy_r_r134 = CPyStatic_main___globals; + cpy_r_r135 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* 'HexBytes' */ + cpy_r_r136 = CPyDict_GetItem(cpy_r_r134, cpy_r_r135); + if (unlikely(cpy_r_r136 == NULL)) { + CPy_AddTraceback("faster_hexbytes/main.py", "", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL105; + } + cpy_r_r137 = PyTuple_Pack(1, cpy_r_r136); + CPy_DECREF(cpy_r_r136); + if (unlikely(cpy_r_r137 == NULL)) { + CPy_AddTraceback("faster_hexbytes/main.py", "", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL105; + } + cpy_r_r138 = (PyObject *)&PyType_Type; + cpy_r_r139 = CPy_CalculateMetaclass(cpy_r_r138, cpy_r_r137); + if (unlikely(cpy_r_r139 == NULL)) { + CPy_AddTraceback("faster_hexbytes/main.py", "", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL113; + } + cpy_r_r140 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* '__prepare__' */ + cpy_r_r141 = PyObject_HasAttr(cpy_r_r139, cpy_r_r140); + if (!cpy_r_r141) goto CPyL55; + cpy_r_r142 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* '_HexBytesSubclass1' */ + cpy_r_r143 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* '__prepare__' */ + cpy_r_r144 = CPyObject_GetAttr(cpy_r_r139, cpy_r_r143); + if (unlikely(cpy_r_r144 == NULL)) { + CPy_AddTraceback("faster_hexbytes/main.py", "", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL113; + } + PyObject *cpy_r_r145[2] = {cpy_r_r142, cpy_r_r137}; + cpy_r_r146 = (PyObject **)&cpy_r_r145; + cpy_r_r147 = PyObject_Vectorcall(cpy_r_r144, cpy_r_r146, 2, 0); + CPy_DECREF(cpy_r_r144); + if (unlikely(cpy_r_r147 == NULL)) { + CPy_AddTraceback("faster_hexbytes/main.py", "", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL113; + } + if (likely(PyDict_Check(cpy_r_r147))) + cpy_r_r148 = cpy_r_r147; + else { + CPy_TypeErrorTraceback("faster_hexbytes/main.py", "", 97, CPyStatic_main___globals, "dict", cpy_r_r147); + goto CPyL113; + } + cpy_r_r149 = cpy_r_r148; + goto CPyL57; +CPyL55: ; + cpy_r_r150 = PyDict_New(); + if (unlikely(cpy_r_r150 == NULL)) { + CPy_AddTraceback("faster_hexbytes/main.py", "", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL113; + } + cpy_r_r149 = cpy_r_r150; +CPyL57: ; + cpy_r_r151 = PyDict_New(); + if (unlikely(cpy_r_r151 == NULL)) { + CPy_AddTraceback("faster_hexbytes/main.py", "", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL114; + } + cpy_r_r152 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* '_HexBytesSubclass1' */ + cpy_r_r153 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* '__annotations__' */ + cpy_r_r154 = CPyDict_SetItem(cpy_r_r149, cpy_r_r153, cpy_r_r151); + CPy_DECREF(cpy_r_r151); + cpy_r_r155 = cpy_r_r154 >= 0; + if (unlikely(!cpy_r_r155)) { + CPy_AddTraceback("faster_hexbytes/main.py", "", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL114; + } + cpy_r_r156 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* 'mypyc filler docstring' */ + cpy_r_r157 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* '__doc__' */ + cpy_r_r158 = CPyDict_SetItem(cpy_r_r149, cpy_r_r157, cpy_r_r156); + cpy_r_r159 = cpy_r_r158 >= 0; + if (unlikely(!cpy_r_r159)) { + CPy_AddTraceback("faster_hexbytes/main.py", "", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL114; + } + cpy_r_r160 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* 'faster_hexbytes.main' */ + cpy_r_r161 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* '__module__' */ + cpy_r_r162 = CPyDict_SetItem(cpy_r_r149, cpy_r_r161, cpy_r_r160); + cpy_r_r163 = cpy_r_r162 >= 0; + if (unlikely(!cpy_r_r163)) { + CPy_AddTraceback("faster_hexbytes/main.py", "", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL114; + } + PyObject *cpy_r_r164[3] = {cpy_r_r152, cpy_r_r137, cpy_r_r149}; + cpy_r_r165 = (PyObject **)&cpy_r_r164; + cpy_r_r166 = PyObject_Vectorcall(cpy_r_r139, cpy_r_r165, 3, 0); + if (unlikely(cpy_r_r166 == NULL)) { + CPy_AddTraceback("faster_hexbytes/main.py", "", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL114; + } + CPy_DECREF(cpy_r_r149); + CPy_DECREF(cpy_r_r137); + cpy_r_r167 = CPyStatic_main___globals; + cpy_r_r168 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* 'mypyc_attr' */ + cpy_r_r169 = CPyDict_GetItem(cpy_r_r167, cpy_r_r168); + if (unlikely(cpy_r_r169 == NULL)) { + CPy_AddTraceback("faster_hexbytes/main.py", "", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL115; + } + cpy_r_r170 = 0 ? Py_True : Py_False; + PyObject *cpy_r_r171[1] = {cpy_r_r170}; + cpy_r_r172 = (PyObject **)&cpy_r_r171; + cpy_r_r173 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* ('native_class',) */ + cpy_r_r174 = PyObject_Vectorcall(cpy_r_r169, cpy_r_r172, 0, cpy_r_r173); + CPy_DECREF(cpy_r_r169); + if (unlikely(cpy_r_r174 == NULL)) { + CPy_AddTraceback("faster_hexbytes/main.py", "", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL115; + } + PyObject *cpy_r_r175[1] = {cpy_r_r166}; + cpy_r_r176 = (PyObject **)&cpy_r_r175; + cpy_r_r177 = PyObject_Vectorcall(cpy_r_r174, cpy_r_r176, 1, 0); + CPy_DECREF(cpy_r_r174); + if (unlikely(cpy_r_r177 == NULL)) { + CPy_AddTraceback("faster_hexbytes/main.py", "", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL115; + } + CPy_DECREF(cpy_r_r166); + CPyType_main____HexBytesSubclass1 = (PyTypeObject *)cpy_r_r177; + CPy_INCREF(CPyType_main____HexBytesSubclass1); + cpy_r_r178 = CPyStatic_main___globals; + cpy_r_r179 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* '_HexBytesSubclass1' */ + cpy_r_r180 = PyDict_SetItem(cpy_r_r178, cpy_r_r179, cpy_r_r177); + CPy_DECREF(cpy_r_r177); + cpy_r_r181 = cpy_r_r180 >= 0; + if (unlikely(!cpy_r_r181)) { + CPy_AddTraceback("faster_hexbytes/main.py", "", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL105; + } + cpy_r_r182 = (PyObject *)CPyType_main____HexBytesSubclass1; + cpy_r_r183 = CPyStatic_main___globals; + cpy_r_r184 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* 'HexBytes' */ + cpy_r_r185 = CPyDict_GetItem(cpy_r_r183, cpy_r_r184); + if (unlikely(cpy_r_r185 == NULL)) { + CPy_AddTraceback("faster_hexbytes/main.py", "", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL105; + } + cpy_r_r186 = PyTuple_Pack(1, cpy_r_r185); + CPy_DECREF(cpy_r_r185); + if (unlikely(cpy_r_r186 == NULL)) { + CPy_AddTraceback("faster_hexbytes/main.py", "", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL105; + } + cpy_r_r187 = (PyObject *)&PyType_Type; + cpy_r_r188 = CPy_CalculateMetaclass(cpy_r_r187, cpy_r_r186); + if (unlikely(cpy_r_r188 == NULL)) { + CPy_AddTraceback("faster_hexbytes/main.py", "", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL116; + } + cpy_r_r189 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* '__prepare__' */ + cpy_r_r190 = PyObject_HasAttr(cpy_r_r188, cpy_r_r189); + if (!cpy_r_r190) goto CPyL74; + cpy_r_r191 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* '_HexBytesSubclass2' */ + cpy_r_r192 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* '__prepare__' */ + cpy_r_r193 = CPyObject_GetAttr(cpy_r_r188, cpy_r_r192); + if (unlikely(cpy_r_r193 == NULL)) { + CPy_AddTraceback("faster_hexbytes/main.py", "", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL116; + } + PyObject *cpy_r_r194[2] = {cpy_r_r191, cpy_r_r186}; + cpy_r_r195 = (PyObject **)&cpy_r_r194; + cpy_r_r196 = PyObject_Vectorcall(cpy_r_r193, cpy_r_r195, 2, 0); + CPy_DECREF(cpy_r_r193); + if (unlikely(cpy_r_r196 == NULL)) { + CPy_AddTraceback("faster_hexbytes/main.py", "", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL116; + } + if (likely(PyDict_Check(cpy_r_r196))) + cpy_r_r197 = cpy_r_r196; + else { + CPy_TypeErrorTraceback("faster_hexbytes/main.py", "", 99, CPyStatic_main___globals, "dict", cpy_r_r196); + goto CPyL116; + } + cpy_r_r198 = cpy_r_r197; + goto CPyL76; +CPyL74: ; + cpy_r_r199 = PyDict_New(); + if (unlikely(cpy_r_r199 == NULL)) { + CPy_AddTraceback("faster_hexbytes/main.py", "", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL116; + } + cpy_r_r198 = cpy_r_r199; +CPyL76: ; + cpy_r_r200 = PyDict_New(); + if (unlikely(cpy_r_r200 == NULL)) { + CPy_AddTraceback("faster_hexbytes/main.py", "", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL117; + } + cpy_r_r201 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* '_HexBytesSubclass2' */ + cpy_r_r202 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* '__annotations__' */ + cpy_r_r203 = CPyDict_SetItem(cpy_r_r198, cpy_r_r202, cpy_r_r200); + CPy_DECREF(cpy_r_r200); + cpy_r_r204 = cpy_r_r203 >= 0; + if (unlikely(!cpy_r_r204)) { + CPy_AddTraceback("faster_hexbytes/main.py", "", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL117; + } + cpy_r_r205 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* 'mypyc filler docstring' */ + cpy_r_r206 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* '__doc__' */ + cpy_r_r207 = CPyDict_SetItem(cpy_r_r198, cpy_r_r206, cpy_r_r205); + cpy_r_r208 = cpy_r_r207 >= 0; + if (unlikely(!cpy_r_r208)) { + CPy_AddTraceback("faster_hexbytes/main.py", "", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL117; + } + cpy_r_r209 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* 'faster_hexbytes.main' */ + cpy_r_r210 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* '__module__' */ + cpy_r_r211 = CPyDict_SetItem(cpy_r_r198, cpy_r_r210, cpy_r_r209); + cpy_r_r212 = cpy_r_r211 >= 0; + if (unlikely(!cpy_r_r212)) { + CPy_AddTraceback("faster_hexbytes/main.py", "", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL117; + } + PyObject *cpy_r_r213[3] = {cpy_r_r201, cpy_r_r186, cpy_r_r198}; + cpy_r_r214 = (PyObject **)&cpy_r_r213; + cpy_r_r215 = PyObject_Vectorcall(cpy_r_r188, cpy_r_r214, 3, 0); + if (unlikely(cpy_r_r215 == NULL)) { + CPy_AddTraceback("faster_hexbytes/main.py", "", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL117; + } + CPy_DECREF(cpy_r_r198); + CPy_DECREF(cpy_r_r186); + cpy_r_r216 = CPyStatic_main___globals; + cpy_r_r217 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* 'mypyc_attr' */ + cpy_r_r218 = CPyDict_GetItem(cpy_r_r216, cpy_r_r217); + if (unlikely(cpy_r_r218 == NULL)) { + CPy_AddTraceback("faster_hexbytes/main.py", "", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL118; + } + cpy_r_r219 = 0 ? Py_True : Py_False; + PyObject *cpy_r_r220[1] = {cpy_r_r219}; + cpy_r_r221 = (PyObject **)&cpy_r_r220; + cpy_r_r222 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* ('native_class',) */ + cpy_r_r223 = PyObject_Vectorcall(cpy_r_r218, cpy_r_r221, 0, cpy_r_r222); + CPy_DECREF(cpy_r_r218); + if (unlikely(cpy_r_r223 == NULL)) { + CPy_AddTraceback("faster_hexbytes/main.py", "", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL118; + } + PyObject *cpy_r_r224[1] = {cpy_r_r215}; + cpy_r_r225 = (PyObject **)&cpy_r_r224; + cpy_r_r226 = PyObject_Vectorcall(cpy_r_r223, cpy_r_r225, 1, 0); + CPy_DECREF(cpy_r_r223); + if (unlikely(cpy_r_r226 == NULL)) { + CPy_AddTraceback("faster_hexbytes/main.py", "", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL118; + } + CPy_DECREF(cpy_r_r215); + CPyType_main____HexBytesSubclass2 = (PyTypeObject *)cpy_r_r226; + CPy_INCREF(CPyType_main____HexBytesSubclass2); + cpy_r_r227 = CPyStatic_main___globals; + cpy_r_r228 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* '_HexBytesSubclass2' */ + cpy_r_r229 = PyDict_SetItem(cpy_r_r227, cpy_r_r228, cpy_r_r226); + CPy_DECREF(cpy_r_r226); + cpy_r_r230 = cpy_r_r229 >= 0; + if (unlikely(!cpy_r_r230)) { + CPy_AddTraceback("faster_hexbytes/main.py", "", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL105; + } + cpy_r_r231 = (PyObject *)CPyType_main____HexBytesSubclass2; + cpy_r_r232 = CPyStatic_main___globals; + cpy_r_r233 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* 'HexBytes' */ + cpy_r_r234 = CPyDict_GetItem(cpy_r_r232, cpy_r_r233); + if (unlikely(cpy_r_r234 == NULL)) { + CPy_AddTraceback("faster_hexbytes/main.py", "", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL105; + } + cpy_r_r235 = PyTuple_Pack(1, cpy_r_r234); + CPy_DECREF(cpy_r_r234); + if (unlikely(cpy_r_r235 == NULL)) { + CPy_AddTraceback("faster_hexbytes/main.py", "", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL105; + } + cpy_r_r236 = (PyObject *)&PyType_Type; + cpy_r_r237 = CPy_CalculateMetaclass(cpy_r_r236, cpy_r_r235); + if (unlikely(cpy_r_r237 == NULL)) { + CPy_AddTraceback("faster_hexbytes/main.py", "", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL119; + } + cpy_r_r238 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* '__prepare__' */ + cpy_r_r239 = PyObject_HasAttr(cpy_r_r237, cpy_r_r238); + if (!cpy_r_r239) goto CPyL93; + cpy_r_r240 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* '_HexBytesSubclass3' */ + cpy_r_r241 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* '__prepare__' */ + cpy_r_r242 = CPyObject_GetAttr(cpy_r_r237, cpy_r_r241); + if (unlikely(cpy_r_r242 == NULL)) { + CPy_AddTraceback("faster_hexbytes/main.py", "", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL119; + } + PyObject *cpy_r_r243[2] = {cpy_r_r240, cpy_r_r235}; + cpy_r_r244 = (PyObject **)&cpy_r_r243; + cpy_r_r245 = PyObject_Vectorcall(cpy_r_r242, cpy_r_r244, 2, 0); + CPy_DECREF(cpy_r_r242); + if (unlikely(cpy_r_r245 == NULL)) { + CPy_AddTraceback("faster_hexbytes/main.py", "", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL119; + } + if (likely(PyDict_Check(cpy_r_r245))) + cpy_r_r246 = cpy_r_r245; + else { + CPy_TypeErrorTraceback("faster_hexbytes/main.py", "", 101, CPyStatic_main___globals, "dict", cpy_r_r245); + goto CPyL119; + } + cpy_r_r247 = cpy_r_r246; + goto CPyL95; +CPyL93: ; + cpy_r_r248 = PyDict_New(); + if (unlikely(cpy_r_r248 == NULL)) { + CPy_AddTraceback("faster_hexbytes/main.py", "", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL119; + } + cpy_r_r247 = cpy_r_r248; +CPyL95: ; + cpy_r_r249 = PyDict_New(); + if (unlikely(cpy_r_r249 == NULL)) { + CPy_AddTraceback("faster_hexbytes/main.py", "", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL120; + } + cpy_r_r250 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* '_HexBytesSubclass3' */ + cpy_r_r251 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* '__annotations__' */ + cpy_r_r252 = CPyDict_SetItem(cpy_r_r247, cpy_r_r251, cpy_r_r249); + CPy_DECREF(cpy_r_r249); + cpy_r_r253 = cpy_r_r252 >= 0; + if (unlikely(!cpy_r_r253)) { + CPy_AddTraceback("faster_hexbytes/main.py", "", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL120; + } + cpy_r_r254 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* 'mypyc filler docstring' */ + cpy_r_r255 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* '__doc__' */ + cpy_r_r256 = CPyDict_SetItem(cpy_r_r247, cpy_r_r255, cpy_r_r254); + cpy_r_r257 = cpy_r_r256 >= 0; + if (unlikely(!cpy_r_r257)) { + CPy_AddTraceback("faster_hexbytes/main.py", "", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL120; + } + cpy_r_r258 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* 'faster_hexbytes.main' */ + cpy_r_r259 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* '__module__' */ + cpy_r_r260 = CPyDict_SetItem(cpy_r_r247, cpy_r_r259, cpy_r_r258); + cpy_r_r261 = cpy_r_r260 >= 0; + if (unlikely(!cpy_r_r261)) { + CPy_AddTraceback("faster_hexbytes/main.py", "", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL120; + } + PyObject *cpy_r_r262[3] = {cpy_r_r250, cpy_r_r235, cpy_r_r247}; + cpy_r_r263 = (PyObject **)&cpy_r_r262; + cpy_r_r264 = PyObject_Vectorcall(cpy_r_r237, cpy_r_r263, 3, 0); + if (unlikely(cpy_r_r264 == NULL)) { + CPy_AddTraceback("faster_hexbytes/main.py", "", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL120; + } + CPy_DECREF(cpy_r_r247); + CPy_DECREF(cpy_r_r235); + cpy_r_r265 = CPyStatic_main___globals; + cpy_r_r266 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* 'mypyc_attr' */ + cpy_r_r267 = CPyDict_GetItem(cpy_r_r265, cpy_r_r266); + if (unlikely(cpy_r_r267 == NULL)) { + CPy_AddTraceback("faster_hexbytes/main.py", "", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL121; + } + cpy_r_r268 = 0 ? Py_True : Py_False; + PyObject *cpy_r_r269[1] = {cpy_r_r268}; + cpy_r_r270 = (PyObject **)&cpy_r_r269; + cpy_r_r271 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* ('native_class',) */ + cpy_r_r272 = PyObject_Vectorcall(cpy_r_r267, cpy_r_r270, 0, cpy_r_r271); + CPy_DECREF(cpy_r_r267); + if (unlikely(cpy_r_r272 == NULL)) { + CPy_AddTraceback("faster_hexbytes/main.py", "", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL121; + } + PyObject *cpy_r_r273[1] = {cpy_r_r264}; + cpy_r_r274 = (PyObject **)&cpy_r_r273; + cpy_r_r275 = PyObject_Vectorcall(cpy_r_r272, cpy_r_r274, 1, 0); + CPy_DECREF(cpy_r_r272); + if (unlikely(cpy_r_r275 == NULL)) { + CPy_AddTraceback("faster_hexbytes/main.py", "", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL121; + } + CPy_DECREF(cpy_r_r264); + CPyType_main____HexBytesSubclass3 = (PyTypeObject *)cpy_r_r275; + CPy_INCREF(CPyType_main____HexBytesSubclass3); + cpy_r_r276 = CPyStatic_main___globals; + cpy_r_r277 = CPyStatics[DIFFCHECK_PLACEHOLDER]; /* '_HexBytesSubclass3' */ + cpy_r_r278 = PyDict_SetItem(cpy_r_r276, cpy_r_r277, cpy_r_r275); + CPy_DECREF(cpy_r_r275); + cpy_r_r279 = cpy_r_r278 >= 0; + if (unlikely(!cpy_r_r279)) { + CPy_AddTraceback("faster_hexbytes/main.py", "", DIFFCHECK_PLACEHOLDER, CPyStatic_main___globals); + goto CPyL105; + } + cpy_r_r280 = (PyObject *)CPyType_main____HexBytesSubclass3; + return 1; +CPyL105: ; + cpy_r_r281 = 2; + return cpy_r_r281; +CPyL106: ; + CPy_DecRef(cpy_r_r33); + goto CPyL105; +CPyL107: ; + CPy_DecRef(cpy_r_r33); + CPy_DecRef(cpy_r_r39); + goto CPyL105; +CPyL108: ; + CPy_DecRef(cpy_r_r61); + goto CPyL105; +CPyL109: ; + CPy_DecRef(cpy_r_r61); + CPy_DecRef(cpy_r_r73); + goto CPyL105; +CPyL110: ; + CPy_DecRef(cpy_r_r61); + CPy_DecRef(cpy_r_r73); + CPy_DecRef(cpy_r_r75); + goto CPyL105; +CPyL111: ; + CPy_DecRef(cpy_r_r61); + CPy_DecRef(cpy_r_r73); + CPy_DecRef(cpy_r_r75); + CPy_DecRef(cpy_r_r76); + goto CPyL105; +CPyL112: ; + CPy_DecRef(cpy_r_r116); + goto CPyL105; +CPyL113: ; + CPy_DecRef(cpy_r_r137); + goto CPyL105; +CPyL114: ; + CPy_DecRef(cpy_r_r137); + CPy_DecRef(cpy_r_r149); + goto CPyL105; +CPyL115: ; + CPy_DecRef(cpy_r_r166); + goto CPyL105; +CPyL116: ; + CPy_DecRef(cpy_r_r186); + goto CPyL105; +CPyL117: ; + CPy_DecRef(cpy_r_r186); + CPy_DecRef(cpy_r_r198); + goto CPyL105; +CPyL118: ; + CPy_DecRef(cpy_r_r215); + goto CPyL105; +CPyL119: ; + CPy_DecRef(cpy_r_r235); + goto CPyL105; +CPyL120: ; + CPy_DecRef(cpy_r_r235); + CPy_DecRef(cpy_r_r247); + goto CPyL105; +CPyL121: ; + CPy_DecRef(cpy_r_r264); + goto CPyL105; +} + +int CPyGlobalsInit(void) +{ + static int is_initialized = 0; + if (is_initialized) return 0; + + CPy_Init(); + CPyModule_faster_hexbytes = Py_None; + CPyModule_builtins = Py_None; + CPyModule_importlib___metadata = Py_None; + CPyModule_faster_hexbytes___main = Py_None; + CPyModule_faster_hexbytes____utils = Py_None; + CPyModule_builtins = Py_None; + CPyModule_binascii = Py_None; + CPyModule_typing = Py_None; + CPyModule_faster_hexbytes___main = Py_None; + CPyModule_builtins = Py_None; + CPyModule_typing = Py_None; + CPyModule_hexbytes___main = Py_None; + CPyModule_mypy_extensions = Py_None; + CPyModule_typing_extensions = Py_None; + CPyModule_faster_hexbytes____utils = Py_None; + if (CPyStatics_Initialize(CPyStatics, CPyLit_Str, CPyLit_Bytes, CPyLit_Int, CPyLit_Float, CPyLit_Complex, CPyLit_Tuple, CPyLit_FrozenSet) < 0) { + return -1; + } + is_initialized = 1; + return 0; +} + +PyObject *CPyStatics[DIFFCHECK_PLACEHOLDER]; +const char * const CPyLit_Str[] = { + "\005\bbuiltins\aversion\t__version\022importlib.metadata\bHexBytes", + "\004\024faster_hexbytes.main\a__all__\bhexbytes\v__version__", + "\006 Cannot convert negative integer \t to bytes\nValueError\003hex\nmemoryview\000", + "\t\017Cannot convert \a{!r:{}}\006format\t of type \005{:{}}\tTypeError\0020x\0020X\0010", + "\002\022UnicodeDecodeError\vhex string ", + "\002( may only contain [0-9a-fA-F] characters\bbinascii", + "\006\031faster_hexbytes/_utils.py\b\005Final\005Union\006typing\tunhexlify", + "\a\v__getitem__\fHexBytes(\'0x\002\')\rTYPE_CHECKING\bCallable\005Tuple\004Type", + "\004\boverload\rhexbytes.main\027faster_hexbytes/main.py\nmypyc_attr", + "\004\017mypy_extensions\004Self\021typing_extensions\bto_bytes", + "\005\026faster_hexbytes._utils\tbytearray\tBytesLike\a__new__\n_bytes_new", + "\005\v__prepare__\fstaticmethod\b__repr__\tto_0x_hex\n__reduce__", + "\004\017__annotations__\026mypyc filler docstring\a__doc__\n__module__", + "\003\fnative_class\034allow_interpreted_subclasses\022_HexBytesSubclass1", + "\002\022_HexBytesSubclass2\022_HexBytesSubclass3", + "", +}; +const char * const CPyLit_Bytes[] = { + "\002\001\001\001\000", + "", +}; +const char * const CPyLit_Int[] = { + "", +}; +const double CPyLit_Float[] = {0}; +const double CPyLit_Complex[] = {0}; +const int CPyLit_Tuple[] = { + 14, 1, 4, 1, 5, 1, 7, 3, 30, 30, 30, 1, 76, 2, 33, 34, 7, 40, 41, + 33, 42, 43, 34, 44, 3, 45, 45, 10, 1, 80, 1, 47, 1, 49, 1, 51, 2, 66, + 67, 1, 66 +}; +const int CPyLit_FrozenSet[] = {0}; +CPyModule *CPyModule_faster_hexbytes__internal = NULL; +CPyModule *CPyModule_faster_hexbytes; +PyObject *CPyStatic_faster_hexbytes___globals; +CPyModule *CPyModule_builtins; +CPyModule *CPyModule_importlib___metadata; +CPyModule *CPyModule_faster_hexbytes___main__internal = NULL; +CPyModule *CPyModule_faster_hexbytes___main; +CPyModule *CPyModule_faster_hexbytes____utils__internal = NULL; +CPyModule *CPyModule_faster_hexbytes____utils; +PyObject *CPyStatic__utils___globals; +CPyModule *CPyModule_binascii; +CPyModule *CPyModule_typing; +PyObject *CPyStatic_main___globals; +CPyModule *CPyModule_hexbytes___main; +CPyModule *CPyModule_mypy_extensions; +CPyModule *CPyModule_typing_extensions; +char CPyDef_faster_hexbytes_____top_level__(void); +PyObject *CPyStatic__utils___unhexlify = NULL; +PyObject *CPyDef__utils___to_bytes(PyObject *cpy_r_val); +PyObject *CPyPy__utils___to_bytes(PyObject *self, PyObject *const *args, size_t nargs, PyObject *kwnames); +PyObject *CPyDef__utils___hexstr_to_bytes(PyObject *cpy_r_hexstr); +PyObject *CPyPy__utils___hexstr_to_bytes(PyObject *self, PyObject *const *args, size_t nargs, PyObject *kwnames); +char CPyDef__utils_____top_level__(void); +PyObject *CPyStatic_main____bytes_new = NULL; +PyTypeObject *CPyType_main___HexBytes; +PyTypeObject *CPyType_main____HexBytesSubclass1; +PyTypeObject *CPyType_main____HexBytesSubclass2; +PyTypeObject *CPyType_main____HexBytesSubclass3; +PyTypeObject *CPyType_main_____new___3_HexBytes_obj; +PyObject *CPyDef_main_____new___3_HexBytes_obj(void); +CPyThreadLocal faster_hexbytes___main_____new___3_HexBytes_objObject *main_____new___3_HexBytes_obj_free_instance; +PyTypeObject *CPyType_main_____getitem___3_HexBytes_obj; +PyObject *CPyDef_main_____getitem___3_HexBytes_obj(void); +CPyThreadLocal faster_hexbytes___main_____getitem___3_HexBytes_objObject *main_____getitem___3_HexBytes_obj_free_instance; +PyTypeObject *CPyType_main_____repr___3_HexBytes_obj; +PyObject *CPyDef_main_____repr___3_HexBytes_obj(void); +CPyThreadLocal faster_hexbytes___main_____repr___3_HexBytes_objObject *main_____repr___3_HexBytes_obj_free_instance; +PyTypeObject *CPyType_main___to_0x_hex_HexBytes_obj; +PyObject *CPyDef_main___to_0x_hex_HexBytes_obj(void); +CPyThreadLocal faster_hexbytes___main___to_0x_hex_HexBytes_objObject *main___to_0x_hex_HexBytes_obj_free_instance; +PyTypeObject *CPyType_main_____reduce___3_HexBytes_obj; +PyObject *CPyDef_main_____reduce___3_HexBytes_obj(void); +CPyThreadLocal faster_hexbytes___main_____reduce___3_HexBytes_objObject *main_____reduce___3_HexBytes_obj_free_instance; +PyObject *CPyDef_main_____new___3_HexBytes_obj_____get__(PyObject *cpy_r___mypyc_self__, PyObject *cpy_r_instance, PyObject *cpy_r_owner); +PyObject *CPyPy_main_____new___3_HexBytes_obj_____get__(PyObject *self, PyObject *const *args, size_t nargs, PyObject *kwnames); +PyObject *CPyDef_main_____new___3_HexBytes_obj_____call__(PyObject *cpy_r___mypyc_self__, PyObject *cpy_r_cls, PyObject *cpy_r_val); +PyObject *CPyPy_main_____new___3_HexBytes_obj_____call__(PyObject *self, PyObject *const *args, size_t nargs, PyObject *kwnames); +PyObject *CPyDef_main_____getitem___3_HexBytes_obj_____get__(PyObject *cpy_r___mypyc_self__, PyObject *cpy_r_instance, PyObject *cpy_r_owner); +PyObject *CPyPy_main_____getitem___3_HexBytes_obj_____get__(PyObject *self, PyObject *const *args, size_t nargs, PyObject *kwnames); +PyObject *CPyDef_main_____getitem___3_HexBytes_obj_____call__(PyObject *cpy_r___mypyc_self__, PyObject *cpy_r_self, PyObject *cpy_r_key); +PyObject *CPyPy_main_____getitem___3_HexBytes_obj_____call__(PyObject *self, PyObject *const *args, size_t nargs, PyObject *kwnames); +PyObject *CPyDef_main_____repr___3_HexBytes_obj_____get__(PyObject *cpy_r___mypyc_self__, PyObject *cpy_r_instance, PyObject *cpy_r_owner); +PyObject *CPyPy_main_____repr___3_HexBytes_obj_____get__(PyObject *self, PyObject *const *args, size_t nargs, PyObject *kwnames); +PyObject *CPyDef_main_____repr___3_HexBytes_obj_____call__(PyObject *cpy_r___mypyc_self__, PyObject *cpy_r_self); +PyObject *CPyPy_main_____repr___3_HexBytes_obj_____call__(PyObject *self, PyObject *const *args, size_t nargs, PyObject *kwnames); +PyObject *CPyDef_main___to_0x_hex_HexBytes_obj_____get__(PyObject *cpy_r___mypyc_self__, PyObject *cpy_r_instance, PyObject *cpy_r_owner); +PyObject *CPyPy_main___to_0x_hex_HexBytes_obj_____get__(PyObject *self, PyObject *const *args, size_t nargs, PyObject *kwnames); +PyObject *CPyDef_main___to_0x_hex_HexBytes_obj_____call__(PyObject *cpy_r___mypyc_self__, PyObject *cpy_r_self); +PyObject *CPyPy_main___to_0x_hex_HexBytes_obj_____call__(PyObject *self, PyObject *const *args, size_t nargs, PyObject *kwnames); +PyObject *CPyDef_main_____reduce___3_HexBytes_obj_____get__(PyObject *cpy_r___mypyc_self__, PyObject *cpy_r_instance, PyObject *cpy_r_owner); +PyObject *CPyPy_main_____reduce___3_HexBytes_obj_____get__(PyObject *self, PyObject *const *args, size_t nargs, PyObject *kwnames); +tuple_T2OT2OO CPyDef_main_____reduce___3_HexBytes_obj_____call__(PyObject *cpy_r___mypyc_self__, PyObject *cpy_r_self); +PyObject *CPyPy_main_____reduce___3_HexBytes_obj_____call__(PyObject *self, PyObject *const *args, size_t nargs, PyObject *kwnames); +char CPyDef_main_____top_level__(void); + +static int exec_faster_hexbytes__mypyc(PyObject *module) +{ + int res; + PyObject *capsule; + PyObject *tmp; + + extern PyObject *CPyInit_faster_hexbytes(void); + capsule = PyCapsule_New((void *)CPyInit_faster_hexbytes, "faster_hexbytes__mypyc.init_faster_hexbytes", NULL); + if (!capsule) { + goto fail; + } + res = PyObject_SetAttrString(module, "init_faster_hexbytes", capsule); + Py_DECREF(capsule); + if (res < 0) { + goto fail; + } + + extern PyObject *CPyInit_faster_hexbytes____utils(void); + capsule = PyCapsule_New((void *)CPyInit_faster_hexbytes____utils, "faster_hexbytes__mypyc.init_faster_hexbytes____utils", NULL); + if (!capsule) { + goto fail; + } + res = PyObject_SetAttrString(module, "init_faster_hexbytes____utils", capsule); + Py_DECREF(capsule); + if (res < 0) { + goto fail; + } + + extern PyObject *CPyInit_faster_hexbytes___main(void); + capsule = PyCapsule_New((void *)CPyInit_faster_hexbytes___main, "faster_hexbytes__mypyc.init_faster_hexbytes___main", NULL); + if (!capsule) { + goto fail; + } + res = PyObject_SetAttrString(module, "init_faster_hexbytes___main", capsule); + Py_DECREF(capsule); + if (res < 0) { + goto fail; + } + + return 0; + fail: + return -1; +} +static PyModuleDef module_def_faster_hexbytes__mypyc = { + PyModuleDef_HEAD_INIT, + .m_name = "faster_hexbytes__mypyc", + .m_doc = NULL, + .m_size = -1, + .m_methods = NULL, +}; +PyMODINIT_FUNC PyInit_faster_hexbytes__mypyc(void) { + static PyObject *module = NULL; + if (module) { + Py_INCREF(module); + return module; + } + module = PyModule_Create(&module_def_faster_hexbytes__mypyc); + if (!module) { + return NULL; + } + if (exec_faster_hexbytes__mypyc(module) < 0) { + Py_DECREF(module); + return NULL; + } + return module; +} diff --git a/build/__native_faster_hexbytes.h b/build/__native_faster_hexbytes.h new file mode 100644 index 0000000..6b5b2ac --- /dev/null +++ b/build/__native_faster_hexbytes.h @@ -0,0 +1,72 @@ +#ifndef MYPYC_NATIVE_faster_hexbytes_H +#define MYPYC_NATIVE_faster_hexbytes_H +#include +#include +#ifndef MYPYC_DECLARED_tuple_T2OO +#define MYPYC_DECLARED_tuple_T2OO +typedef struct tuple_T2OO { + PyObject *f0; + PyObject *f1; +} tuple_T2OO; +#endif + +#ifndef MYPYC_DECLARED_tuple_T3OOO +#define MYPYC_DECLARED_tuple_T3OOO +typedef struct tuple_T3OOO { + PyObject *f0; + PyObject *f1; + PyObject *f2; +} tuple_T3OOO; +#endif + +#ifndef MYPYC_DECLARED_tuple_T2OT2OO +#define MYPYC_DECLARED_tuple_T2OT2OO +typedef struct tuple_T2OT2OO { + PyObject *f0; + tuple_T2OO f1; +} tuple_T2OT2OO; +#endif + +#ifndef MYPYC_DECLARED_tuple_T6OOOOOO +#define MYPYC_DECLARED_tuple_T6OOOOOO +typedef struct tuple_T6OOOOOO { + PyObject *f0; + PyObject *f1; + PyObject *f2; + PyObject *f3; + PyObject *f4; + PyObject *f5; +} tuple_T6OOOOOO; +#endif + +typedef struct { + PyObject_HEAD + CPyVTableItem *vtable; + vectorcallfunc vectorcall; +} faster_hexbytes___main_____new___3_HexBytes_objObject; + +typedef struct { + PyObject_HEAD + CPyVTableItem *vtable; + vectorcallfunc vectorcall; +} faster_hexbytes___main_____getitem___3_HexBytes_objObject; + +typedef struct { + PyObject_HEAD + CPyVTableItem *vtable; + vectorcallfunc vectorcall; +} faster_hexbytes___main_____repr___3_HexBytes_objObject; + +typedef struct { + PyObject_HEAD + CPyVTableItem *vtable; + vectorcallfunc vectorcall; +} faster_hexbytes___main___to_0x_hex_HexBytes_objObject; + +typedef struct { + PyObject_HEAD + CPyVTableItem *vtable; + vectorcallfunc vectorcall; +} faster_hexbytes___main_____reduce___3_HexBytes_objObject; + +#endif diff --git a/build/__native_internal_faster_hexbytes.h b/build/__native_internal_faster_hexbytes.h new file mode 100644 index 0000000..3473122 --- /dev/null +++ b/build/__native_internal_faster_hexbytes.h @@ -0,0 +1,81 @@ +#ifndef MYPYC_NATIVE_INTERNAL_faster_hexbytes_H +#define MYPYC_NATIVE_INTERNAL_faster_hexbytes_H +#include +#include +#include "__native_faster_hexbytes.h" + +int CPyGlobalsInit(void); + +extern PyObject *CPyStatics[87]; +extern const char * const CPyLit_Str[]; +extern const char * const CPyLit_Bytes[]; +extern const char * const CPyLit_Int[]; +extern const double CPyLit_Float[]; +extern const double CPyLit_Complex[]; +extern const int CPyLit_Tuple[]; +extern const int CPyLit_FrozenSet[]; +extern CPyModule *CPyModule_faster_hexbytes__internal; +extern CPyModule *CPyModule_faster_hexbytes; +extern PyObject *CPyStatic_faster_hexbytes___globals; +extern CPyModule *CPyModule_builtins; +extern CPyModule *CPyModule_importlib___metadata; +extern CPyModule *CPyModule_faster_hexbytes___main__internal; +extern CPyModule *CPyModule_faster_hexbytes___main; +extern CPyModule *CPyModule_faster_hexbytes____utils__internal; +extern CPyModule *CPyModule_faster_hexbytes____utils; +extern PyObject *CPyStatic__utils___globals; +extern CPyModule *CPyModule_binascii; +extern CPyModule *CPyModule_typing; +extern PyObject *CPyStatic_main___globals; +extern CPyModule *CPyModule_hexbytes___main; +extern CPyModule *CPyModule_mypy_extensions; +extern CPyModule *CPyModule_typing_extensions; +extern char CPyDef_faster_hexbytes_____top_level__(void); +extern PyObject *CPyStatic__utils___unhexlify; +extern PyObject *CPyDef__utils___to_bytes(PyObject *cpy_r_val); +extern PyObject *CPyPy__utils___to_bytes(PyObject *self, PyObject *const *args, size_t nargs, PyObject *kwnames); +extern PyObject *CPyDef__utils___hexstr_to_bytes(PyObject *cpy_r_hexstr); +extern PyObject *CPyPy__utils___hexstr_to_bytes(PyObject *self, PyObject *const *args, size_t nargs, PyObject *kwnames); +extern char CPyDef__utils_____top_level__(void); +extern PyObject *CPyStatic_main____bytes_new; +extern PyTypeObject *CPyType_main___HexBytes; +extern PyTypeObject *CPyType_main____HexBytesSubclass1; +extern PyTypeObject *CPyType_main____HexBytesSubclass2; +extern PyTypeObject *CPyType_main____HexBytesSubclass3; +extern PyTypeObject *CPyType_main_____new___3_HexBytes_obj; +extern PyObject *CPyDef_main_____new___3_HexBytes_obj(void); +extern CPyThreadLocal faster_hexbytes___main_____new___3_HexBytes_objObject *main_____new___3_HexBytes_obj_free_instance; +extern PyTypeObject *CPyType_main_____getitem___3_HexBytes_obj; +extern PyObject *CPyDef_main_____getitem___3_HexBytes_obj(void); +extern CPyThreadLocal faster_hexbytes___main_____getitem___3_HexBytes_objObject *main_____getitem___3_HexBytes_obj_free_instance; +extern PyTypeObject *CPyType_main_____repr___3_HexBytes_obj; +extern PyObject *CPyDef_main_____repr___3_HexBytes_obj(void); +extern CPyThreadLocal faster_hexbytes___main_____repr___3_HexBytes_objObject *main_____repr___3_HexBytes_obj_free_instance; +extern PyTypeObject *CPyType_main___to_0x_hex_HexBytes_obj; +extern PyObject *CPyDef_main___to_0x_hex_HexBytes_obj(void); +extern CPyThreadLocal faster_hexbytes___main___to_0x_hex_HexBytes_objObject *main___to_0x_hex_HexBytes_obj_free_instance; +extern PyTypeObject *CPyType_main_____reduce___3_HexBytes_obj; +extern PyObject *CPyDef_main_____reduce___3_HexBytes_obj(void); +extern CPyThreadLocal faster_hexbytes___main_____reduce___3_HexBytes_objObject *main_____reduce___3_HexBytes_obj_free_instance; +extern PyObject *CPyDef_main_____new___3_HexBytes_obj_____get__(PyObject *cpy_r___mypyc_self__, PyObject *cpy_r_instance, PyObject *cpy_r_owner); +extern PyObject *CPyPy_main_____new___3_HexBytes_obj_____get__(PyObject *self, PyObject *const *args, size_t nargs, PyObject *kwnames); +extern PyObject *CPyDef_main_____new___3_HexBytes_obj_____call__(PyObject *cpy_r___mypyc_self__, PyObject *cpy_r_cls, PyObject *cpy_r_val); +extern PyObject *CPyPy_main_____new___3_HexBytes_obj_____call__(PyObject *self, PyObject *const *args, size_t nargs, PyObject *kwnames); +extern PyObject *CPyDef_main_____getitem___3_HexBytes_obj_____get__(PyObject *cpy_r___mypyc_self__, PyObject *cpy_r_instance, PyObject *cpy_r_owner); +extern PyObject *CPyPy_main_____getitem___3_HexBytes_obj_____get__(PyObject *self, PyObject *const *args, size_t nargs, PyObject *kwnames); +extern PyObject *CPyDef_main_____getitem___3_HexBytes_obj_____call__(PyObject *cpy_r___mypyc_self__, PyObject *cpy_r_self, PyObject *cpy_r_key); +extern PyObject *CPyPy_main_____getitem___3_HexBytes_obj_____call__(PyObject *self, PyObject *const *args, size_t nargs, PyObject *kwnames); +extern PyObject *CPyDef_main_____repr___3_HexBytes_obj_____get__(PyObject *cpy_r___mypyc_self__, PyObject *cpy_r_instance, PyObject *cpy_r_owner); +extern PyObject *CPyPy_main_____repr___3_HexBytes_obj_____get__(PyObject *self, PyObject *const *args, size_t nargs, PyObject *kwnames); +extern PyObject *CPyDef_main_____repr___3_HexBytes_obj_____call__(PyObject *cpy_r___mypyc_self__, PyObject *cpy_r_self); +extern PyObject *CPyPy_main_____repr___3_HexBytes_obj_____call__(PyObject *self, PyObject *const *args, size_t nargs, PyObject *kwnames); +extern PyObject *CPyDef_main___to_0x_hex_HexBytes_obj_____get__(PyObject *cpy_r___mypyc_self__, PyObject *cpy_r_instance, PyObject *cpy_r_owner); +extern PyObject *CPyPy_main___to_0x_hex_HexBytes_obj_____get__(PyObject *self, PyObject *const *args, size_t nargs, PyObject *kwnames); +extern PyObject *CPyDef_main___to_0x_hex_HexBytes_obj_____call__(PyObject *cpy_r___mypyc_self__, PyObject *cpy_r_self); +extern PyObject *CPyPy_main___to_0x_hex_HexBytes_obj_____call__(PyObject *self, PyObject *const *args, size_t nargs, PyObject *kwnames); +extern PyObject *CPyDef_main_____reduce___3_HexBytes_obj_____get__(PyObject *cpy_r___mypyc_self__, PyObject *cpy_r_instance, PyObject *cpy_r_owner); +extern PyObject *CPyPy_main_____reduce___3_HexBytes_obj_____get__(PyObject *self, PyObject *const *args, size_t nargs, PyObject *kwnames); +extern tuple_T2OT2OO CPyDef_main_____reduce___3_HexBytes_obj_____call__(PyObject *cpy_r___mypyc_self__, PyObject *cpy_r_self); +extern PyObject *CPyPy_main_____reduce___3_HexBytes_obj_____call__(PyObject *self, PyObject *const *args, size_t nargs, PyObject *kwnames); +extern char CPyDef_main_____top_level__(void); +#endif diff --git a/build/faster_hexbytes.c b/build/faster_hexbytes.c new file mode 100644 index 0000000..f3a5670 --- /dev/null +++ b/build/faster_hexbytes.c @@ -0,0 +1,24 @@ +#ifndef DIFFCHECK_PLACEHOLDER +#define DIFFCHECK_PLACEHOLDER 0 +#endif +#include + +PyMODINIT_FUNC +PyInit_faster_hexbytes(void) +{ + PyObject *tmp; + if (!(tmp = PyImport_ImportModule("faster_hexbytes__mypyc"))) return NULL; + PyObject *capsule = PyObject_GetAttrString(tmp, "init_faster_hexbytes"); + Py_DECREF(tmp); + if (capsule == NULL) return NULL; + void *init_func = PyCapsule_GetPointer(capsule, "faster_hexbytes__mypyc.init_faster_hexbytes"); + Py_DECREF(capsule); + if (!init_func) { + return NULL; + } + return ((PyObject *(*)(void))init_func)(); +} + +// distutils sometimes spuriously tells cl to export CPyInit___init__, +// so provide that so it chills out +PyMODINIT_FUNC PyInit___init__(void) { return PyInit_faster_hexbytes(); } diff --git a/build/faster_hexbytes/_utils.c b/build/faster_hexbytes/_utils.c new file mode 100644 index 0000000..466da50 --- /dev/null +++ b/build/faster_hexbytes/_utils.c @@ -0,0 +1,21 @@ +#include + +PyMODINIT_FUNC +PyInit__utils(void) +{ + PyObject *tmp; + if (!(tmp = PyImport_ImportModule("faster_hexbytes__mypyc"))) return NULL; + PyObject *capsule = PyObject_GetAttrString(tmp, "init_faster_hexbytes____utils"); + Py_DECREF(tmp); + if (capsule == NULL) return NULL; + void *init_func = PyCapsule_GetPointer(capsule, "faster_hexbytes__mypyc.init_faster_hexbytes____utils"); + Py_DECREF(capsule); + if (!init_func) { + return NULL; + } + return ((PyObject *(*)(void))init_func)(); +} + +// distutils sometimes spuriously tells cl to export CPyInit___init__, +// so provide that so it chills out +PyMODINIT_FUNC PyInit___init__(void) { return PyInit__utils(); } diff --git a/build/faster_hexbytes/main.c b/build/faster_hexbytes/main.c new file mode 100644 index 0000000..54a5b09 --- /dev/null +++ b/build/faster_hexbytes/main.c @@ -0,0 +1,21 @@ +#include + +PyMODINIT_FUNC +PyInit_main(void) +{ + PyObject *tmp; + if (!(tmp = PyImport_ImportModule("faster_hexbytes__mypyc"))) return NULL; + PyObject *capsule = PyObject_GetAttrString(tmp, "init_faster_hexbytes___main"); + Py_DECREF(tmp); + if (capsule == NULL) return NULL; + void *init_func = PyCapsule_GetPointer(capsule, "faster_hexbytes__mypyc.init_faster_hexbytes___main"); + Py_DECREF(capsule); + if (!init_func) { + return NULL; + } + return ((PyObject *(*)(void))init_func)(); +} + +// distutils sometimes spuriously tells cl to export CPyInit___init__, +// so provide that so it chills out +PyMODINIT_FUNC PyInit___init__(void) { return PyInit_main(); } diff --git a/hexbytes/__init__.py b/faster_hexbytes/__init__.py similarity index 79% rename from hexbytes/__init__.py rename to faster_hexbytes/__init__.py index bf32717..dbacf8e 100644 --- a/hexbytes/__init__.py +++ b/faster_hexbytes/__init__.py @@ -2,7 +2,7 @@ version as __version, ) -from .main import ( +from faster_hexbytes.main import ( HexBytes, ) diff --git a/hexbytes/_utils.py b/faster_hexbytes/_utils.py similarity index 86% rename from hexbytes/_utils.py rename to faster_hexbytes/_utils.py index 5551728..baa1f95 100644 --- a/hexbytes/_utils.py +++ b/faster_hexbytes/_utils.py @@ -1,12 +1,16 @@ import binascii from typing import ( + Final, Union, ) -def to_bytes(val: Union[bool, bytearray, bytes, int, str, memoryview]) -> bytes: +unhexlify: Final = binascii.unhexlify + + +def to_bytes(val: Union[bytes, str, bytearray, bool, int, memoryview]) -> bytes: """ - Equivalent to: `eth_utils.hexstr_if_str(eth_utils.to_bytes, val)` . + Equivalent to: `faster_eth_utils.hexstr_if_str(faster_eth_utils.to_bytes, val)` . Convert a hex string, integer, or bool, to a bytes representation. Alternatively, pass through bytes or bytearray as a bytes value. @@ -51,4 +55,4 @@ def hexstr_to_bytes(hexstr: str) -> bytes: f"hex string {padded_hex} may only contain [0-9a-fA-F] characters" ) else: - return binascii.unhexlify(ascii_hex) + return unhexlify(ascii_hex) diff --git a/faster_hexbytes/main.py b/faster_hexbytes/main.py new file mode 100644 index 0000000..774cd23 --- /dev/null +++ b/faster_hexbytes/main.py @@ -0,0 +1,101 @@ +from typing import ( + TYPE_CHECKING, + Callable, + Final, + Tuple, + Type, + Union, + overload, +) + +# accessing hexbytes.HexBytes after `import hexbytes` +# fails because mypyc tries to lookup HexBytes from +# CPyModule_hexbytes___main which was never imported +import hexbytes.main as hexbytes +from mypy_extensions import ( + mypyc_attr, +) +from typing_extensions import ( + Self, +) + +from faster_hexbytes._utils import ( + to_bytes, +) + +if TYPE_CHECKING: + from typing import ( + SupportsIndex, + ) + + +BytesLike = Union[bytes, str, bool, bytearray, int, memoryview] + +_bytes_new: Final = bytes.__new__ + + +@mypyc_attr(native_class=False, allow_interpreted_subclasses=True) +class HexBytes(hexbytes.HexBytes): + """ + Thin wrapper around the python built-in :class:`bytes` class. + + It has these changes: + 1. Accepts more initializing values: bool, bytearray, bytes, (non-negative) int, + str, and memoryview + 2. The representation at console (__repr__) is 0x-prefixed + 3. ``to_0x_hex`` returns a 0x-prefixed hex string + """ + + def __new__(cls, val: BytesLike) -> Self: + bytesval = to_bytes(val) + return _bytes_new(cls, bytesval) + + @overload + def __getitem__(self, key: "SupportsIndex") -> int: # noqa: F811 + ... + + @overload # noqa: F811 + def __getitem__(self, key: slice) -> Self: # noqa: F811 + ... + + def __getitem__( # noqa: F811 + self, key: Union["SupportsIndex", slice] + ) -> Union[int, Self]: + result = bytes.__getitem__(self, key) + if isinstance(result, int): + return result + cls = type(self) + if cls is HexBytes: + # fast-path case with faster C code for non-subclass + return HexBytes(result) # type: ignore [return-value] + return cls(result) + + def __repr__(self) -> str: + return f"HexBytes('0x{self.hex()}')" + + def to_0x_hex(self) -> str: + """ + Convert the bytes to a 0x-prefixed hex string + """ + return f"0x{self.hex()}" + + def __reduce__( + self, + ) -> Tuple[Callable[..., bytes], Tuple[Type["HexBytes"], bytes]]: + """ + An optimized ``__reduce__`` that bypasses the input validation in + ``HexBytes.__new__`` since an existing HexBytes instance has already been + validated when created. + """ + return _bytes_new, (type(self), bytes(self)) + + +# these 3 helpers serve as a workaround for a mypyc bug until +# https://github.com/python/mypy/pull/19957 is merged and released + +@mypyc_attr(native_class=False) +class _HexBytesSubclass1(HexBytes): ... +@mypyc_attr(native_class=False) +class _HexBytesSubclass2(HexBytes): ... +@mypyc_attr(native_class=False) +class _HexBytesSubclass3(HexBytes): ... diff --git a/faster_hexbytes/py.typed b/faster_hexbytes/py.typed new file mode 100644 index 0000000..d3f5a12 --- /dev/null +++ b/faster_hexbytes/py.typed @@ -0,0 +1 @@ + diff --git a/hexbytes/main.py b/hexbytes/main.py deleted file mode 100644 index ca24783..0000000 --- a/hexbytes/main.py +++ /dev/null @@ -1,72 +0,0 @@ -from typing import ( - TYPE_CHECKING, - Callable, - Tuple, - Type, - Union, - cast, - overload, -) - -from ._utils import ( - to_bytes, -) - -if TYPE_CHECKING: - from typing import ( - SupportsIndex, - ) - -BytesLike = Union[bool, bytearray, bytes, int, str, memoryview] - - -class HexBytes(bytes): - """ - Thin wrapper around the python built-in :class:`bytes` class. - - It has these changes: - 1. Accepts more initializing values: bool, bytearray, bytes, (non-negative) int, - str, and memoryview - 2. The representation at console (__repr__) is 0x-prefixed - 3. ``to_0x_hex`` returns a 0x-prefixed hex string - """ - - def __new__(cls: Type[bytes], val: BytesLike) -> "HexBytes": - bytesval = to_bytes(val) - return cast(HexBytes, super().__new__(cls, bytesval)) # type: ignore # https://github.com/python/typeshed/issues/2630 # noqa: E501 - - @overload - def __getitem__(self, key: "SupportsIndex") -> int: # noqa: F811 - ... - - @overload # noqa: F811 - def __getitem__(self, key: slice) -> "HexBytes": # noqa: F811 - ... - - def __getitem__( # noqa: F811 - self, key: Union["SupportsIndex", slice] - ) -> Union[int, bytes, "HexBytes"]: - result = super().__getitem__(key) - if hasattr(result, "hex"): - return type(self)(result) - else: - return result - - def __repr__(self) -> str: - return f"HexBytes({'0x' + self.hex()!r})" - - def to_0x_hex(self) -> str: - """ - Convert the bytes to a 0x-prefixed hex string - """ - return "0x" + self.hex() - - def __reduce__( - self, - ) -> Tuple[Callable[..., bytes], Tuple[Type["HexBytes"], bytes]]: - """ - An optimized ``__reduce__`` that bypasses the input validation in - ``HexBytes.__new__`` since an existing HexBytes instance has already been - validated when created. - """ - return bytes.__new__, (type(self), bytes(self)) diff --git a/hexbytes/py.typed b/hexbytes/py.typed deleted file mode 100644 index e69de29..0000000 diff --git a/pyproject.toml b/pyproject.toml index 080d07c..0515243 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,7 @@ +[build-system] +requires = ["setuptools", "wheel", "mypy[mypyc]==1.18.2", "hexbytes==1.3.1"] +build-backend = "setuptools.build_meta" + [tool.autoflake] exclude = "__init__.py" remove_all_unused_imports = true diff --git a/renovate.json b/renovate.json new file mode 100644 index 0000000..5db72dd --- /dev/null +++ b/renovate.json @@ -0,0 +1,6 @@ +{ + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + "extends": [ + "config:recommended" + ] +} diff --git a/scripts/benchmark/compare_benchmark_results.py b/scripts/benchmark/compare_benchmark_results.py new file mode 100644 index 0000000..fbb9f2f --- /dev/null +++ b/scripts/benchmark/compare_benchmark_results.py @@ -0,0 +1,98 @@ +""" +compare_benchmark_results.py + +Compares the two implementations in each benchmark group from a pytest-benchmark parsed results JSON file, +grouped by submodule. +For each submodule and group (e.g., "abi_to_signature"), finds both implementations +(e.g., "test_abi_to_signature" and "test_faster_abi_to_signature"), computes the percent change +in mean execution time, speedup percent, and x factor, and writes a diff JSON file summarizing the results. + +Usage: + python compare_benchmark_results.py [output.json] +""" + +import json +import sys +import re +from typing import Any, Dict + + +def get_group_name(test_name: str) -> str: + # Extract group from test name, e.g., test_foo, test_faster_foo -> group: foo + m = re.match(r"test_faster_(.+)", test_name) + if m: + return m.group(1) + m = re.match(r"test_(.+)", test_name) + if m: + return m.group(1) + return test_name + + +def compare_group(group_results: Dict[str, Any]) -> Dict[str, Any]: + # Find reference and faster implementations in the group + ref = None + fast = None + ref_name = None + fast_name = None + for func_name, data in group_results.items(): + if func_name.startswith("test_faster_"): + fast = data + fast_name = func_name + elif func_name.startswith("test_"): + ref = data + ref_name = func_name + + if ref and fast: + mean_ref = ref["mean"] + mean_fast = fast["mean"] + percent_change = ( + ((mean_ref - mean_fast) / mean_ref) * 100 if mean_ref != 0 else 0.0 + ) + speedup_x = mean_ref / mean_fast if mean_fast != 0 else float("inf") + speedup_percent = ( + (speedup_x - 1) * 100 if speedup_x != float("inf") else float("inf") + ) + return { + "reference_mean": mean_ref, + "faster_mean": mean_fast, + "percent_change": percent_change, + "speedup_percent": speedup_percent, + "speedup_x": speedup_x, + "reference": ref_name, + "faster": fast_name, + } + else: + missing = [] + if not ref: + missing.append("reference") + if not fast: + missing.append("faster") + return {"note": f"Missing implementation(s): {missing}"} + + +def main() -> None: + if len(sys.argv) < 2: + print("Usage: python compare_benchmark_results.py [output.json]") + sys.exit(1) + results_path = sys.argv[1] + output_path = sys.argv[2] if len(sys.argv) > 2 else "benchmark_diff.json" + + with open(results_path, "r") as f: + results = json.load(f) + + # results: {submodule: {group: {function_name: {...}}}} + diff_by_submodule = { + submodule: { + group: compare_group(group_results) + for group, group_results in groups.items() + } + for submodule, groups in results.items() + } + + with open(output_path, "w") as f: + json.dump(diff_by_submodule, f, indent=2) + print(f"Diff written to {output_path}") + + +if __name__ == "__main__": + main() diff --git a/scripts/benchmark/generate_benchmark_markdown.py b/scripts/benchmark/generate_benchmark_markdown.py new file mode 100644 index 0000000..ea79168 --- /dev/null +++ b/scripts/benchmark/generate_benchmark_markdown.py @@ -0,0 +1,85 @@ +import os +import json + + +def main(): + diff_path = "pytest_benchmark_diff.json" + results_dir = os.path.join("benchmarks", "results") + os.makedirs(results_dir, exist_ok=True) + + # Get repo and branch info from environment variables (for links) + repo = os.environ.get("GITHUB_REPOSITORY", "unknown/unknown") + branch = os.environ.get("GITHUB_HEAD_REF") or os.environ.get( + "GITHUB_REF", "main" + ).replace("refs/heads/", "") + + with open(diff_path, "r", encoding="utf-8") as f: + diff = json.load(f) + + for submodule, groupDiffs in diff.items(): + # Convert submodule name to submodule file path (e.g., faster_hexbytes.main -> faster_hexbytes/main.py) + submoduleFile = "unknown" + benchmarkFile = "unknown" + m = None + if submodule.startswith("faster_hexbytes."): + m = submodule[len("faster_hexbytes.") :] + + if m: + submoduleFile = f"faster_hexbytes/{m}.py" + benchmarkFile = f"benchmarks/test_{m}_benchmarks.py" + + submoduleUrl = f"https://github.com/{repo}/blob/{branch}/{submoduleFile}" + benchmarkUrl = f"https://github.com/{repo}/blob/{branch}/{benchmarkFile}" + + md_lines = [] + md_lines.append( + f"#### [{submodule}]({submoduleUrl}) - [view benchmarks]({benchmarkUrl})\n" + ) + md_lines.append( + "| Function | Reference Mean | Faster Mean | % Change | Speedup (%) | x Faster | Faster |" + ) + md_lines.append( + "|----------|---------------|-------------|----------|-------------|----------|--------|" + ) + + for group, data in sorted(groupDiffs.items()): + if data.get("percent_change") is not None: + emoji = "➖" + if data["percent_change"] > 0: + emoji = "✅" + elif data["percent_change"] < 0: + emoji = "❌" + percentChange = ( + f"{data['percent_change']:.2f}%" + if data.get("percent_change") is not None + else "" + ) + speedupPercent = ( + f"{data['speedup_percent']:.2f}%" + if data.get("speedup_percent") is not None + else "" + ) + speedupX = ( + f"{data['speedup_x']:.2f}x" + if data.get("speedup_x") is not None + and isinstance(data["speedup_x"], (int, float)) + else "" + ) + md_lines.append( + f"| `{group}` | {data.get('reference_mean', '')} | {data.get('faster_mean', '')} | {percentChange} | {speedupPercent} | {speedupX} | {emoji} |" + ) + elif data.get("note"): + md_lines.append(f"| `{group}` | | | | | | ➖ |") + + md_lines.append("") # Blank line at end + md_content = "\n".join(md_lines) + + # Write to file + module_name = submodule.split(".")[-1] + out_path = os.path.join(results_dir, f"{module_name}.md") + with open(out_path, "w", encoding="utf-8") as outf: + outf.write(md_content) + + +if __name__ == "__main__": + main() diff --git a/scripts/benchmark/parse_benchmark_output.py b/scripts/benchmark/parse_benchmark_output.py new file mode 100644 index 0000000..bcf1ba9 --- /dev/null +++ b/scripts/benchmark/parse_benchmark_output.py @@ -0,0 +1,78 @@ +""" +parse_benchmark_output.py + +Extracts per-function benchmark timings from pytest-benchmark's benchmark.json output. +Parses the JSON file, finds all test function results, and writes a JSON file +mapping submodules (e.g., Python submodules like faster_hexbytes.main) to groups and their test functions and results. + +Usage: + python parse_benchmark_output.py [output.json] +""" + +import json +import sys +import re +from collections import defaultdict +from typing import Dict, Any + + +def get_submodule(bench: dict) -> str: + # Extract Python submodule from fullname, e.g., "benchmarks/test_abi_benchmarks.py::test_abi_to_signature" + fullname = bench.get("fullname", "") + # Try to extract the submodule from the test file path + m = re.search(r"benchmarks/test_([a-zA-Z0-9_]+)_benchmarks\.py", fullname) + if m: + return f"faster_hexbytes.{m.group(1)}" + return "unknown" + + +def get_group_name(test_name: str) -> str: + # Extract group from test name, e.g., test_foo, test_faster_foo -> group: foo + m = re.match(r"test_faster_(.+)", test_name) + if m: + return m.group(1) + m = re.match(r"test_(.+)", test_name) + if m: + return m.group(1) + return test_name + + +def parse_pytest_benchmark_json(data: dict) -> Dict[str, Dict[str, Dict[str, Any]]]: + """ + Parses pytest-benchmark's benchmark.json and extracts per-function timings, + grouped by submodule and group name. + Returns a dict: {submodule: {group: {function_name: {...}}}} + """ + results = defaultdict(lambda: defaultdict(dict)) + for bench in data.get("benchmarks", []): + name = bench["name"] + submodule = get_submodule(bench) + group = get_group_name(name) + stats = bench["stats"] + results[submodule][group][name] = { + "mean": stats.get("mean"), + "stddev": stats.get("stddev", None), + "iqr": stats.get("iqr", None), + "min": stats.get("min", None), + "max": stats.get("max", None), + "rounds": stats.get("rounds", None), + } + return results + + +def main() -> None: + if len(sys.argv) < 2: + print("Usage: python parse_benchmark_output.py [output.json]") + sys.exit(1) + infile = sys.argv[1] + outfile = sys.argv[2] if len(sys.argv) > 2 else "benchmark_results.json" + with open(infile, "r") as f: + data = json.load(f) + results = parse_pytest_benchmark_json(data) + with open(outfile, "w") as f: + json.dump(results, f, indent=2) + print(f"Parsed results written to {outfile}") + + +if __name__ == "__main__": + main() diff --git a/setup.py b/setup.py index 0028d8f..2675066 100644 --- a/setup.py +++ b/setup.py @@ -1,8 +1,14 @@ #!/usr/bin/env python +import sys from setuptools import ( find_packages, setup, ) +from mypyc.build import mypycify + + +version = "1.3.2" +hexbytes_version = "1.3.1" extras_require = { "dev": [ @@ -19,7 +25,7 @@ "sphinx>=6.0.0", "sphinx-autobuild>=2021.3.14", "sphinx_rtd_theme>=1.0.0", - "towncrier>=24,<25", + "towncrier>=25,<26", ], "test": [ "eth_utils>=2.0.0", @@ -38,26 +44,52 @@ long_description = readme.read() +# we can't compile on python3.8 but we can still let the user install +skip_mypyc = sys.version_info < (3, 9) or any( + cmd in sys.argv + for cmd in ("sdist", "egg_info", "--name", "--version", "--help", "--help-commands") +) + +if skip_mypyc: + ext_modules = [] +else: + ext_modules = mypycify( + ["faster_hexbytes/", "--strict", "--pretty"], + group_name="faster_hexbytes", + strict_dunder_typing=True, + ) + + setup( - name="hexbytes", + name="faster_hexbytes", # *IMPORTANT*: Don't manually change the version here. See Contributing docs for the release process. - version="1.3.1", - description="""hexbytes: Python `bytes` subclass that decodes hex, with a readable console output""", + version=version, + description="""A faster fork of hexbytes: Python `bytes` subclass that decodes hex, with a readable console output. Implemented in C.""", long_description=long_description, long_description_content_type="text/markdown", author="The Ethereum Foundation", author_email="snakecharmers@ethereum.org", url="https://github.com/ethereum/hexbytes", include_package_data=True, - install_requires=[], - python_requires=">=3.8, <4", + install_requires=[f"hexbytes=={hexbytes_version}", "mypy_extensions"], + python_requires=">=3.9, <4", extras_require=extras_require, - py_modules=["hexbytes"], + py_modules=["faster_hexbytes"], license="MIT", zip_safe=False, keywords="ethereum", - packages=find_packages(exclude=["scripts", "scripts.*", "tests", "tests.*"]), - package_data={"hexbytes": ["py.typed"]}, + packages=find_packages( + exclude=[ + "scripts", + "scripts.*", + "tests", + "tests.*", + "benchmarks", + "benchmarks.*", + ] + ), + ext_modules=ext_modules, + package_data={"faster_hexbytes": ["py.typed"]}, classifiers=[ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", @@ -70,5 +102,6 @@ "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3.14", ], ) diff --git a/tests/core/test_hexbytes.py b/tests/core/test_hexbytes.py index 3da3c39..9a196ea 100644 --- a/tests/core/test_hexbytes.py +++ b/tests/core/test_hexbytes.py @@ -11,7 +11,7 @@ strategies as st, ) -from hexbytes import ( +from faster_hexbytes import ( HexBytes, ) diff --git a/tests/core/test_import_and_version.py b/tests/core/test_import_and_version.py index 6807263..55418fe 100644 --- a/tests/core/test_import_and_version.py +++ b/tests/core/test_import_and_version.py @@ -1,4 +1,4 @@ def test_import_and_version(): - import hexbytes + import faster_hexbytes - assert isinstance(hexbytes.__version__, str) + assert isinstance(faster_hexbytes.__version__, str) diff --git a/tox.ini b/tox.ini index e8fd0a8..0b7521c 100644 --- a/tox.ini +++ b/tox.ini @@ -1,8 +1,8 @@ [tox] envlist= - py{38,39,310,311,312,313}-core - py{38,39,310,311,312,313}-lint - py{38,39,310,311,312,313}-wheel + py{39,310,311,312,313,313t,314,314t}-core + py{39,310,311,312,313,313t,314,314t}-lint + py{39,310,311,312,313,313t,314,314t}-wheel windows-wheel docs @@ -23,25 +23,19 @@ commands= basepython= docs: python windows-wheel: python - py38: python3.8 - py39: python3.9 - py310: python3.10 - py311: python3.11 - py312: python3.12 - py313: python3.13 extras= test docs allowlist_externals=make,pre-commit -[testenv:py{38,39,310,311,312,313}-lint] +[testenv:py{39,310,311,312,313,313t,314,314t}-lint] deps=pre-commit extras=dev commands= pre-commit install pre-commit run --all-files --show-diff-on-failure -[testenv:py{38,39,310,311,312,313}-wheel] +[testenv:py{39,310,311,312,313,313t,314,314t}-wheel] deps= wheel build[virtualenv]