8000 Preallocate strings in a smarter way + add str.rmul by Jongy · Pull Request #913 · RustPython/RustPython · GitHub
[go: up one dir, main page]

Skip to content

Preallocate strings in a smarter way + add str.rmul #913

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 4 commits into from
May 7, 2019

Conversation

Jongy
Copy link
Contributor
@Jongy Jongy commented May 3, 2019

No description provided.

@@ -193,6 +198,11 @@ impl PyString {
}
}

#[pymethod(name = "__rmul__")]
fn rmul(&self, val: PyObjectRef, vm: &VirtualMachine) -> PyResult<String> {
self.mul(val, vm)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Downside with this simple impl is that the raised TypeError shows the values swapped (As per the order of __mul__, not __rmul__).

On the other hand, the shown message (still?) doesn't match the one given by CPython, so we can be less pedantic about it.

@Jongy Jongy force-pushed the str-preallocate-and-rmul branch from b54e108 to 857a701 Compare May 3, 2019 12:21
@codecov-io
Copy link

Codecov Report

Merging #913 into master will increase coverage by 0.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #913      +/-   ##
==========================================
+ Coverage   64.04%   64.06%   +0.01%     
==========================================
  Files          89       89              
  Lines       14976    14982       +6     
  Branches     3341     3342       +1     
==========================================
+ Hits         9592     9598       +6     
  Misses       3178     3178              
  Partials     2206     2206
Impacted Files Coverage Δ
vm/src/obj/objstr.rs 74.63% <100%> (+0.24%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1d6e8d5...857a701. Read the comment docs.

@windelbouwman windelbouwman merged commit 6f31cf7 into RustPython:master May 7, 2019
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
0