<commit_before>#!/bin/bash -e

cd "$(dirname "$0")"

if [ ! -d ~/env/pillow-perf ]; then
  mkdir -p ~/env
  rm -rf ~/env/pillow-perf
  python3 -m venv ~/env/pillow-perf
  ~/env/pillow-perf/bin/pip install -U pip setuptools wheel
fi

source ~/env/pillow-perf/bin/activate
pip install -r ../testsuite/requirements.txt
pip install opencv-python==4.5.4.58 pgmagick==0.7.6


git clone https://github.com/uploadcare/pillow-simd.git Pillow || true

pushd Pillow

  git fetch

  function pillow_checkout {
    git checkout -f $1
    # Force rebuild
    mkdir -p src && touch ./_imaging.c ./src/_imaging.c
    CFLAGS="$2" python ./setup.py develop > build.log 2>&1
    grep --color=always "error:" build.log && exit || true
    echo "========================="
    echo "Pillow $1 $2"
    echo "========================="
  }

  # Tests with custom memory management:
  # MM $RUN scale filter -n5 "${@:2}"
  function MM {
    LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libjemalloc.so.1 \
    PILLOW_BLOCK_SIZE=128k \
    PILLOW_BLOCKS_MAX=2048 \
    PILLOW_ALIGNMENT=64 \<commit_msg>Updated OpenCV Python to 4.5.4.60<commit_after>#!/bin/bash -e

cd "$(dirname "$0")"

if [ ! -d ~/env/pillow-perf ]; then
  mkdir -p ~/env
  rm -rf ~/env/pillow-perf
  python3 -m venv ~/env/pillow-perf
  ~/env/pillow-perf/bin/pip install -U pip setuptools wheel
fi

source ~/env/pillow-perf/bin/activate
pip install -r ../testsuite/requirements.txt
pip install opencv-python==4.5.4.60 pgmagick==0.7.6


git clone https://github.com/uploadcare/pillow-simd.git Pillow || true

pushd Pillow

  git fetch

  function pillow_checkout {
    git checkout -f $1
    # Force rebuild
    mkdir -p src && touch ./_imaging.c ./src/_imaging.c
    CFLAGS="$2" python ./setup.py develop > build.log 2>&1
    grep --color=always "error:" build.log && exit || true
    echo "========================="
    echo "Pillow $1 $2"
    echo "========================="
  }

  # Tests with custom memory management:
  # MM $RUN scale filter -n5 "${@:2}"
  function MM {
    LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libjemalloc.so.1 \
    PILLOW_BLOCK_SIZE=128k \
    PILLOW_BLOCKS_MAX=2048 \
    PILLOW_ALIGNMENT=64 \
{'fraction_non_alphanumeric': 0.187847866419295, 'fraction_numerical': 0.03200371057513915, 'mean_word_length': 2.9944444444444445, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 3, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2296640', 'n_tokens_mistral': 874, 'n_tokens_neox': 794, 'n_words': 192}