Commit Graph

21798 Commits

Author SHA1 Message Date
klutzy
5118ef6ff0 rt: Remove leading underscore on Win64
Win64 convention does not use underscore.
2013-08-26 22:14:23 +09:00
bors
540d98e7fc auto merge of #8737 : blake2-ppc/rust/std-str-rsplit, r=huonw
Make CharSplitIterator double-ended which is simple given that the operation is symmetric, once the split-N feature is factored out into its own adaptor.

`.rsplitn_iter()` allows splitting `N` times from the back of a string, so it is a completely new feature. With the double-ended impl, `.split_iter()`, `.line_iter()`, `.word_iter()` all allow picking off elements from either end.

`split_options_iter` is removed with the factoring of the split- and split-N- iterators, instead there is `split_terminator_iter`.

---

Add benchmarks using `#[bench]` and tune CharSplitIterator a bit after Huon Wilson's suggestions

Benchmarks 1-5 do the same split using different implementations of `CharEq`, all splitting an ascii string on ascii space. Benchmarks 6-7 split a unicode string on an ascii char.

Before this PR
test str::bench::split_iter_ascii ... bench: 166 ns/iter (+/- 2)
test str::bench::split_iter_closure ... bench: 113 ns/iter (+/- 1)
test str::bench::split_iter_extern_fn ... bench: 286 ns/iter (+/- 7)
test str::bench::split_iter_not_ascii ... bench: 114 ns/iter (+/- 4)
test str::bench::split_iter_slice ... bench: 220 ns/iter (+/- 12)
test str::bench::split_iter_unicode_ascii ... bench: 217 ns/iter (+/- 3)
test str::bench::split_iter_unicode_not_ascii ... bench: 248 ns/iter (+/- 3)

PR, first commit
test str::bench::split_iter_ascii ... bench: 331 ns/iter (+/- 9)
test str::bench::split_iter_closure ... bench: 114 ns/iter (+/- 2)
test str::bench::split_iter_extern_fn ... bench: 314 ns/iter (+/- 6)
test str::bench::split_iter_not_ascii ... bench: 132 ns/iter (+/- 1)
test str::bench::split_iter_slice ... bench: 157 ns/iter (+/- 3)
test str::bench::split_iter_unicode_ascii ... bench: 502 ns/iter (+/- 64)
test str::bench::split_iter_unicode_not_ascii ... bench: 250 ns/iter (+/- 3)

PR, final version
test str::bench::split_iter_ascii ... bench: 106 ns/iter (+/- 4)
test str::bench::split_iter_closure ... bench: 107 ns/iter (+/- 1)
test str::bench::split_iter_extern_fn ... bench: 267 ns/iter (+/- 6)
test str::bench::split_iter_not_ascii ... bench: 108 ns/iter (+/- 1)
test str::bench::split_iter_slice ... bench: 170 ns/iter (+/- 8)
test str::bench::split_iter_unicode_ascii ... bench: 128 ns/iter (+/- 5)
test str::bench::split_iter_unicode_not_ascii ... bench: 252 ns/iter (+/- 3)

---

There are several ways to deal with `CharEq::only_ascii`. It is a performance optimization, so with that in mind, we allow passing bogus char (outside ascii) as long as they don't match. We use a byte value check to make sure we don't split on these (would split substrings in the middle of encoded char).  (A more principled way would be to only pass the ascii codepoints to the CharEq when it indicates only_ascii, but that undoes some of the performance optimization.)
2013-08-26 05:06:16 -07:00
blake2-ppc
4de9bca4d8 std::str: Tune CharSplitIterator after benchmarks
Implement Huon Wilson's suggestions (since the benchmarks agree!).

Use `self.sep.matches(byte as char) && byte < 128u8` to match in the
only_ascii case so that mistaken matches outside the ascii range can't
create invalid substrings.

