Re: [rust-dev] Timing vector inserts

2014-09-26 Thread François-Xavier Bourlet
is that the elements in the vector in the rust code are `uint` (which on most systems is 64-bit) and in the C code you’re inserting `int`s (32-bits on most systems). That’s not really a fair contest. - Clark On Thu, Sep 25, 2014 at 6:26 PM, François-Xavier Bourlet bomb...@gmail.com wrote: and hitting

Re: [rust-dev] Timing vector inserts

2014-09-25 Thread François-Xavier Bourlet
On my machine I get: C: 1,0.509391 rust: 1,0.466069 So rust is faster for me. For fun, I tried to write the rust version using unsafe and pre-allocation to remove the second push: let mut m = Vec::from_fn(101, |_| 0); let pm = m.as_mut_ptr(); let mut m_idx = 1i; let t =

Re: [rust-dev] Timing vector inserts

2014-09-25 Thread François-Xavier Bourlet
, François-Xavier Bourlet bomb...@gmail.com wrote: On my machine I get: C: 1,0.509391 rust: 1,0.466069 So rust is faster for me. For fun, I tried to write the rust version using unsafe and pre-allocation to remove the second push: let mut m = Vec::from_fn(101, |_| 0); let pm

Re: [rust-dev] trait implementations for references

2014-09-22 Thread François-Xavier Bourlet
Hi, My little understanding is that the compiler has some sort of priority on type inference depending of the kind of modification applied to the type in order to match anything. Rust can auto-deref on the . operator and auto-borrow when passing to reference parameters, and I suspect that an

Re: [rust-dev] Mutiplexing I/O within a task

2014-07-06 Thread François-Xavier Bourlet
Same here, I am highly interested in the topic. On Jul 5, 2014 10:14 AM, Nat Pryce nat.pr...@gmail.com wrote: I've been trying to write tasks that wait for both I/O and channel communication. I've been told that, to maximise communication performance, channels do not support selecting of both

Re: [rust-dev] Syntax sugar: Vec Rc RefCell Box Foo - VecRcRefCellBoxFoo

2014-06-29 Thread François-Xavier Bourlet
Isn't: type my_convonluted_type = ArcExclusiveVecBoxBufferT; The most common way to avoid retyping long definition? one could also pretty indent the type definition for readability, since it will be defined once. On Sun, Jun 29, 2014 at 9:56 AM, Benjamin Herr b...@0x539.de wrote: I realize

Re: [rust-dev] Integer overflow, round -2147483648

2014-06-23 Thread François-Xavier Bourlet
In short: - everybody wants checked integer arithmetic because it helps to write better code (thanks to compile time and runtime errors) - nobody wants to pay the price in performances, but maybe in the future, hardware++ will make it easier... or so on... What about: - Defining safe integer

Re: [rust-dev] Announcing the new Rust package manager, Cargo

2014-03-17 Thread François-Xavier Bourlet
You had my curiosity. But now you have my attention. On Mon, Mar 17, 2014 at 5:48 PM, Brian Anderson bander...@mozilla.com wrote: Dearest Rustlers, Today I'm super-excited to announce that Mozilla has arranged to develop a world-class package manager for Rust. Yehuda Katz and Carl Lerche,

Re: [rust-dev] static mut and owning pointers

2014-01-28 Thread François-Xavier Bourlet
damned, my gmail client was not up to date, you've got a better answer already (I got the ref keyword right at least ;)) On Tue, Jan 28, 2014 at 1:00 PM, François-Xavier Bourlet bomb...@gmail.com wrote: match global_data { Some(data) = You should be able to do: Some(ref data