about summary refs log tree commit diff
path: root/src/libsyntax/parse/parser.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2013-12-22 00:41:39 -0800
committerbors <bors@rust-lang.org>2013-12-22 00:41:39 -0800
commit55cbef611a25431c9614c2f4343472014977f5df (patch)
treefae66837778d53647275abbaab0b7f232179a4f7 /src/libsyntax/parse/parser.rs
parentcd13f4d599ec747708ae8e7dec79b21818352e36 (diff)
parent645fff4bc88f25c36a8260d66d9af027fc0532f2 (diff)
downloadrust-55cbef611a25431c9614c2f4343472014977f5df.tar.gz
rust-55cbef611a25431c9614c2f4343472014977f5df.zip
auto merge of #11064 : huonw/rust/vec-sort, r=alexcrichton
This uses quite a bit of unsafe code for speed and failure safety, and allocates `2*n` temporary storage.

[Performance](https://gist.github.com/huonw/5547f2478380288a28c2):

|      n |      new | priority_queue |   quick3 |
|-------:|---------:|---------------:|---------:|
|      5 |      200 |            155 |      106 |
|    100 |     6490 |           8750 |     5810 |
|  10000 |  1300000 |        1790000 |  1060000 |
| 100000 | 16700000 |       23600000 | 12700000 |
| sorted |   520000 |        1380000 | 53900000 |
|  trend |  1310000 |        1690000 |  1100000 |

(The times are in nanoseconds, having subtracted the set-up time (i.e. the `just_generate` bench target).)

I imagine that there is still significant room for improvement, particularly because both priority_queue and quick3 are doing a static call via `Ord` or `TotalOrd` for the comparisons, while this is using a (boxed) closure.

Also, this code does not `clone`, unlike `quick_sort3`; and is stable, unlike both of the others.
Diffstat (limited to 'src/libsyntax/parse/parser.rs')
0 files changed, 0 insertions, 0 deletions