Put the conditional on only_ascii outside the loop.
2013-08-26 13:30:46 +02:00
Felix S. Klock II
2f82d89b28 Placate make tidy. 2013-08-26 13:27:36 +02:00
gifnksm
f8f17a39ce bigint: fix wrong benchmark fn name 2013-08-26 20:27:20 +09:00
bors
501eea0842 auto merge of #8744 : jld/rust/discr64, r=nikomatsakis
This is in preparation for making discriminants not always be int (#1647), but it also makes compiles for a 64-bit target not behave differently — with respect to how many bits of discriminants are preserved — depending on the build host's word size, which is a nice property to have.

We may want to standardize how to abbreviate "discriminant" in a followup change.
2013-08-26 03:51:19 -07:00
Felix S. Klock II
df6644104e Port typeck/check/vtable.rs from oldvisit to <V:Visitor> trait API. 2013-08-26 11:49:24 +02:00
blake2-ppc
413f868220 std::str: bench tests for .split_iter() 2013-08-26 11:48:48 +02:00
Felix S. Klock II
da88f69f06 Port middle/stack_check.rs from oldvisit to <V:Visitor> trait API. 2013-08-26 11:43:14 +02:00
Felix S. Klock II
6af6b088ad Port middle/moves.rs from oldvisit to <V:Visitor> trait API. 2013-08-26 11:31:21 +02:00
Felix S. Klock II
ec6ab8c899 Remove occurrences of oldvisit text to improve grepping for old oldvisit. 2013-08-26 11:10:18 +02:00
Felix S. Klock II
ebfbbe294e Port creader.rs from oldvisit to <V:Visitor> trait API. 2013-08-26 11:01:39 +02:00
Vadim Chugunov
7f79b52ad9 Un-disabled debug info tests on Windows. 2013-08-26 01:23:18 -07:00
Vadim Chugunov
a903f741b0 Since we assume that GDB output is UTF-8, make sure it is so on all platforms.
Otherwise it'll choose some "appropriate" platform-specific default (e.g. CP1252 on Windows).
2013-08-26 01:23:17 -07:00
bors
bdd188d003 auto merge of #8750 : kballard/rust/str-opt-variant, r=thestinger
Add _opt variants to from_bytes, from_bytes_owned, and from_bytes_slice.
These variants return an Option instead of raising a condition/failing.
2013-08-25 21:36:16 -07:00
bors
24bde7ff5a auto merge of #8751 : brson/rust/metadata-revert, r=brson
This reverts commit 491bc3568c, reversing
changes made to 05f1bbba16.

I've heard reports that this broke something. Don't know details yet.
2013-08-25 20:26:18 -07:00
Brian Anderson
4aa342b868 Revert "auto merge of #8745 : brson/rust/metadata, r=cmr"
This reverts commit 491bc3568c, reversing
changes made to 05f1bbba16.
2013-08-25 20:21:13 -07:00
Kevin Ballard
6f9c68af2e Add _opt variants to str byte-conversion functions
Add _opt variants to from_bytes, from_bytes_owned, and from_bytes_slice.
These variants return an Option instead of raising a condition/failing.
2013-08-25 18:30:31 -07:00
Felix S. Klock II
9d8897ba60 extend file regexp to match files with embedded spaces. 2013-08-26 02:28:27 +02:00
bors
491bc3568c auto merge of #8745 : brson/rust/metadata, r=cmr
This does two things: 1) stops compressing metadata, 2) stops copying the metadata section, instead holding a reference to the buffer returned by the LLVM section iterator.

Not compressing metadata requires something like 7x the storage space, but makes running tests about 9% faster. This has been a time improvement on all platforms I've tested, including windows. I considered leaving compression as an option but it doesn't seem to be worth the complexity since we don't currently have any use cases where we need to save that space.

In order to avoid copying the metadata section I had to hack up extra::ebml a bit to support unsafe buffers. We should probably move it into librustc so that it can evolve to support the compiler without worrying about having a crummy interface.

r? @graydon
2013-08-25 13:36:14 -07:00
bors
05f1bbba16 auto merge of #8723 : anasazi/rust/temporary-unkillable-io, r=brson
Also added a home_for_io_with_sched variant to consolidate some cases.

This is a temporary step to resolving #8674.
2013-08-25 12:26:16 -07:00
gifnksm
084cfc10f5 bigint: Add benchmarks 2013-08-26 00:26:03 +09:00
gifnksm
fc41ba167c bigint: un-ignore test_shr 2013-08-25 23:55:12 +09:00
gifnksm
17c8f8bd0c bigint: inlining small functions 2013-08-25 22:47:24 +09:00
gifnksm
b247d17629 bigint: remove unnecessary method implements 2013-08-25 22:36:55 +09:00
gifnksm
36d698d544 bigint: cfg(target_arch = ...) => cfg(target_word_size = ...) 2013-08-25 22:24:52 +09:00
Felix S. Klock II
fe7092dafb revisions to emacs compilation regexp, more readable and robust. 2013-08-25 14:38:12 +02:00
Felix S. Klock II
521fb049be compilation error regexp specific to rustc.
Fix #6887.
2013-08-25 14:15:03 +02:00
bors
6a649e6b8b auto merge of #8710 : pnkfelix/rust/fsk-issue5516-codepoint-fix, r=alexcrichton
...bytes.

