Re: [rust-dev] Timing vector inserts

2014-09-27 Thread Fredrik Widlund
Hi, The benchmarks are updated since a while back, all versions use 64 bit values, and there are different versions for jemalloc and the glibc allocator (for Rust and C). As noted by Daniel Micay the most important factor here will be the memory allocator. Rust builds with jemalloc by default, wh

Re: [rust-dev] Timing vector inserts

2014-09-26 Thread François-Xavier Bourlet
with i32 for rust: (I am on x86_64) ==> vector_grow_c.csv <== 10,4.741286 ==> vector_grow_rust.csv <== 10,3.147506 ==> vector_grow_rust2.csv <== 10,3.153482 On Thu, Sep 25, 2014 at 9:30 PM, Clark Gaebel wrote: > Another problem I noticed is that the elements in the vect

Re: [rust-dev] Timing vector inserts

2014-09-25 Thread Clark Gaebel
Another problem I noticed 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 Bou

Re: [rust-dev] Timing vector inserts

2014-09-25 Thread François-Xavier Bourlet
and hitting reply-all is better... quick update: the implementation with unsafe & ptr is not slower. I just have too many cores + power-boost to get a clean benchmark every time. Running the benchs with n=1 billions (instead of 100 millions) gives me: ==> vector_grow_c.csv <== 10,5.0846

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 = time

Re: [rust-dev] Timing vector inserts

2014-09-25 Thread Clark Gaebel
You’re also timing two pushes, as opposed to a push and an array write in the C version. On Thu, Sep 25, 2014 at 3:59 PM, Daniel Micay wrote: > On 25/09/14 03:17 PM, Fredrik Widlund wrote: >> http://lonewolfer.wordpress.com/2014/09/24/benchmarking-dynamic-array-implementations/ >> >> (disclaim

Re: [rust-dev] Timing vector inserts

2014-09-25 Thread Daniel Micay
On 25/09/14 03:17 PM, Fredrik Widlund wrote: > http://lonewolfer.wordpress.com/2014/09/24/benchmarking-dynamic-array-implementations/ > > (disclaimer: *not* about comparing languages and claiming language X is > "better" than language Y) > > Kind regards, > Fredrik Widlund https://github.com/jem

Re: [rust-dev] Timing vector inserts

2014-09-25 Thread Fredrik Widlund
Great, thanks! Will update asap. F On Thu, Sep 25, 2014 at 9:33 PM, Clark Gaebel wrote: > I sent a pull request, but the tl;dr of it is that the rust version was > run without optimizations turned on. > > > > On Thu, Sep 25, 2014 at 12:17 PM, Fredrik Widlund < > fredrik.widl...@gmail.com> wrote

Re: [rust-dev] Timing vector inserts

2014-09-25 Thread Clark Gaebel
I sent a pull request, but the tl;dr of it is that the rust version was run without optimizations turned on. On Thu, Sep 25, 2014 at 12:17 PM, Fredrik Widlund wrote: > http://lonewolfer.wordpress.com/2014/09/24/benchmarking-dynamic-array-implementations/ > (disclaimer: *not* about comparing lan

[rust-dev] Timing vector inserts

2014-09-25 Thread Fredrik Widlund
http://lonewolfer.wordpress.com/2014/09/24/benchmarking-dynamic-array-implementations/ (disclaimer: *not* about comparing languages and claiming language X is "better" than language Y) Kind regards, Fredrik Widlund ___ Rust-dev mailing list Rust-dev@moz