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

More inlining possibilities #277

Merged
merged 2 commits into from Jul 13, 2016
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Next

Preallocate a string upfront when converting from latin1.

  • Loading branch information
jdm committed Jul 13, 2016
commit 66154256c0d7115f32a255f01e584edcf77878aa
@@ -409,7 +409,9 @@ pub unsafe fn latin1_to_string(cx: *mut JSContext, s: *mut JSString) -> String {
assert!(!chars.is_null());

let chars = slice::from_raw_parts(chars, length as usize);
chars.iter().map(|&c| c as char).collect()
let mut s = String::with_capacity(length as usize);
s.extend(chars.iter().map(|&c| c as char));
s
}

// https://heycam.github.io/webidl/#es-USVString
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.