Skip to content

Commit a1da846

Browse files
committed
---
yaml --- r: 165484 b: refs/heads/master c: e40a81b h: refs/heads/master v: v3
1 parent 224248b commit a1da846

File tree

2 files changed

+1
-41
lines changed

2 files changed

+1
-41
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: cc33ce6fd07467bca1006823ae7336e84054726c
2+
refs/heads/master: e40a81b37bf11ae6f7fc3294ac17230eabaaab03
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 658529467d9d69ac9e09cacf98a6d61d781c2c76
55
refs/heads/try: aee614fc4973262a5a68efc643026e2b1458d65b

trunk/src/libcollections/string.rs

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -512,24 +512,6 @@ impl String {
512512
#[inline]
513513
#[stable = "function just renamed from push_char"]
514514
pub fn push(&mut self, ch: char) {
515-
let cur_len = self.len();
516-
// This may use up to 4 bytes.
517-
self.vec.reserve(4);
518-
519-
unsafe {
520-
// Attempt to not use an intermediate buffer by just pushing bytes
521-
// directly onto this string.
522-
let slice = RawSlice {
523-
data: self.vec.as_ptr().offset(cur_len as int),
524-
len: 4,
525-
};
526-
let used = ch.encode_utf8(mem::transmute(slice)).unwrap_or(0);
527-
self.vec.set_len(cur_len + used);
528-
}
529-
}
530-
531-
#[inline]
532-
fn push_with_ascii_fast_path(&mut self, ch: char) {
533515
if (ch as u32) < 0x80 {
534516
self.vec.push(ch as u8);
535517
return;
@@ -1455,17 +1437,6 @@ mod tests {
14551437
});
14561438
}
14571439

1458-
#[bench]
1459-
fn bench_push_char_one_byte_with_fast_path(b: &mut Bencher) {
1460-
b.bytes = REPETITIONS;
1461-
b.iter(|| {
1462-
let mut r = String::new();
1463-
for _ in range(0, REPETITIONS) {
1464-
r.push_with_ascii_fast_path('a')
1465-
}
1466-
});
1467-
}
1468-
14691440
#[bench]
14701441
fn bench_push_char_two_bytes(b: &mut Bencher) {
14711442
b.bytes = REPETITIONS * 2;
@@ -1477,17 +1448,6 @@ mod tests {
14771448
});
14781449
}
14791450

1480-
#[bench]
1481-
fn bench_push_char_two_bytes_with_slow_path(b: &mut Bencher) {
1482-
b.bytes = REPETITIONS * 2;
1483-
b.iter(|| {
1484-
let mut r = String::new();
1485-
for _ in range(0, REPETITIONS) {
1486-
r.push_with_ascii_fast_path('â')
1487-
}
1488-
});
1489-
}
1490-
14911451
#[bench]
14921452
fn from_utf8_lossy_100_ascii(b: &mut Bencher) {
14931453
let s = b"Hello there, the quick brown fox jumped over the lazy dog! \

0 commit comments

Comments
 (0)