Commit Graph

263 Commits

Author SHA1 Message Date
Ben Striegel
12f06bb496 Finish de-implicit-selifizng libcore 2013-03-06 04:00:25 -05:00
bors
eddefbc893 auto merge of #5212 : thestinger/rust/iter, r=graydon
A small step towards fixing #2827
2013-03-05 02:06:50 -08:00
bors
c639a78dc4 auto merge of #5205 : thestinger/rust/radix, r=graydon
This is an implementation of a map and set for integer keys. It's an ordered container (by byte order, which is sorted order for integers and byte strings when done in the right direction) with O(1) worst-case lookup, removal and insertion. There's no rebalancing or rehashing so it's actually O(1) without amortizing any costs.

The fanout can be adjusted in multiples of 2 from 2-ary through 256-ary, but it's hardcoded at 16-ary because there isn't a way to expose that in the type system yet. To keep things simple, it also only allows `uint` keys, but later I'll expand it to all the built-in integer types and byte arrays.

There's quite a bit of room for performance improvement, along with the boost that will come with dropping the headers on `Owned` `~` and getting rid of the overhead from the stack switches to the allocator. It currently does suffix compression for a single node and then splits into two n-ary trie nodes, which could be replaced with an array for at least 4-8 suffixes before splitting it. There's also the option of doing path compression, which may be a good or a bad idea and depends a lot on the data stored.

I want to share the test suite with the other maps so that's why I haven't duplicated all of the existing integer key tests in this file. I'll send in another pull request to deal with that.

Current benchmark numbers against the other map types:

    TreeMap:
     Sequential integers:
      insert: 0.798295
      search: 0.188931
      remove: 0.435923
     Random integers:
      insert: 1.557661
      search: 0.758325
      remove: 1.720527

    LinearMap:
     Sequential integers:
      insert: 0.272338
      search: 0.141179
      remove: 0.190273
     Random integers:
      insert: 0.293588
      search: 0.162677
      remove: 0.206142

    TrieMap:
     Sequential integers:
      insert: 0.0901
      search: 0.012223
      remove: 0.084139
     Random integers:
      insert: 0.392719
      search: 0.261632
      remove: 0.470401

@graydon is using an earlier version of this for the garbage collection implementation, so that's why I added this to libcore. I left out the `next` and `prev` methods *for now* because I just wanted the essentials first.
2013-03-04 08:21:47 -08:00
Daniel Micay
af645e8487 replace option::iter with a BaseIter impl 2013-03-03 11:01:17 -05:00
Patrick Walton
97fd421319 librustc: Remove fn@, fn~, and fn& from librustc. rs=defun 2013-03-02 16:49:31 -08:00
Patrick Walton
a3f728238b librustc: Forbid chained imports and fix the logic for one-level renaming imports 2013-03-02 16:49:30 -08:00
Daniel Micay
a4d22635e1 add an initial radix trie implementation 2013-03-02 16:29:41 -05:00
Brian Anderson
9639ca5aa8 core: Move core::rt to core::unstable::lang 2013-03-01 17:27:14 -08:00
Brian Anderson
bcf626812b Rename core::private to core::unstable. #4743 2013-03-01 14:55:47 -08:00
Patrick Walton
9519ee5d80 librustc: "APL2" -> "ASL2". rs=license-fix 2013-03-01 08:41:31 -08:00
Patrick Walton
c355f17943 Merge remote branch 'sevrak/issue-5164' into incoming 2013-03-01 08:39:02 -08:00
Tim Chevalier
6b6d15ac20 Remove code that was awaiting a snapshot
* Disallow structural records everywhere
* Remove all #[cfg(stage0)] stuff
* Remove the last deprecated modes in libcore
* Un-xfail a test
2013-02-28 20:30:50 -08:00
sevrak
833ad6018e Fix license attribute on crates 2013-02-28 13:34:01 +00:00
Patrick Walton
e2f90091cf libcore: Move Cell to core and de-~mut core and std 2013-02-26 04:18:12 -08:00
Patrick Walton
c483aab4ae librustc: Implement a lint mode for mutable structures; deny by default. r=tjc 2013-02-26 04:18:11 -08:00
Brian Anderson
dab6a85230 core: Extract comm from pipes. #4742 2013-02-21 17:36:54 -08:00
Marvin Löbel
3792eb2a38 Moved core::extfmt to core::private::extfmt
Needs a snapshot to remove stage0 extfmt export in core
2013-02-21 13:32:20 +01:00
Zack Corr
b10dc1af06 Move semver to std and finish rustpkg 2013-02-15 18:04:10 -08:00
Zack Corr
226b61ba5f rustpkg: Add package script parsing 2013-02-15 18:04:10 -08:00
Patrick Walton
216e85fadf libcore: Move the numeric operations out of Num. r=brson
Sadly I could not use trait inheritance due to a type parameter substitution
bug.
2013-02-14 08:14:01 -08:00
Brendan Zabarauskas
48b2141b83 Add NumCast trait for generic numeric type casts 2013-02-11 12:33:05 +11:00
Niko Matsakis
a32498d846 Make ~fn non-copyable, make &fn copyable, split barefn/closure types,
correct handling of moves for struct-record update.

