rust/src
bors fc2373c5a2 Auto merge of #37888 - bluss:chars-count, r=alexcrichton
Improve .chars().count()

Use a simpler loop to count the `char` of a string: count the
number of non-continuation bytes. Use `count += <conditional>` which the
compiler understands well and can apply loop optimizations to.

benchmark descriptions and results for two configurations:

- ascii: ascii text
- cy: cyrillic text
- jp: japanese text
- words ascii: counting each split_whitespace item from the ascii text
- words jp: counting each split_whitespace item from the jp text

```
x86-64 rustc -Copt-level=3
 name               orig_ ns/iter      cmov_ ns/iter      diff ns/iter   diff %
 count_ascii        1,453 (1755 MB/s)  1,398 (1824 MB/s)           -55   -3.79%
 count_cy           5,990 (856 MB/s)   2,545 (2016 MB/s)        -3,445  -57.51%
 count_jp           3,075 (1169 MB/s)  1,772 (2029 MB/s)        -1,303  -42.37%
 count_words_ascii  4,157 (521 MB/s)   1,797 (1205 MB/s)        -2,360  -56.77%
 count_words_jp     3,337 (1071 MB/s)  1,772 (2018 MB/s)        -1,565  -46.90%

x86-64 rustc -Ctarget-feature=+avx -Copt-level=3
 name               orig_ ns/iter      cmov_ ns/iter      diff ns/iter   diff %
 count_ascii        1,444 (1766 MB/s)  763 (3343 MB/s)            -681  -47.16%
 count_cy           5,871 (874 MB/s)   1,527 (3360 MB/s)        -4,344  -73.99%
 count_jp           2,874 (1251 MB/s)  1,073 (3351 MB/s)        -1,801  -62.67%
 count_words_ascii  4,131 (524 MB/s)   1,871 (1157 MB/s)        -2,260  -54.71%
 count_words_jp     3,253 (1099 MB/s)  1,331 (2686 MB/s)        -1,922  -59.08%
```

