Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Further overhead reductions #203

Open
wants to merge 21 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 46 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ jobs:
steps:
- name: Checkout source
uses: actions/checkout@v3
with:
submodules: recursive
- name: Set up Python 3.8
uses: actions/[email protected]
with:
Expand All @@ -27,18 +29,23 @@ jobs:
- name: Lint with flake8
run: |-
# stop the build if there are Python syntax errors or undefined names
flake8 ./line_profiler --count --select=E9,F63,F7,F82 --show-source --statistics
flake8 ./line_profiler --count --select=E9,F63,F7,F82 --show-source --statistics --exclude=*parallel_hashmap*,.svn,CVS,.bzr,.hg,.git,__pycache__,.tox
- name: Make mypy cache
run: |-
mkdir .mypy_cache
- name: Typecheck with mypy
run: |-
python -m pip install mypy
mypy --install-types --non-interactive ./line_profiler
mypy ./line_profiler
mypy --install-types --non-interactive --cache-dir=.mypy_cache/ --exclude ./line_profiler/parallel_hashmap/ ./line_profiler
mypy --exclude ./line_profiler/parallel_hashmap/ ./line_profiler
build_and_test_sdist:
name: Test sdist Python 3.8
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v3
with:
submodules: recursive
- name: Set up Python 3.8
uses: actions/[email protected]
with:
Expand Down Expand Up @@ -101,7 +108,6 @@ jobs:
os:
- windows-latest
- ubuntu-latest
- macOS-latest
cibw_skip:
- '*-win32'
arch:
Expand All @@ -113,6 +119,8 @@ jobs:
steps:
- name: Checkout source
uses: actions/checkout@v3
with:
submodules: recursive
- name: Enable MSVC 64bit
uses: ilammy/msvc-dev-cmd@v1
if: matrix.os == 'windows-latest' && matrix.cibw_skip == '*-win32'
Expand Down Expand Up @@ -166,6 +174,36 @@ jobs:
with:
name: wheels
path: ./wheelhouse/line_profiler*.whl
build_and_test_binpy_wheels_macos:
name: ${{ matrix.os }}, arch=${{ matrix.arch }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- macOS-latest
arch:
- AMD64
steps:
- name: Checkout source
uses: actions/checkout@v3
with:
submodules: recursive
- name: Build binary wheels
uses: pypa/[email protected]
with:
output-dir: wheelhouse
config-file: pyproject.toml
env:
CIBW_SKIP: ${{ matrix.cibw_skip }}
CIBW_ARCHS_LINUX: ${{ matrix.arch }}
- name: Show built files
shell: bash
run: ls -la wheelhouse
- uses: actions/upload-artifact@v3
name: Upload wheels artifact
with:
name: wheels
path: ./wheelhouse/line_profiler*.whl
test_deploy:
name: Uploading Test to PyPi
runs-on: ubuntu-latest
Expand All @@ -176,6 +214,8 @@ jobs:
steps:
- name: Checkout source
uses: actions/checkout@v3
with:
submodules: recursive
- uses: actions/download-artifact@v3
name: Download wheels and sdist
with:
Expand Down Expand Up @@ -218,6 +258,8 @@ jobs:
steps:
- name: Checkout source
uses: actions/checkout@v3
with:
submodules: recursive
- uses: actions/download-artifact@v3
name: Download wheels and sdist
with:
Expand Down
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,17 @@
*.o
*.a
*.cpp
!timers.cpp
!unset_trace.cpp

# ignore benchmarking scripts
*_benchmarks.py
*.lprof
profile*.svg
# ignore annotated cython
*.html
# ignore pyenv
.python-version

build/
dist/
Expand Down
9 changes: 9 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[submodule "line_profiler/parallel_hashmap"]
path = line_profiler/parallel_hashmap
url = https://github.com/greg7mdp/parallel-hashmap.git
[submodule "line_profiler/preshed"]
path = line_profiler/preshed
url = https://github.com/explosion/preshed.git
[submodule "line_profiler/cymem"]
path = line_profiler/cymem
url = https://github.com/explosion/cymem.git
5 changes: 5 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Changes
=======

4.1.0
~~~~~
* ENH: Lowered overhead from line_profiler code when profiling by 33-67% by using different data structures. You should expect to see a worst-case overhead of ~10x, and an average-case overhead of 1.5x-2x with kernprof enabled.
* ENH: Cython 3.0.0b1 is now supported for building.

4.0.2
~~~~~
* FIX: AttributeError on certain methods. #191
Expand Down
2 changes: 1 addition & 1 deletion kernprof.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

# NOTE: This version needs to be manually maintained with the line_profiler
# __version__ for now.
__version__ = '4.0.2'
__version__ = '4.1.0'

# Guard the import of cProfile such that 3.x people
# without lsprof can still use this script.
Expand Down
Loading