Part of #3678.  Fixes #2828, #3904, #4719.
2013-02-07 05:53:30 -08:00
Marvin Löbel
40f0b45f8e Moved all numeric modules in core into own directory
Reason: Better grouping of related modules, future-proving for a more extensive math library.
2013-02-03 15:37:23 -08:00
Brian Anderson
542bf20414 core: Remove oldcomm 2013-02-01 21:22:49 -08:00
Nick Desaulniers
aee7929469 Replace most invocations of fail keyword with die! macro 2013-01-31 20:12:49 -08:00
Patrick Walton
226cd68f13 librustc: De-implicit-self the visitor. r=graydon 2013-01-29 10:43:12 -08:00
Daniel Micay
ec3f6e1932 implement Mutable trait for vec 2013-01-24 23:10:14 -05:00
Daniel Micay
d95c9cbe38 replace ConstVector trait with the Container trait 2013-01-24 23:02:44 -05:00
Daniel Micay
b7ef28c33a rename send_map to hashmap
This makes the module much more discoverable, and is in line with the
'treemap' naming.
2013-01-23 14:25:01 -05:00
Daniel Micay
13d07ad0a6 add a Set trait and implement it for TreeSet 2013-01-20 14:58:19 -05:00
Patrick Walton
f405e41d7a librustc: Implement write guards for borrowing @mut to & or &mut. r=nmatsakis 2013-01-17 11:50:20 -08:00
Andrew Paseltiner
0de7aa5506 allow logical negation operator (!) to be overloaded 2013-01-11 14:31:44 -05:00
Erick Tryzelaar
dc7183ed0e core: rename MutableVector to OwnedVector 2013-01-09 08:55:37 -08:00
Patrick Walton
2db3abddcd librustc: Make unqualified identifier searches terminate at the nearest module scope. r=tjc 2013-01-08 22:02:35 -08:00
Patrick Walton
44ab00ee37 Revert "librustc: Make unqualified identifier searches terminate at the nearest module scope. r=tjc"
This reverts commit a8d37af247.
2013-01-08 19:29:16 -08:00
Patrick Walton
a8d37af247 librustc: Make unqualified identifier searches terminate at the nearest module scope. r=tjc 2013-01-08 19:27:57 -08:00
Brian Anderson
3b71d14442 Inject std when --test. #1127, #3241 2013-01-08 14:58:39 -08:00
Patrick Walton
57c599914a librustc: Terminate name searches at the nearest module scope for paths that contain at least two components. r=graydon 2012-12-27 10:02:54 -08:00
Graydon Hoare
dbd36111fe bump 0.5 => 0.6, redirect some URLs in docs. 2012-12-21 15:35:49 -08:00
Graydon Hoare
8e28f23c60 core: add macro_rules! for "condition! { c: in -> out; }". 2012-12-18 17:22:27 -08:00
Brian Anderson
e6d1b02359 Rename core::comm to core::oldcomm 2012-12-14 14:59:32 -08:00
Brian Anderson
d809e89c26 Replace some Eq impls with deriving_eq 2012-12-13 16:14:28 -08:00
Brian Anderson
ed4fac01b5 Rename Send trait to Owned 2012-12-13 15:52:50 -08:00
Brian Anderson
a277081ee4 Rename Owned trait to Durable 2012-12-13 15:52:50 -08:00
Patrick Walton
4c2e4c37ce librustc: Make use statements crate-relative by default. r=brson 2012-12-13 13:05:22 -08:00
Graydon Hoare
94be145169 core: rename box to managed. Close #4079. 2012-12-03 17:45:19 -08:00
Graydon Hoare
2a5713ed5c core: rename unit to nil. Close #4080. 2012-12-03 17:28:19 -08:00
Graydon Hoare
00c856c0b1 Update license, add license boilerplate to most files. Remainder will follow. 2012-12-03 17:12:14 -08:00
Brian Anderson
b52a4b412e core: Make core.rc more readable. Cleanup 2012-11-30 01:32:53 -08:00
Brian Anderson
65bd40e300 Remove uses of #[merge] 2012-11-28 17:09:26 -08:00
Brian Anderson
9b95d51131 core: Remove old template files 2012-11-28 15:26:55 -08:00
Brian Anderson
fc06114ddf Merge remote-tracking branch 'brson/companion' into incoming
Conflicts:
	src/compiletest/compiletest.rs
	src/libcargo/cargo.rs
	src/libcore/core.rs
	src/librustc/rustc.rs
	src/librustdoc/rustdoc.rc