I briefly explored a more involved blocked algorithm (looking at 8 or more bytes at a time),
but the code in this PR was always winning `count_words_ascii` in particular (counting
many small strings); this solution is an improvement without tradeoffs.
2016-11-20 17:06:53 -06:00
..
bootstrap Auto merge of #37822 - cuviper:llvm-link-shared, r=alexcrichton 2016-11-19 08:08:26 -08:00
build_helper run rustfmt on various folders 2016-10-16 15:41:01 +05:30
ci Move all Linux/OSX CI infastructure to Travis 2016-11-11 07:36:40 -08:00
compiler-rt@3bc0272cab std: Update compiler-rt for more ABI fixes 2016-11-10 09:23:29 -08:00
doc Rollup merge of #37876 - birkenfeld:patch-1, r=apasel422 2016-11-20 15:00:05 +01:00
driver
etc Fix fmt::Debug for strings, e.g. for Chinese characters 2016-11-18 14:45:59 +01:00
grammar Fix grammar verification 2016-11-16 22:42:07 +01:00
jemalloc@e058ca6616
liballoc [breaking-change] change the box_free item to accept pointers to unsized types 2016-11-11 13:36:10 +01:00
liballoc_jemalloc Add Fuchsia support 2016-10-22 07:08:06 -07:00
liballoc_system Print out the error when HeapFree failures do occur 2016-10-25 10:00:16 -04:00
libarena Auto merge of #37270 - Mark-Simulacrum:smallvec-optimized-arenas, r=eddyb 2016-10-26 03:47:55 -07:00
libbacktrace
libcollections vec: Use less code bloat specialized Vec::from_iter 2016-11-13 01:30:42 +01:00
libcollectionstest Auto merge of #37888 - bluss:chars-count, r=alexcrichton 2016-11-20 17:06:53 -06:00
libcompiler_builtins rustc: Flag all builtins functions as hidden 2016-11-12 10:46:15 -08:00
libcore Auto merge of #37888 - bluss:chars-count, r=alexcrichton 2016-11-20 17:06:53 -06:00
libcoretest Fix fmt::Debug for strings, e.g. for Chinese characters 2016-11-18 14:45:59 +01:00
libflate Use fast decompression in deflate_bytes. 2016-10-20 15:08:01 +11:00
libfmt_macros On fmt string with unescaped { note how to escape 2016-11-11 10:53:02 -08:00
libgetopts Changed most vec! invocations to use square braces 2016-10-31 22:51:40 +00:00
libgraphviz Changed most vec! invocations to use square braces 2016-10-31 22:51:40 +00:00
liblibc@6e8c1b490c rustc: Implement #[link(cfg(..))] and crt-static 2016-11-16 07:00:09 -08:00
liblog run rustfmt on liblog 2016-10-12 23:45:03 +05:30
libpanic_abort rustc_typeck: correctly track "always-diverges" and "has-type-errors". 2016-11-10 01:44:53 +02:00
libpanic_unwind Remove mention of mipsel target_arch 2016-11-07 14:15:58 +08:00
libproc_macro Allow proc_macro functions to whitelist specific attributes 2016-11-08 23:03:56 +10:30
libproc_macro_plugin Split up libproc_macro_plugin 2016-10-28 12:17:17 +13:00
libproc_macro_tokens proc_macro_plugin: Wrap nonexistent filename in <> 2016-11-09 14:55:39 +01:00
librand Changed most vec! invocations to use square braces 2016-10-31 22:51:40 +00:00
librustc Auto merge of #37660 - nikomatsakis:incremental-36349, r=eddyb 2016-11-17 17:31:01 -08:00
librustc_back rustc: Implement #[link(cfg(..))] and crt-static 2016-11-16 07:00:09 -08:00
librustc_bitflags std: Stabilize and deprecate APIs for 1.13 2016-10-03 10:34:34 -07:00
librustc_borrowck refactor Visitor into ItemLikeVisitor and intravisit::Visitor 2016-11-16 13:51:36 -05:00
librustc_const_eval Auto merge of #37660 - nikomatsakis:incremental-36349, r=eddyb 2016-11-17 17:31:01 -08:00
librustc_const_math Stabilise ? 2016-10-12 08:40:22 +13:00
librustc_data_structures Don't clone in UnificationTable::probe(). 2016-11-18 14:26:22 +11:00
librustc_driver Auto merge of #37826 - keeperofdakeys:proc-macro-test, r=alexcrichton 2016-11-19 13:28:50 -06:00
librustc_errors Merge branch 'new-rustbuild' into rollup 2016-11-05 10:50:26 -07:00
librustc_incremental Add span to warning about incr. comp. vs Token::Interpolated. 2016-11-18 16:45:59 -05:00
librustc_lint include a Name and Span for each item in the HIR of the impl 2016-11-16 13:57:47 -05:00
librustc_llvm Auto merge of #37831 - rkruppe:llvm-attr-fwdcompat, r=eddyb 2016-11-19 16:39:25 -06:00
librustc_metadata Auto merge of #37846 - jseyfried:fix_proc_macro_dep, r=alexcrichton 2016-11-17 20:56:03 -08:00
librustc_mir Auto merge of #37660 - nikomatsakis:incremental-36349, r=eddyb 2016-11-17 17:31:01 -08:00
librustc_passes add a nested_visit_map method 2016-11-16 13:57:47 -05:00
librustc_platform_intrinsics
librustc_plugin fallout from separating impl-items from impls 2016-11-16 13:57:43 -05:00
librustc_privacy include a Name and Span for each item in the HIR of the impl 2016-11-16 13:57:47 -05:00
librustc_resolve Cleanup formatting. 2016-11-17 08:16:32 +00:00
librustc_save_analysis Auto merge of #37776 - nrc:save-double-angle, r=@brson 2016-11-18 11:45:53 -08:00
librustc_trans Auto merge of #37862 - shepmaster:llvm-4.0-always-set-eh-personality, r=eddyb 2016-11-20 13:50:47 -06:00
librustc_typeck Rollup merge of #37835 - ojsheikh:E0088, r=jonathandturner 2016-11-20 15:00:04 +01:00
librustc_unicode std: Correct stability attributes for some implementations 2016-10-01 23:58:14 +01:00
librustdoc Rollup merge of #37881 - ollie27:rustdoc_stab_enum_macro, r=alexcrichton 2016-11-20 15:00:05 +01:00
libserialize Changed most vec! invocations to use square braces 2016-10-31 22:51:40 +00:00
libstd Rollup merge of #37880 - GuillaumeGomez:socket-4-doc, r=frewsxcv 2016-11-20 15:00:05 +01:00
libsyntax Auto merge of #37749 - keeperofdakeys:should-panic, r=alexcrichton 2016-11-18 08:24:00 -08:00
libsyntax_ext Show a better error when using --test with #[proc_macro_derive] 2016-11-17 22:06:36 +10:30
libsyntax_pos Group unused import warnings per path list 2016-11-08 17:44:21 -08:00
libterm Fix terminfo database search path 2016-11-06 18:20:38 +01:00
libtest Warn when a #[should_panic] test has an unexpected message 2016-11-18 21:01:19 +10:30
libunwind Add Fuchsia support 2016-10-22 07:08:06 -07:00
llvm@c1d962263b LLVM: Update submodule to rust-llvm-2016-10-29 branch. 2016-10-29 18:56:20 +03:00
rt
rtstartup Rename static mut to upper case 2016-10-14 17:21:11 +03:00
rust-installer@4f99485080 Update rust-installer. Fixes #36451 2016-10-05 00:17:30 +00:00
rustc Use workspaces and switch to a single Cargo.lock. 2016-10-07 12:04:32 -07:00
rustllvm Auto merge of #37861 - shepmaster:llvm-4.0-inline-pass, r=alexcrichton 2016-11-20 07:26:03 -06:00
test Rollup merge of #37841 - michaelwoerister:ich-loop-tests, r=nikomatsakis 2016-11-20 15:00:04 +01:00
tools Improved error reporting when target sysroot is missing. 2016-11-17 13:59:38 +08:00
vendor rustbuild: Vendor all dependencies 2016-11-08 07:32:05 -08:00
Cargo.lock Auto merge of #37831 - rkruppe:llvm-attr-fwdcompat, r=eddyb 2016-11-19 16:39:25 -06:00
Cargo.toml Use workspaces and switch to a single Cargo.lock. 2016-10-07 12:04:32 -07:00
stage0.txt Revert "Bump the bootstrap cargo to match the one paired with 1.13" 2016-11-17 00:11:10 +00:00