8000 PERF: Statically allocate unicode strings of memhandler by eendebakpt · Pull Request #21450 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

PERF: Statically allocate unicode strings of memhandler #21450

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 2 commits into from
May 5, 2022

Conversation

eendebakpt
Copy link
Contributor

The current_allocator string was converted to unicode in the loop with a numpy scalar. This PR statically converts it to unicode (similar to #21423)

@seberg Are you aware of any more conversions to be statically handled?

There are more unicode conversions in npy_parse_arguments, but they are harder to replace since there is some preprocessing before the conversion to unicode.

@seberg
Copy link
Member
seberg commented May 5, 2022

No, I can't think of anything immediately, but that just means I didn't stumble accross something very recently ;).
npy_parse_arguments is carefully crafted to intern all of those on the first call. So only the first call is slow, after that it is extremely fast, so it should be fine.

This looks good otherwise, thanks. Just waiting for CI (and that small fixup).

Co-authored-by: Sebastian Berg <sebastian@sipsolutions.net>
@seberg
Copy link
Member
seberg commented May 5, 2022

Unrelated to this, but the ComprehensiveTests Windows Python39-32bit-fast died with:

........................................................................ [ 18%]
Windows fatal exception: access violation

Current thread 0x000018b0 (most recent call first):
  File "C:\hostedtoolcache\windows\Python\3.9.12\x86\lib\site-packages\numpy\core\tests\test_multiarray.py", line 6635 in test_vector_matrix_values
  File "C:\hostedtoolcache\windows\Python\3.9.12\x86\lib\site-packages\_pytest\python.py", line 183 in pytest_pyfunc_call

not sure we had this recently.

@seberg seberg changed the title PERF Statically allocate unicode strings PERF: Statically allocate unicode strings of memhandler May 5, 2022
@seberg seberg merged commit 06f6cc2 into numpy:main May 5, 2022
@seberg
Copy link
Member
seberg commented May 5, 2022

Thanks @eendebakpt!

@eendebakpt eendebakpt deleted the static_unicode branch May 12, 2022 08:42
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.

2 participants
0