2012-11-28 13:17:33 -08:00
Brian Anderson
8179e268ef Register snapshots 2012-11-28 12:33:00 -08:00
Brian Anderson
b21e9d52de core: Add Clone trait 2012-11-27 11:08:19 -08:00
Brian Anderson
be6613e048 Remove the crate language 2012-11-26 18:13:54 -08:00
Tim Chevalier
af842bf76c Rename core::uniq to core::owned
No review.
Closes #3841
2012-10-25 14:48:28 -07:00
Brian Anderson
d29962f0eb Move futures to std 2012-10-23 14:46:49 -07:00
Graydon Hoare
fdd7b4d8f4 core: first working sketch of a condition system. 2012-10-17 16:40:34 -07:00
Graydon Hoare
57b4d10ff6 bump version to 0.5. 2012-10-12 16:41:32 -07:00
Graydon Hoare
c37c243e95 Remove some residue, core is effectively de-exported now. Close #3583. 2012-10-04 16:08:08 -07:00
Graydon Hoare
6ffce1a1c3 De-export extfmt. Part of #3583. 2012-10-04 13:50:02 -07:00
Patrick Walton
82fd71137a libcore: De-export core.rc and core.rs 2012-10-03 19:40:25 -07:00
Graydon Hoare
c31a88c7f4 De-export the submodules of task. Part of #3583. 2012-10-02 16:32:00 -07:00
Patrick Walton
9284179311 libstd: Switch off legacy modes in both core and std. 2012-10-02 12:20:06 -07:00
Graydon Hoare
b787a26534 De-export comm, task. Part of #3583. 2012-10-02 12:05:08 -07:00
Graydon Hoare
7ead3c0411 De-export dlist, dvec. Part of #3583. 2012-10-01 17:50:44 -07:00
Graydon Hoare
39f114d171 De-export iter and result. Part of #3583. 2012-10-01 17:27:56 -07:00
Graydon Hoare
9c8ff35727 De-export either. Part of #3583. 2012-10-01 16:11:37 -07:00
Graydon Hoare
c042e06908 De-export vec. Part of #3583. 2012-10-01 16:11:17 -07:00
Graydon Hoare
1229d1c2ce De-export option and option_iter. Part of #3583. 2012-10-01 14:12:36 -07:00
Graydon Hoare
db44dc5cf2 De-export gc and io. Part of #3583. 2012-10-01 14:09:44 -07:00
Tim Chevalier
3639d38d5c Add a demoded version of ptr::addr_of
Currently, the new version is ptr::p2::addr_of and the old one is
ptr::addr_of. This is kind of cheesy, but I need a snapshot before I
can ditch the old version, since the pipe compiler generates calls to
addr_of.

