KEMBAR78
[mypyc] Implement str-to-float primitive by TH3CHARLie · Pull Request #9685 · python/mypy · GitHub
Skip to content

Conversation

TH3CHARLie
Copy link
Collaborator

related mypyc/mypyc#644

Implement builtins.float conversion from strings.

@TH3CHARLie
Copy link
Collaborator Author

str-to-float microbenchmark results:

before:

interpreted: 0.890635s (avg of 5 iterations; stdev 0.8%)
compiled:    0.823043s (avg of 5 iterations; stdev 0.9%)

compiled is 1.082x faster

after:

interpreted: 0.894912s (avg of 5 iterations; stdev 4.6%)
compiled:    0.348376s (avg of 5 iterations; stdev 3.1%)

compiled is 2.569x faster

Copy link
Collaborator

@JukkaL JukkaL left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A nice perf win!

Can you also add a test case for this? For example, create mypyc/test-data/run-floats.test, or add to mypyc/test-data/run-misc.test?

@TH3CHARLie
Copy link
Collaborator Author

A nice perf win!

Can you also add a test case for this? For example, create mypyc/test-data/run-floats.test, or add to mypyc/test-data/run-misc.test?

Sure, I'll merge this once the testcase is added and CI gets green

@TH3CHARLie TH3CHARLie merged commit 3ed4747 into python:master Nov 2, 2020
@TH3CHARLie TH3CHARLie deleted the str-to-float branch November 2, 2020 20:40
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.

3 participants