(removing previous note about eff-eye-ex'ing #5516 since it actually does not do so, it just gets us half-way.)
2013-08-25 04:21:15 -07:00
Felix S. Klock II
ca0e7b12aa char_len is more succinct than count_chars. 2013-08-25 13:16:12 +02:00
blake2-ppc
b59d50368e std::str: Double-ended CharSplitIterator
Add new methods `.rsplit_iter()` and `.rsplitn_iter()` for &str.

Separate out CharSplitIterator and CharSplitNIterator,
CharSplitIterator (`split_iter` and `rsplit_iter`) is made double-ended
while `splitn_iter` and `rsplitn_iter` (limited to N splits) are not,
since these don't have the same symmetry.

With CharSplitIterator being double ended, derived iterators like
`line_iter` and `word_iter` are too.
2013-08-25 08:54:47 +02:00
bors
bed84898fc auto merge of #8736 : luqmana/rust/hf, r=yichoi
Fixes #8536.
2013-08-24 22:46:13 -07:00
Brian Anderson
022f188a08 Don't ever compress metadata 2013-08-24 20:57:35 -07:00
bors
da08b0244a auto merge of #8701 : brson/rust/issue-8698, r=thestinger 2013-08-24 20:31:15 -07:00
Jed Davis
0db2b198f2 Add a test case for the preceding changes.
This would have failed on 32-to-64-bit cross-compiles.
2013-08-24 20:16:40 -07:00
Jed Davis
5f536efa9f Don't truncate discriminants to host uint for C_uint's sake. 2013-08-24 20:16:40 -07:00
Jed Davis
8ef8dd9ceb Make enum discriminants u64 instead of the host uint. 2013-08-24 20:16:40 -07:00
bors
a17c7e4f2c auto merge of #8637 : alexcrichton/rust/ifmt-less-hax, r=graydon
Recent improvements to `&mut Trait` have made this work possible, and it solidifies that `ifmt` doesn't always have to return a string, but rather it's based around writers.
2013-08-24 19:21:17 -07:00
bors
f7f1d89649 auto merge of #8607 : sfackler/rust/extensions, r=brson
The method names in std::rt::io::extensions::WriterByteConversions are
the same as those in std::io::WriterUtils and a resolve error causes
rustc to fail after trying to find an impl of io::Writer instead of
trying to look for rt::io::Writer as well.
2013-08-24 18:11:19 -07:00
Alex Crichton
a3e39b9454 Introduce alternate forms of logging
These new macros are all based on format! instead of fmt! and purely exist for
bootstrapping purposes. After the next snapshot, all uses of logging will be
migrated to these macros, and then after the next snapshot after that we can
drop the `2` suffix on everything
2013-08-24 17:07:30 -07:00
bors
8c25b7f0e8 auto merge of #8740 : brson/rust/rt-opt, r=thestinger
See #8599
2013-08-24 16:46:24 -07:00
Daniel Micay
e311a1ee02 Merge pull request #8733 from sfackler/str-to-bytes
Add OwnedStr::into_bytes
2013-08-24 16:41:04 -07:00
Brian Anderson
bbe347cee7 std::rt: Enforce sanity a while longer
I'm not comfortable turning off rtassert! yet
2013-08-24 15:46:04 -07:00
Brian Anderson
2690b51350 std: Make vec::push_all_move call reserve_at_least
vec::unshift uses this to add elements, scheduler queues use unshift,
and this was causing a lot of reallocation
2013-08-24 15:46:04 -07:00
Brian Anderson
44c88ddf42 std::rt: Remove an unnecessary allocation from the main sched loop 2013-08-24 15:46:04 -07:00
Brian Anderson
8fc1d9db21 std: Convert the runtime TLS key to a Rust global to avoid FFI 2013-08-24 15:46:03 -07:00
Brian Anderson
a37bdde3f9 std::rt: Remove metrics for perf
These aren't used for anything at the moment and cause some TLS hits
on some perf-critical code paths. Will need to put better thought into
it in the future.
2013-08-24 15:46:03 -07:00
Brian Anderson
0fff8b6549 std::rt: Reduce MessageQueue contention
It's not a huge win but it does reduce the amount of time spent
contesting the message queue when the schedulers are under load
2013-08-24 15:46:03 -07:00
Brian Anderson
5d04234868 std::rt: Reduce SleeperList contention
This makes the lock much less contended. In the test I'm running the
number of times it's contended goes from ~100000 down to ~1000.
2013-08-24 15:46:03 -07:00
Brian Anderson
5bcb639836 std::rt: Remove extra boxes from MessageQueue and SleeperList 2013-08-24 15:46:03 -07:00