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

Update __init__.py #58

Merged
merged 1 commit into from
Sep 13, 2024
Merged

Update __init__.py #58

merged 1 commit into from
Sep 13, 2024

Conversation

mixmastamyk
Copy link
Contributor

Removes the generator.

Self is already iterable so an additional generator is overhead. I think this may have been useful at some point because other data types may have been allowed? (Which would need to be converted to string before join.)

However, _iter_node_context() currently prevents this. Unexpected data types result in a ValueError (which probably should be a TypeError, now that I think of it), everything else is ultimately converted to string.

I get around a 2% speedup from your benchmark script with the generator removed. Not a huge difference but better than a poke in the eye.

Remove duplicate generator.
@pelme
Copy link
Owner

pelme commented Sep 13, 2024

Good catch, thanks for fixing this! It is probably a left over since before.

@pelme pelme merged commit b7b0b15 into pelme:main Sep 13, 2024
13 checks passed
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