core is converted over to use the new version, std is not.
2012-09-28 22:19:01 -07:00
Graydon Hoare
3654287826 De-export logging, to_str, to_bytes, from_str, util. Part of #3583. 2012-09-28 17:47:09 -07:00
Brian Anderson
8766c2e35b core: Demode patterns 2012-09-28 16:57:36 -07:00
Graydon Hoare
ad951b5976 De-export ptr, hash. Part of #3583. 2012-09-28 16:27:28 -07:00
Graydon Hoare
1d51cfa1e8 Finish de-exporting send_map, future, pipes. Part of #3583. 2012-09-28 16:27:09 -07:00
Graydon Hoare
fd8e7aab71 De-export bool, tuple, unit, uniq. Part of #3583. 2012-09-28 16:05:53 -07:00
Graydon Hoare
4b7d4cd0cf De-export str. Part of #3583. 2012-09-28 15:41:15 -07:00
Tim Chevalier
d9a06be224 Fix patterns in tuple 2012-09-28 14:59:22 -07:00
Graydon Hoare
94f7bf98f9 Finish de-exporting uint modules. Part of #3583. 2012-09-28 14:54:39 -07:00
Graydon Hoare
70c202e218 De-export f32 and f64. 2012-09-28 12:30:33 -07:00
Graydon Hoare
3eb7b5ca13 De-export ops, cmp, num. Part of #3583. 2012-09-28 12:30:18 -07:00
Graydon Hoare
0792ebe08a Finish de-exporting int-template and the int modules. 2012-09-28 12:03:54 -07:00
Graydon Hoare
4eb5177d8c Finish de-exporting cast, mutable, flate, repr, cleanup, reflect. Part of #3583. 2012-09-27 17:17:27 -07:00
Graydon Hoare
8c89e4bbdd Finish de-exporting path, rand, run, sys. Part of #3583. 2012-09-27 15:44:09 -07:00
Graydon Hoare
51152ccf9d De-export private and unicode. Part of #3583. 2012-09-27 14:41:29 -07:00
Graydon Hoare
cda1d35251 Finish de-exporting box, char, float. Part of #3583. 2012-09-27 14:40:53 -07:00
Graydon Hoare
b41d5146cc De-export os and libc. Close #2006. 2012-09-27 14:08:47 -07:00
Patrick Walton
1880d783b7 libcore: Partially de-export int-template and uint-template 2012-09-26 18:46:48 -07:00
Patrick Walton
cac5a9f916 libcore: De-export core::at_vec 2012-09-25 17:53:23 -07:00
Brian Anderson
32032491ed core: Un-legacy-export stackwalk, cmath 2012-09-23 16:42:05 -07:00
Graydon Hoare
dffe188991 Install new pub/priv/export rules as defaults, old rules accessible under #[legacy_exports]; 2012-09-21 18:11:43 -07:00
Brian Anderson
4f5bff993b core: Decompose task into more submodules 2012-09-19 19:08:32 -07:00
Brian Anderson
f996b3ae81 core: Split local_data into local_data/local_data_priv 2012-09-19 19:08:32 -07:00
Brian Anderson
1397dca2dd core: Move TLS to task::local_data 2012-09-19 19:08:32 -07:00
Brian Anderson
7bf0aa1c43 core: More doc cleanup 2012-09-19 17:17:19 -07:00
Brian Anderson
c115b82238 core: Clean up crate docs and give all mods a brief description 2012-09-19 16:52:59 -07:00
Graydon Hoare
5e41739562 Remove final bits of residual hokey-hash functions. Close #1616. 2012-09-19 16:35:53 -07:00
Brian Anderson
2906f2de31 core: Rename 'unsafe' mod to 'cast' 2012-09-18 19:36:25 -07:00
Patrick Walton
e653d493fb rustc: Remove legacy mode inference, unless #[legacy_modes] is used 2012-09-18 15:53:04 -07:00