-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[mypyc] Build lists using a primitive op (#10807)
Closes mypyc/mypyc#264 This PR adds a primitive op and a C helper function for building lists. ## Test Plan This change helps reduce the generated code size, however adds some overhead in calling. Microbenchmark tested on master branch: ``` interpreted: 0.000256s (avg of 3582 iterations; stdev 2.2%) compiled: 0.000063s (avg of 3582 iterations; stdev 2.1%) compiled is 4.073x faster ``` On this PR: ``` interpreted: 0.000275s (avg of 3331 iterations; stdev 4.4%) compiled: 0.000083s (avg of 3331 iterations; stdev 4.5%) compiled is 3.321x faster ``` ``` @benchmark def list_build() -> None: n = 0 for i in range(1000): x = ["x", "y", "1", "2", str(i)] n += len(x) assert n == 5000, n ```
- Loading branch information
1 parent
a1863c9
commit 6bb2266
Showing
6 changed files
with
99 additions
and
16 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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