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

Don't write to locals if they are never read #502

Draft
wants to merge 1 commit into
base: trunk
Choose a base branch
from

Conversation

tekknolagi
Copy link
Owner

This is common in code like:

for _ in range(10):
    pass

@github-actions

This comment was marked as outdated.

@tekknolagi tekknolagi changed the title Don't write to _ if it's never read Don't write to locals if they are never read Jun 12, 2023
@github-actions

This comment was marked as outdated.

This is common in code like:

```python
for _ in range(10):
    pass
```

Add tests.
@github-actions

This comment was marked as outdated.

@github-actions
Copy link

{
  "django_minimal_requests": {
    "benchmark": "django_minimal_requests",
    "cg_instructions before": 682020,
    "cg_instructions now": 681925,
    "cg_instructions ∆": "-0.0%",
    "interpreter_args": [],
    "interpreter_name": "pyro",
    "version before": "08f3f441eef002602de86641c443287e0b994711",
    "version now": "258d2f440c6c58686b305463a70a0c9b625ee286"
  }
}

@github-actions
Copy link

Summary

Metric Average Best Worst Notes
cg_instructions 0.1% bench_pickle -0.0% bench_compile 0.8% typically < 0.2% noise
Benchmark details

Base vs. New

benchmark cg_instructions
2to3 0.0%
bench_base64 0.0%
bench_compile 0.8%
bench_pickle -0.0%
deltablue 0.0%
fannkuch 0.0%
go 0.0%
loadproperty 0.0%
nbody 0.0%
nqueens 0.0%
pyflate 0.0%
pystone 0.0%
richards -0.0%

CPython vs New

benchmark cg_instructions
2to3 -10.8%
bench_base64 -40.2%
bench_compile 1084.5%
bench_pickle -27.9%
deltablue -65.2%
fannkuch -3.5%
go -64.6%
loadproperty -75.6%
nbody 20.7%
nqueens 25.5%
pyflate -33.8%
pystone -73.9%
richards -80.1%

Base

benchmark cg_instructions
2to3 2,287,410,091
bench_base64 2,882,265,264
bench_compile 2,905,298,742
bench_pickle 2,985,921,079
deltablue 1,430,181,702
fannkuch 5,397,319,728
go 1,864,219,894
loadproperty 427,273,989
nbody 9,408,436,235
nqueens 2,776,551,355
pyflate 9,583,535,272
pystone 1,038,534,388
richards 957,217,422

New

benchmark cg_instructions
2to3 2,287,440,943
bench_base64 2,882,292,665
bench_compile 2,929,013,664
bench_pickle 2,985,799,872
deltablue 1,430,193,210
fannkuch 5,397,331,793
go 1,864,257,697
loadproperty 427,281,972
nbody 9,408,441,785
nqueens 2,776,557,678
pyflate 9,583,538,906
pystone 1,038,538,054
richards 957,217,161

CPython

benchmark cg_instructions
2to3 2,563,596,659
bench_base64 4,820,239,484
bench_compile 247,275,016
bench_pickle 4,143,888,325
deltablue 4,109,337,945
fannkuch 5,594,144,646
go 5,267,461,726
loadproperty 1,747,769,948
nbody 7,793,857,367
nqueens 2,213,172,338
pyflate 14,468,018,995
pystone 3,981,578,803
richards 4,821,556,013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant