Re: drastic slowdown for copies

2015-05-29 Thread Momo via Digitalmars-d-learn
On Friday, 29 May 2015 at 07:51:31 UTC, thedeemon wrote: On Thursday, 28 May 2015 at 21:23:11 UTC, Momo wrote: Ah, actually it's more complicated, as it depends on inlining a lot. Yes. And real functions are more complex and inlining is no reliable option. Indeed, without -O and -inline I was

Re: Windows Universal/Store apps support

2015-05-29 Thread Paulo Pinto via Digitalmars-d-learn
On Friday, 29 May 2015 at 03:23:39 UTC, Rikki Cattermole wrote: On 29/05/2015 3:57 a.m., Olivier Prince wrote: I searched the forum to find if there is some support for new Windows development technologies and I didn't find anything related (except some rants about WinRT 3 years ago). - Is

Re: drastic slowdown for copies

2015-05-29 Thread thedeemon via Digitalmars-d-learn
On Friday, 29 May 2015 at 07:51:31 UTC, thedeemon wrote: Above was on Core 2 Quad, here's for Core i3: 4 ints 5 ints -release by ref: 67 by ref: 66 by copy: 44 by copy: 142 by move: 45 by move: 137 -release -O by ref: 29 by ref: 29 by copy: 41 by copy: 141 by

Re: Windows Universal/Store apps support

2015-05-29 Thread Rikki Cattermole via Digitalmars-d-learn
On 29/05/2015 7:03 p.m., Paulo Pinto wrote: On Friday, 29 May 2015 at 03:23:39 UTC, Rikki Cattermole wrote: On 29/05/2015 3:57 a.m., Olivier Prince wrote: I searched the forum to find if there is some support for new Windows development technologies and I didn't find anything related (except

Re: drastic slowdown for copies

2015-05-29 Thread thedeemon via Digitalmars-d-learn
On Thursday, 28 May 2015 at 21:23:11 UTC, Momo wrote: Ah, actually it's more complicated, as it depends on inlining a lot. Indeed, without -O and -inline I was able to get by_ref to be slightly slower than by_copy for struct of 4 ints. But when inlining turns on, the numbers change in

Re: drastic slowdown for copies

2015-05-29 Thread thedeemon via Digitalmars-d-learn
On Thursday, 28 May 2015 at 21:23:11 UTC, Momo wrote: I'm currently investigating the difference of speed between references and copies. And it seems that copies got a immense slowdown if they reach a size of = 20 bytes. This is processor-specific, on different models of CPUs you might get

Re: Windows Universal/Store apps support

2015-05-29 Thread Paulo Pinto via Digitalmars-d-learn
On Friday, 29 May 2015 at 10:01:53 UTC, Rikki Cattermole wrote: On 29/05/2015 9:55 p.m., Paulo Pinto wrote: On Friday, 29 May 2015 at 07:41:14 UTC, Rikki Cattermole wrote: On 29/05/2015 7:03 p.m., Paulo Pinto wrote: On Friday, 29 May 2015 at 03:23:39 UTC, Rikki Cattermole wrote: On

Mutable reference for immutable AA

2015-05-29 Thread Jack Applegame via Digitalmars-d-learn
I need mutable storage for immutable associative array. Just create new immutable AA and store it for future passing it between threads/fibers. First attempt: just immutable AA immutable aa = [1:1, 2:1]; aa = [1:1, 2:1]; // fail, can't assign a new AA Second attempt: mutable AA with immutable

Re: Mutable reference for immutable AA

2015-05-29 Thread Jack Applegame via Digitalmars-d-learn
I made trivial pull request - https://github.com/D-Programming-Language/phobos/pull/3341 RebindableAA!(immutable int[string]) aa = [a: 1, b: 2]; // works assert(aa[a] == 1); // cool aa = [a: 3, b: 4]; // nice auto bb = aa; // yes bb = [a: 4, b: 5]; // super aa[a] = 2; //

Re: Windows Universal/Store apps support

2015-05-29 Thread Rikki Cattermole via Digitalmars-d-learn
On 29/05/2015 9:55 p.m., Paulo Pinto wrote: On Friday, 29 May 2015 at 07:41:14 UTC, Rikki Cattermole wrote: On 29/05/2015 7:03 p.m., Paulo Pinto wrote: On Friday, 29 May 2015 at 03:23:39 UTC, Rikki Cattermole wrote: On 29/05/2015 3:57 a.m., Olivier Prince wrote: I searched the forum to find

Re: Windows Universal/Store apps support

2015-05-29 Thread Olivier Prince via Digitalmars-d-learn
On Friday, 29 May 2015 at 03:23:39 UTC, Rikki Cattermole wrote: On 29/05/2015 3:57 a.m., Olivier Prince wrote: I searched the forum to find if there is some support for new Windows development technologies and I didn't find anything related (except some rants about WinRT 3 years ago). - Is

Re: Windows Universal/Store apps support

2015-05-29 Thread Paulo Pinto via Digitalmars-d-learn
On Friday, 29 May 2015 at 07:41:14 UTC, Rikki Cattermole wrote: On 29/05/2015 7:03 p.m., Paulo Pinto wrote: On Friday, 29 May 2015 at 03:23:39 UTC, Rikki Cattermole wrote: On 29/05/2015 3:57 a.m., Olivier Prince wrote: I searched the forum to find if there is some support for new Windows

Re: drastic slowdown for copies

2015-05-29 Thread Momo via Digitalmars-d-learn
Perhaps you can give me another detailed answer. I get a slowdown for all parts (ref, copy and move) if I use uninitialized floats. I got these results from the following code: by ref: 2369 by copy: 2335 by move: 2341 Code: struct vec2f { float x; float y; } But if I assign 0 to

Re: Get index of string in array at compile time

2015-05-29 Thread Timon Gehr via Digitalmars-d-learn
On 05/29/2015 06:43 PM, tcak wrote: I have define an immutable string array: [code] immutable string[] placeHolderDefinitionList = [ !-- fullname --, !-- list item -- ]; [/code] I need to get index of a string at compile time. So I have written a function as below: [code] public

Get index of string in array at compile time

2015-05-29 Thread tcak via Digitalmars-d-learn
I have define an immutable string array: [code] immutable string[] placeHolderDefinitionList = [ !-- fullname --, !-- list item -- ]; [/code] I need to get index of a string at compile time. So I have written a function as below: [code] public size_t

Re: Windows Universal/Store apps support

2015-05-29 Thread Jesse Phillips via Digitalmars-d-learn
On Thursday, 28 May 2015 at 15:57:42 UTC, Olivier Prince wrote: I searched the forum to find if there is some support for new Windows development technologies and I didn't find anything related (except some rants about WinRT 3 years ago). - Is there any support in D or phobos for developping

Re: Windows Universal/Store apps support

2015-05-29 Thread ZombineDev via Digitalmars-d-learn
On Thursday, 28 May 2015 at 15:57:42 UTC, Olivier Prince wrote: [snip] There isn't yet a polished alternative to MS VS Windows Store toolchain, but probably you don't need most of it (e.g. you can have a C++/XAML app that calls you D code). I noticed that Vibe.d has some WinRT support.

Mixin - to get to the content-type `MapResult!(__lambda1, int[]).MapResult`

2015-05-29 Thread Dennis Ritchie via Digitalmars-d-learn
Hi, This code prints the arrays: [5] [6] [7] import std.stdio, std.algorithm; static int idx; void walk(R)(R range) { while (!range.empty) { range.front; range.popFront; ++idx; } } void main() { [5, 6, 7].map!(a = [a].writeln).walk; } How should I apply

Re: drastic slowdown for copies

2015-05-29 Thread Ali Çehreli via Digitalmars-d-learn
On 05/29/2015 06:55 AM, Momo wrote: Perhaps you can give me another detailed answer. I get a slowdown for all parts (ref, copy and move) if I use uninitialized floats. Floating point variables are initialized to .nan of their types (e.g. float.nan). Apparently, the CPU is slow when using