Skip to content

Commit a3fe49c

Browse files
authored
Drop cold-start sample from import-time profiling (#4552)
1 parent 4e86fbc commit a3fe49c

15 files changed

Lines changed: 34 additions & 22 deletions

.github/scripts/import_test.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,19 @@
2323
exceptions = []
2424

2525
for import_statement in import_statement_list:
26+
# Warm-up subprocess. Discarded from the timing data because the first
27+
# `python -c "import X"` after a fresh install pays cold-start cost
28+
# (filesystem cache priming, DLL loading, antivirus scanning a new
29+
# package) that has nothing to do with spikeinterface's actual import
30+
# weight. On Windows this can be 10x+ the steady-state and dominate
31+
# the average.
32+
warmup_script = (
33+
f"import timeit \n"
34+
f"import_statement = '{import_statement}' \n"
35+
f"timeit.timeit(import_statement, number=1) \n"
36+
)
37+
subprocess.run(["python", "-c", warmup_script], capture_output=True, text=True)
38+
2639
time_taken_list = []
2740
for _ in range(n_samples):
2841
script_to_execute = (
@@ -45,8 +58,7 @@
4558
time_taken_list.append(time_taken)
4659

4760
for time in time_taken_list:
48-
# TODO: lower this back toward 3.0 s once the Windows runner outliers are diagnosed.
49-
import_time_threshold = 6.0
61+
import_time_threshold = 3.0
5062
if time >= import_time_threshold:
5163
exceptions.append(
5264
f"Importing {import_statement} took: {time:.2f} s. Should be <: {import_time_threshold} s."

.github/workflows/all-tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
python-version: ["3.10", "3.13"] # Lower and higher versions we support
2828
os: [macos-latest, windows-latest, ubuntu-latest]
2929
steps:
30-
- uses: actions/checkout@v4
30+
- uses: actions/checkout@v5
3131
- name: Setup Python ${{ matrix.python-version }}
3232
uses: actions/setup-python@v6
3333
with:
@@ -111,7 +111,7 @@ jobs:
111111
- name: Cache datasets
112112
if: env.RUN_EXTRACTORS_TESTS == 'true' || env.RUN_PREPROCESSING_TESTS == 'true'
113113
id: cache-datasets
114-
uses: actions/cache/restore@v4
114+
uses: actions/cache/restore@v5
115115
with:
116116
path: ~/spikeinterface_datasets
117117
key: ${{ runner.os }}-datasets-${{ steps.repo_hash.outputs.dataset_hash }}

.github/workflows/build-docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
run:
1010
shell: bash -el {0}
1111
steps:
12-
- uses: actions/checkout@v2
12+
- uses: actions/checkout@v5
1313
- uses: conda-incubator/setup-miniconda@v2
1414
with:
1515
environment-file: environment_rtd.yml

.github/workflows/caches_cron_job.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
echo "dataset_hash=$(git ls-remote https://gin.g-node.org/NeuralEnsemble/ephy_testing_data.git HEAD | cut -f1)"
3636
echo "dataset_hash=$(git ls-remote https://gin.g-node.org/NeuralEnsemble/ephy_testing_data.git HEAD | cut -f1)" >> $GITHUB_OUTPUT
3737
shell: bash
38-
- uses: actions/cache@v4
38+
- uses: actions/cache@v5
3939
id: cache-datasets
4040
with:
4141
path: ~/spikeinterface_datasets

.github/workflows/core-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
matrix:
2020
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
2121
steps:
22-
- uses: actions/checkout@v4
22+
- uses: actions/checkout@v5
2323
- uses: actions/setup-python@v6
2424
with:
2525
python-version: '3.11'

.github/workflows/deepinterpolation.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
matrix:
2020
os: ["ubuntu-latest"]
2121
steps:
22-
- uses: actions/checkout@v4
22+
- uses: actions/checkout@v5
2323
- uses: actions/setup-python@v6
2424
with:
2525
python-version: '3.10'

.github/workflows/full-test-with-codecov.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
# "macos-latest", "windows-latest"
2020
os: ["ubuntu-latest", ]
2121
steps:
22-
- uses: actions/checkout@v4
22+
- uses: actions/checkout@v5
2323
- uses: actions/setup-python@v6
2424
with:
2525
python-version: '3.12'
@@ -42,7 +42,7 @@ jobs:
4242
run: |
4343
echo "HASH_EPHY_DATASET=$(git ls-remote https://gin.g-node.org/NeuralEnsemble/ephy_testing_data.git HEAD | cut -f1)" >> $GITHUB_OUTPUT
4444
- name: Restore cached gin data for extractors tests
45-
uses: actions/cache/restore@v4
45+
uses: actions/cache/restore@v5
4646
id: cache-datasets
4747
env:
4848
# the key depends on the last comit repo https://gin.g-node.org/NeuralEnsemble/ephy_testing_data.git
@@ -64,7 +64,7 @@ jobs:
6464
python ./.github/scripts/build_job_summary.py report_full.txt >> $GITHUB_STEP_SUMMARY
6565
cat $GITHUB_STEP_SUMMARY
6666
rm report_full.txt
67-
- uses: codecov/codecov-action@v4
67+
- uses: codecov/codecov-action@v5
6868
with:
6969
token: ${{ secrets.CODECOV_TOKEN }}
7070
fail_ci_if_error: true

.github/workflows/installation-tips-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
- os: macos-latest
1818
- os: windows-latest
1919
steps:
20-
- uses: actions/checkout@v4
20+
- uses: actions/checkout@v5
2121
- uses: actions/setup-python@v6
2222
with:
2323
python-version: '3.12'

.github/workflows/issue-on-change-matlab.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
changed_files: ${{ steps.changed-files.outputs.all_changed_files }}
1616
steps:
1717
- name: Checkout
18-
uses: actions/checkout@v4
18+
uses: actions/checkout@v5
1919
- name: Get changed files
2020
id: changed-files
2121
uses: tj-actions/changed-files@v46.0.1
@@ -32,7 +32,7 @@ jobs:
3232
issues: write
3333
steps:
3434
- name: Checkout
35-
uses: actions/checkout@v4
35+
uses: actions/checkout@v5
3636
- name: Parse files names
3737
id: parse-files-names
3838
run: |

.github/workflows/publish-to-pypi.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
runs-on: ubuntu-latest
1212

1313
steps:
14-
- uses: actions/checkout@v4
14+
- uses: actions/checkout@v5
1515
- name: Set up Python
1616
uses: actions/setup-python@v6
1717
with:

0 commit comments

Comments
 (0)