-
Notifications
You must be signed in to change notification settings - Fork 130
Speed Up Worst-Case Overhead #376
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
Merged
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
122049c
Add block-hash cache to speed up more complex block hashing
Theelx 46669f8
Speedups from avoiding re-resolution and threading.get_ident()
Theelx e82688a
Replace Py_HashBytes with Py_ObjectHash
Theelx 8e38eda
Fix test issues
Theelx 75697f3
WIP: optimizations
TTsangSC c138da2
Optimization: store pointer to the `LineTime` obj
TTsangSC b34f8f3
Merge pull request #4 from TTsangSC/test-theelx-opt
Theelx c5f95e2
Test if threading is causing the Windows CI issue
Theelx 468458a
Revert "Test if threading is causing the Windows CI issue"
Theelx 5dce87d
Test whether long bit-length difference on Windows could cause issues
Theelx 10446e0
Test whether Py_hash_t bit-length differences on Windows could cause …
Theelx 86bbded
Test preventing potential truncation by lying about types
Theelx 1b4c083
Revert to some Python types to try to fix Windows tests
Theelx 4c0fc7e
I'm desparate
Theelx 4a5715d
Revert certain changes to see if Windows still works
Theelx 0a2817b
Fix GPT review suggestions 2 and 4
Theelx 7b09279
Add comments for deref and hash_bytecode
Theelx 1dc229b
Implement review suggestions
Theelx 5e35362
add changelog note
Erotemic File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| # cython: language_level=3 | ||
| # cython: legacy_implicit_noexcept=True | ||
| # used in _line_profiler.pyx | ||
| from libcpp.unordered_map cimport unordered_map | ||
| from cython.operator cimport dereference as deref | ||
|
|
||
| # long long int is at least 64 bytes assuming c99 | ||
| ctypedef long long int int64 | ||
|
|
||
| cdef extern from "Python_wrapper.h": | ||
| ctypedef long long PY_LONG_LONG | ||
|
|
||
| cdef struct LastTime: | ||
| int f_lineno | ||
| PY_LONG_LONG time | ||
|
|
||
| cdef struct LineTime: | ||
| long long code | ||
| int lineno | ||
| PY_LONG_LONG total_time | ||
| long nhits | ||
|
|
||
| # Types used for mappings from code hash to last/line times. | ||
| ctypedef unordered_map[int64, LastTime] LastTimeMap | ||
| ctypedef unordered_map[int64, LineTime] LineTimeMap | ||
|
|
||
| cdef inline void last_erase_if_present(LastTimeMap* m, int64 key) noexcept: | ||
| cdef LastTimeMap.iterator it = deref(m).find(key) | ||
| if it != deref(m).end(): | ||
| deref(m).erase(it) | ||
|
|
||
| cdef inline LineTime* line_ensure_entry(LineTimeMap* m, int lineno, long long code_hash) noexcept: | ||
| if not deref(m).count(lineno): | ||
| deref(m)[lineno] = LineTime(code_hash, lineno, 0, 0) | ||
| return &(deref(m)[lineno]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.