Skip to content

Commit

Permalink
ci: 🎡 update macos runners (#160)
Browse files Browse the repository at this point in the history
  • Loading branch information
darvid committed Oct 10, 2024
1 parent 684b308 commit e018db9
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 16 deletions.
27 changes: 11 additions & 16 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ jobs:
platform_id: musllinux_x86_64
- os: ubicloud-standard-2-arm
platform_id: manylinux_aarch64
- os: macos-12-xl
- os: macos-15-large
platform_id: macosx_x86_64
- os: flyci-macos-large-latest-m1
- os: macos-15
platform_id: macosx_arm64

steps:
Expand Down Expand Up @@ -192,46 +192,41 @@ jobs:
platform_id: musllinux_aarch64

# 🍎 macOS x86_64
- os: macos-12-xl
- os: macos-15-large
python: "3.9"
python_id: cp39
platform_id: macosx_x86_64
- os: macos-12-xl
- os: macos-15-large
python: "3.10"
python_id: cp310
platform_id: macosx_x86_64
- os: macos-12-xl
- os: macos-15-large
python: "3.11"
python_id: cp311
platform_id: macosx_x86_64
- os: macos-12-xl
- os: macos-15-large
python: "3.12"
python_id: cp312
platform_id: macosx_x86_64
- os: macos-12-xl
- os: macos-15-large
python: "3.13"
python_id: cp313
platform_id: macosx_x86_64

# 🍎 macOS arm64 (Apple silicon)
# XXX: ☠️ https://github.com/actions/setup-python/issues/696
# - os: flyci-macos-large-latest-m1
# python: "3.9"
# python_id: cp39
# platform_id: macosx_arm64
- os: flyci-macos-large-latest-m1
- os: macos-15
python: "3.10"
python_id: cp310
platform_id: macosx_arm64
- os: flyci-macos-large-latest-m1
- os: macos-15
python: "3.11"
python_id: cp311
platform_id: macosx_arm64
- os: flyci-macos-large-latest-m1
- os: macos-15
python: "3.12"
python_id: cp312
platform_id: macosx_arm64
- os: flyci-macos-large-latest-m1
- os: macos-15
python: "3.13"
python_id: cp313
platform_id: macosx_arm64
Expand Down
2 changes: 2 additions & 0 deletions .mise.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[tools]
python = "3.13.0"
18 changes: 18 additions & 0 deletions .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**",
"/usr/include/python3.10",
"/usr/include/hs"
],
"defines": [],
"compilerPath": "/usr/bin/gcc",
"cStandard": "c17",
"cppStandard": "gnu++17",
"intelliSenseMode": "linux-gcc-x64"
}
],
"version": 4
}
55 changes: 55 additions & 0 deletions tools/test_memory.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#!/usr/bin/env python
import os
import tracemalloc
from typing import Any, Callable, Generator

import psutil
from rich.progress import track

import hyperscan

db = hyperscan.Database(mode=hyperscan.HS_MODE_BLOCK)


def profile_mem(
target: Callable[..., Any],
iterations=100_000,
sample_interval=10_000,
) -> Generator[int, None, None]:
for i in range(iterations):
target()
if i % sample_interval == 0:
process = psutil.Process()
yield process.memory_info().rss


def main() -> None:
tracemalloc.start()
os.getpid()

db = hyperscan.Database(mode=hyperscan.HS_MODE_BLOCK)

def compile():
db.compile(
expressions=[b'test'],
ids=[1],
flags=[hyperscan.HS_FLAG_ALLOWEMPTY],
)

def dump():
compile()
hyperscan.dumpb(db)

for callback in (dump,):
for i, step in enumerate(
track(
profile_mem(callback),
description=f"📊 Profiling {callback.__name__}...",
total=10,
)
):
...


if __name__ == "__main__":
main()
4 changes: 4 additions & 0 deletions tools/test_memory.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
mprof rm 0 2>/dev/null
mprof run python test_memory.py
mprof plot >/dev/null 2>&1

0 comments on commit e018db9

Please sign in to comment.