Skip to content

bpo-29736: Optimize builtin types constructor #519

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

Closed
wants to merge 1 commit into from
Closed

bpo-29736: Optimize builtin types constructor #519

wants to merge 1 commit into from

Conversation

vstinner
Copy link
Member

@vstinner vstinner commented Mar 6, 2017

Replace PyArg_ParseTupleAndKeywords() with
_PyArg_ParseTupleAndKeywordsFast() to optimize the constructor of the
builtin types:

  • bool: bool_new()
  • bytes: bytes_new()
  • complex: complex_new()
  • float: float_new()
  • int: long_new()
  • list: list_init()
  • str: unicode_new()
  • tuple: tuple_new()

http://bugs.python.org/issue29736

Replace PyArg_ParseTupleAndKeywords() with
_PyArg_ParseTupleAndKeywordsFast() to optimize the constructor of the
builtin types:

* bool: bool_new()
* bytes: bytes_new()
* complex: complex_new()
* float: float_new()
* int: long_new()
* list: list_init()
* str: unicode_new()
* tuple: tuple_new()
@vstinner vstinner added the performance Performance or resource usage label Mar 6, 2017
@rhettinger
Copy link
Contributor

I don't really like moving the parse string outside of the call to the parser. We have a long history of keeping these together. To me it like having a printf_fast(&formatter, a, b, c); The format and the arguments are tightly coupled, so separating them makes the code harder to work with. This isn't just optimization, it is design of a new C-API that is very different from what came before.

@vstinner
Copy link
Member Author

This old PR now has many conflicts and I lost interest in this PR, so I close it.

@vstinner vstinner closed this Aug 10, 2017
@vstinner vstinner deleted the long_new branch August 10, 2017 23:36
jaraco pushed a commit that referenced this pull request Dec 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance Performance or resource usage
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants