www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.announce - D for the Win

reply "Andrei" <andrei.amatuni gmail.com> writes:
stumbled on this blog post:

http://tomerfiliba.com/blog/dlang/

looked like something worth posting to r/programming, so I did
Aug 20 2014
next sibling parent reply "anonymous" <anonymous example.com> writes:
 Dlang Dlang Über Alles
as a German, O_O
Aug 20 2014
parent reply Walter Bright <newshound2 digitalmars.com> writes:
On 8/20/2014 2:33 PM, anonymous wrote:
 Dlang Dlang Über Alles
as a German, O_O
I'm not surprised that the German programming community has taken to D. After all, German cars all have those "D" stickers on them :-)
Aug 20 2014
next sibling parent reply "anonymous" <anonymous example.com> writes:
On Wednesday, 20 August 2014 at 21:43:26 UTC, Walter Bright wrote:
 On 8/20/2014 2:33 PM, anonymous wrote:
 Dlang Dlang Über Alles
as a German, O_O
I'm not surprised that the German programming community has taken to D. After all, German cars all have those "D" stickers on them :-)
No, no, "Dlang Dlang Über Alles" is a take on "Deutschland Deutschland über alles" (Germany Germany over everything), the first verse of the national anthem as sung in Nazi times. I was actually worried if the author is German. He's not, thankfully. He's from Israel. From a German author that would be an embracement of fascism. Coming from an Israeli, I don't really know where to put it, probably completely benign.
Aug 20 2014
next sibling parent reply Paulo Pinto <pjmlp progtools.org> writes:
Am 21.08.2014 00:02, schrieb anonymous:
 On Wednesday, 20 August 2014 at 21:43:26 UTC, Walter Bright wrote:
 On 8/20/2014 2:33 PM, anonymous wrote:
 Dlang Dlang Über Alles
as a German, O_O
I'm not surprised that the German programming community has taken to D. After all, German cars all have those "D" stickers on them :-)
No, no, "Dlang Dlang Über Alles" is a take on "Deutschland Deutschland über alles" (Germany Germany over everything), the first verse of the national anthem as sung in Nazi times. I was actually worried if the author is German. He's not, thankfully. He's from Israel. From a German author that would be an embracement of fascism. Coming from an Israeli, I don't really know where to put it, probably completely benign.
As a Portuguese living in Germany, I would say not everyone knows that outside Germany. Specially the younger generations, they just use it because it sounds cool. -- Paulo
Aug 20 2014
next sibling parent ketmar via Digitalmars-d-announce <digitalmars-d-announce puremagic.com> writes:
On Thu, 21 Aug 2014 00:57:27 +0200
Paulo Pinto via Digitalmars-d-announce
<digitalmars-d-announce puremagic.com> wrote:

 Specially the younger generations, they just use it because it sounds
 cool.
and fun. they don't fear that old dead dog anymore, they making fun of it.
Aug 20 2014
prev sibling next sibling parent Nick Sabalausky <SeeWebsiteToContactMe semitwist.com> writes:
On 8/20/2014 6:57 PM, Paulo Pinto wrote:
 Am 21.08.2014 00:02, schrieb anonymous:
 No, no, "Dlang Dlang Über Alles" is a take on "Deutschland
 Deutschland über alles" (Germany Germany over everything), the
 first verse of the national anthem as sung in Nazi times.

 I was actually worried if the author is German. He's not,
 thankfully. He's from Israel. From a German author that would be
 an embracement of fascism. Coming from an Israeli, I don't really
 know where to put it, probably completely benign.
As a Portuguese living in Germany, I would say not everyone knows that outside Germany. Specially the younger generations, they just use it because it sounds cool.
"Über Alles" always just makes me think of Hanzel und Gretyl: http://en.wikipedia.org/wiki/%C3%9Cber_Alles_%28album%29 Gotta love tongue-in-cheek psuedo-German metal ;)
Aug 21 2014
prev sibling parent "anonymous" <anonymous example.com> writes:
On Wednesday, 20 August 2014 at 22:57:21 UTC, Paulo Pinto wrote:
 As a Portuguese living in Germany, I would say not everyone 
 knows that outside Germany.
Certainly. As I said, from an Israeli it's probably benign. I guess if aynthing, it's meant to be jokingly provoking towards Germans. I don't mind that at all.
Aug 21 2014
prev sibling next sibling parent reply ketmar via Digitalmars-d-announce <digitalmars-d-announce puremagic.com> writes:
On Wed, 20 Aug 2014 22:02:31 +0000
anonymous via Digitalmars-d-announce
<digitalmars-d-announce puremagic.com> wrote:

 From a German author that would be an embracement of fascism.
i always wonder how good people at finding various offences and fascims everywhere. i bet that such people are glad to censor Ha=C5=A1ek's "The Good Soldier =C5=A0vejk", 'cause "Ha=C5=A1ek makes fun of the great human tragedy: the w= ar!"
Aug 20 2014
parent reply "anonymous" <anonymous example.com> writes:
On Thursday, 21 August 2014 at 01:51:11 UTC, ketmar via
Digitalmars-d-announce wrote:
 i always wonder how good people at finding various offences
I'm not offended.
 and fascims everywhere.
It's pretty much the Nazi anthem. It doesn't get much more fascist than that. Of course, someone can play with fascist phrases without being a fascist or promoting fascism. As I said, coming from an Israeli, it's probably benign. If the author was German, I'd feel uneasy about it. And don't tell me that Germans carelessly throwing around Nazi slogans isn't something to feel uneasy about. The NPD (Nazi party) is in two Landtagen (state parliaments).
 i bet that such people are glad to censor
I'm not trying to censor anything. Neither am I convinced that banning Nazi symbols, songs, etc (as we do in Germany) is the right way to go. I think I'd rather have the Nazis wear Hakenkreuz armbands than other, obscure symbols that I can't identify. It's not like they stop existing when we ban their uniforms.
Aug 21 2014
parent reply ketmar via Digitalmars-d-announce <digitalmars-d-announce puremagic.com> writes:
On Thu, 21 Aug 2014 11:48:32 +0000
anonymous via Digitalmars-d-announce
<digitalmars-d-announce puremagic.com> wrote:

 It's pretty much the Nazi anthem.
oh, really? let's see. current German anthem: Einigkeit und Recht und Freiheit f=C3=BCr das deutsche Vaterland! Danach lasst uns alle streben br=C3=BCderlich mit Herz und Hand! and so on. pretty innocent, right? ok, but this is only the 3rd verse of the song which begins with... oh, "Deutschland, Deutschland =C3=BCber alles". may i assume that all Germans are well-disgiused Nazis then? here is the full song, for your pleasure: Deutschland, Deutschland =C3=BCber alles, =C3=BCber alles in der Welt, wenn es stets zu Schutz und Trutze br=C3=BCderlich zusammenh=C3=A4lt. Von der Maas bis an die Memel, von der Etsch bis an den Belt, Deutschland, Deutschland =C3=BCber alles, =C3=BCber alles in der Welt! Deutsche Frauen, deutsche Treue, deutscher Wein und deutscher Sang sollen in der Welt behalten ihren alten sch=C3=B6nen Klang, uns zu edler Tat begeistern unser ganzes Leben lang. =E2=80=94 Deutsche Frauen, deutsche Treue, deutscher Wein und deutscher Sang! and now, German anthem! and the 3rd verse: Einigkeit und Recht und Freiheit f=C3=BCr das deutsche Vaterland! Danach lasst uns alle streben br=C3=BCderlich mit Herz und Hand! Einigkeit und Recht und Freiheit sind des Gl=C3=BCckes Unterpfand; bl=C3=BCh im Glanze dieses Gl=C3=BCckes, bl=C3=BChe, deutsches Vaterland.
 And don't tell me that Germans
 carelessly throwing around Nazi slogans isn't something to feel
 uneasy about.
they not only "throwing", they still using part of that song as their anthem. besides, aren't your words racist?
Aug 21 2014
next sibling parent reply "Dicebot" <public dicebot.lv> writes:
On Thursday, 21 August 2014 at 12:05:40 UTC, ketmar via 
Digitalmars-d-announce wrote:
 ...
Please, this is not important enough to argue here.
Aug 21 2014
next sibling parent ketmar via Digitalmars-d-announce <digitalmars-d-announce puremagic.com> writes:
On Thu, 21 Aug 2014 12:08:05 +0000
Dicebot via Digitalmars-d-announce
<digitalmars-d-announce puremagic.com> wrote:

 Please, this is not important enough to argue here.
ah, excuse me. it's so easy to drag me into such talks... mea culpa.
Aug 21 2014
prev sibling parent "deadalnix" <deadalnix gmail.com> writes:
On Thursday, 21 August 2014 at 12:08:06 UTC, Dicebot wrote:
 On Thursday, 21 August 2014 at 12:05:40 UTC, ketmar via 
 Digitalmars-d-announce wrote:
 ...
Please, this is not important enough to argue here.
And fairly common. The French one propose to use foreigner's blood to water the fields.
Aug 22 2014
prev sibling parent reply "anonymous" <anonymous example.com> writes:
On Thursday, 21 August 2014 at 12:05:40 UTC, ketmar via
Digitalmars-d-announce wrote:
 On Thu, 21 Aug 2014 11:48:32 +0000
 anonymous via Digitalmars-d-announce
 <digitalmars-d-announce puremagic.com> wrote:

 It's pretty much the Nazi anthem.
oh, really?
Yes, really.
 let's see. current German anthem:
[...]
 and so on. pretty innocent, right? ok, but this is only the 3rd 
 verse
 of the song which begins with... oh, "Deutschland, Deutschland 
 über
 alles". may i assume that all Germans are well-disgiused Nazis 
 then?
The current anthem is really only the third verse/stanza (I'm not sure about vocabulary). If a German sings the first and second, they are aware that they're singing the Nazi anthem.
 And don't tell me that Germans
 carelessly throwing around Nazi slogans isn't something to feel
 uneasy about.
they not only "throwing", they still using part of that song as their anthem.
It's not the whole song that's associated with the Nazis, only the first and second stanzas.
 besides, aren't your words racist?
No.
Aug 21 2014
parent "Gary Willoughby" <dev nomad.so> writes:
http://en.wikipedia.org/wiki/Godwin's_law
Aug 21 2014
prev sibling next sibling parent "eles" <eles215 gzk.dot> writes:
On Wednesday, 20 August 2014 at 22:02:31 UTC, anonymous wrote:
 On Wednesday, 20 August 2014 at 21:43:26 UTC, Walter Bright 
 wrote:
 On 8/20/2014 2:33 PM, anonymous wrote:
 Dlang Dlang Über Alles
as a German, O_O
I'm not surprised that the German programming community has taken to D. After all, German cars all have those "D" stickers on them :-)
No, no, "Dlang Dlang Über Alles" is a take on "Deutschland Deutschland über alles" (Germany Germany over everything), the first verse of the national anthem as sung in Nazi times.
While I agree with the historical significance, there are some things to be straighten: 1) the song was used even before: it was the national anthem of the Weimar republic, the one that Nazi toppled 2) today, it's third stanza (the first one begins with "DDuA") is still the official anthem of Deutschland 3) there is no official interdiction of the first two stanzas, except that they are not really protected by the German law punishing offenses to the national symbols of Germany
Aug 20 2014
prev sibling parent Walter Bright <newshound2 digitalmars.com> writes:
On 8/20/2014 3:02 PM, anonymous wrote:
 [...]
I agree with Dicebot. Let's not go there.
Aug 21 2014
prev sibling parent "eles" <eles215 gzk.dot> writes:
On Wednesday, 20 August 2014 at 21:43:26 UTC, Walter Bright wrote:
 On 8/20/2014 2:33 PM, anonymous wrote:
 Dlang Dlang Über Alles
as a German, O_O
I'm not surprised that the German programming community has taken to D. After all, German cars all have those "D" stickers on them :-)
French must be such great fans of functional programming, on the other hand. F# anyone?
Aug 20 2014
prev sibling next sibling parent reply "Peter Alexander" <peter.alexander.au gmail.com> writes:
Ha, that opDollar thing in the HTML generator is the nastiest D 
hack I've seen :-P
Aug 20 2014
parent reply Nick Sabalausky <SeeWebsiteToContactMe semitwist.com> writes:
On 8/20/2014 5:39 PM, Peter Alexander wrote:
 Ha, that opDollar thing in the HTML generator is the nastiest D hack
 I've seen :-P
Yea, this *statement* really made me go o_O link[$.rel = "foobar", $.type = "text/css"]; That's a lot of syntax abuse there! Still, if it works for him, great, who am I to complain? At the end of the day, it's just a tool.
Aug 21 2014
next sibling parent reply "Ola Fosheim Gr" <ola.fosheim.grostad+dlang gmail.com> writes:
On Thursday, 21 August 2014 at 08:31:49 UTC, Nick Sabalausky 
wrote:
    link[$.rel = "foobar", $.type = "text/css"];

 That's a lot of syntax abuse there!

 Still, if it works for him, great, who am I to complain? At the 
 end of the day, it's just a tool.
Now the comma-operator has to stay because removing it is a severe breaking change.
Aug 21 2014
next sibling parent ketmar via Digitalmars-d-announce <digitalmars-d-announce puremagic.com> writes:
On Thu, 21 Aug 2014 08:37:30 +0000
Ola Fosheim Gr via Digitalmars-d-announce
<digitalmars-d-announce puremagic.com> wrote:

 Now the comma-operator has to stay because removing it is a=20
 severe breaking change.
but we can abuse opIndex and/or opSlice too! ;-)
Aug 21 2014
prev sibling next sibling parent reply Jacob Carlborg <doob me.com> writes:
On 21/08/14 10:37, Ola Fosheim Gr wrote:

 Now the comma-operator has to stay because removing it is a severe
 breaking change.
Isn't that multiple arguments to opIndex? -- /Jacob Carlborg
Aug 21 2014
next sibling parent "Ola Fosheim Gr" <ola.fosheim.grostad+dlang gmail.com> writes:
On Thursday, 21 August 2014 at 08:47:50 UTC, Jacob Carlborg wrote:
 Isn't that multiple arguments to opIndex?
Probably, I was just trying to be funny :P There should be a tutorial "D for perl programmers of the 90s"...
Aug 21 2014
prev sibling parent Rory McGuire via Digitalmars-d-announce writes:
On Thu, Aug 21, 2014 at 10:47 AM, Jacob Carlborg via Digitalmars-d-announce
<digitalmars-d-announce puremagic.com> wrote:

 On 21/08/14 10:37, Ola Fosheim Gr wrote:Isn't that multiple arguments to
 opIndex?

 --
 /Jacob Carlborg
mm, yes I believe you are right. http://dlang.org/operatoroverloading.html#ArrayOps
Aug 21 2014
prev sibling parent Rory McGuire via Digitalmars-d-announce writes:
What is really awesome about this is that his code actually worked, the
mixing of operator overloads, opDispatch and rarely used features(e.g.
comma op).

D has come a long way in the last decade.


On Thu, Aug 21, 2014 at 10:40 AM, ketmar via Digitalmars-d-announce <
digitalmars-d-announce puremagic.com> wrote:

 On Thu, 21 Aug 2014 08:37:30 +0000
 Ola Fosheim Gr via Digitalmars-d-announce
 <digitalmars-d-announce puremagic.com> wrote:

 Now the comma-operator has to stay because removing it is a
 severe breaking change.
but we can abuse opIndex and/or opSlice too! ;-)
Aug 21 2014
prev sibling parent ketmar via Digitalmars-d-announce <digitalmars-d-announce puremagic.com> writes:
On Thu, 21 Aug 2014 04:31:31 -0400
Nick Sabalausky via Digitalmars-d-announce
<digitalmars-d-announce puremagic.com> wrote:

 Yea, this *statement* really made me go o_O
=20
     link[$.rel =3D "foobar", $.type =3D "text/css"];
=20
 That's a lot of syntax abuse there!
but it's fun! we all used to think that "$ should mean 'length'" and he has no such mind frames. i like it. ;-)
Aug 21 2014
prev sibling next sibling parent Walter Bright <newshound2 digitalmars.com> writes:
On 8/20/2014 2:21 PM, Andrei wrote:
 stumbled on this blog post:

 http://tomerfiliba.com/blog/dlang/

 looked like something worth posting to r/programming, so I did
http://www.reddit.com/r/programming/comments/2e49tm/d_for_the_win/
Aug 20 2014
prev sibling next sibling parent "bearophile" <bearophileHUGS lycos.com> writes:
Andrei:

 http://tomerfiliba.com/blog/dlang/
 struct PascalString {
    Field!ubyte length;
Also see if UDAs plus compile-time introspection is helpful.
 auto stream = cast(ubyte[])"\x05helloXXXX".dup;
Perhaps this is enough, and avoids one allocation: immutable stream = "\x05helloXXXX".representation; Bye, bearophile
Aug 20 2014
prev sibling parent reply "Adam D. Ruppe" <destructionator gmail.com> writes:
Author posted part 2 http://tomerfiliba.com/blog/dlang-part2/
Aug 23 2014
next sibling parent Andrej Mitrovic via Digitalmars-d-announce writes:
On 8/23/14, Adam D. Ruppe via Digitalmars-d-announce
<digitalmars-d-announce puremagic.com> wrote:
 Author posted part 2 http://tomerfiliba.com/blog/dlang-part2/
If I read that right it seems they're using D in his startup? Pretty cool. A bit of googling reveals the company's name is "Weka.IO".
Aug 23 2014
prev sibling parent reply "Dicebot" <public dicebot.lv> writes:
On Saturday, 23 August 2014 at 16:28:33 UTC, Adam D. Ruppe wrote:
 Author posted part 2 http://tomerfiliba.com/blog/dlang-part2/
In reddit thread one of commenters complained about D performance and linked this benchmark : https://github.com/nsf/pnoise I tried running it and don't see anything inherently wrong that may justify 3x-5x slowdowns compared to clang / gcc versions - however, it does plenty of floating point math I don't know performance implications of. Maybe someone else can have a look what can be a problem?
Aug 23 2014
next sibling parent "Mike" <none none.com> writes:
On Sunday, 24 August 2014 at 02:19:18 UTC, Dicebot wrote:
 On Saturday, 23 August 2014 at 16:28:33 UTC, Adam D. Ruppe 
 wrote:
 Author posted part 2 http://tomerfiliba.com/blog/dlang-part2/
In reddit thread one of commenters complained about D performance and linked this benchmark : https://github.com/nsf/pnoise I tried running it and don't see anything inherently wrong that may justify 3x-5x slowdowns compared to clang / gcc versions - however, it does plenty of floating point math I don't know performance implications of. Maybe someone else can have a look what can be a problem?
I believe that was previously discussed here: http://forum.dlang.org/post/lo19l7$n2a$1 digitalmars.com. Mike
Aug 23 2014
prev sibling parent reply "bearophile" <bearophileHUGS lycos.com> writes:
Dicebot:

 In reddit thread one of commenters complained about D 
 performance and linked this benchmark :
That benchmark found a small performance bug in ldc2, that I reported, but I think it's not yet fixed. Rust has fixed a different smaller performance bug uncovered by that benchmark. Bye, bearophile
Aug 24 2014
parent reply Jacob Carlborg <doob me.com> writes:
On 2014-08-24 10:53, bearophile wrote:
 Dicebot:

 In reddit thread one of commenters complained about D performance and
 linked this benchmark :
That benchmark found a small performance bug in ldc2, that I reported, but I think it's not yet fixed.
The numbers in the benchmark has just been updated. DMD is behind C. GDC is the fastest of all and LDC is ahead of Clang but behind GCC. Seems pretty good to me. -- /Jacob Carlborg
Aug 24 2014
next sibling parent "Kagamin" <spam here.lot> writes:
On Sunday, 24 August 2014 at 09:24:55 UTC, Jacob Carlborg wrote:
 The numbers in the benchmark has just been updated. DMD is 
 behind C. GDC is the fastest of all and LDC is ahead of Clang 
 but behind GCC. Seems pretty good to me.
D and C versions use different random number generators.
Aug 24 2014
prev sibling parent reply "Mike" <none none.com> writes:
On Sunday, 24 August 2014 at 09:24:55 UTC, Jacob Carlborg wrote:
 On 2014-08-24 10:53, bearophile wrote:
 Dicebot:

 In reddit thread one of commenters complained about D 
 performance and
 linked this benchmark :
That benchmark found a small performance bug in ldc2, that I reported, but I think it's not yet fixed.
The numbers in the benchmark has just been updated. DMD is behind C. GDC is the fastest of all and LDC is ahead of Clang but behind GCC. Seems pretty good to me.
I did some analysis to find out which changes made the difference. Here's my result. 1. Disabling the GC - insignificant 2. Liberal use of `immutable` - insignificant 3. Decorating functions with trusted, safe, nothrow, pure - insignificant 4. Using C's random number generator for both D and C - insignificant 5. Using C's floor instead of D's floor. - very significant (why?) 6. This change (https://github.com/nsf/pnoise/commit/baadfe20c7ae6aa900cb0e4188aa9d20bea95918) - very significant. Mike
Aug 24 2014
next sibling parent ketmar via Digitalmars-d-announce <digitalmars-d-announce puremagic.com> writes:
On Sun, 24 Aug 2014 12:51:10 +0000
Mike via Digitalmars-d-announce <digitalmars-d-announce puremagic.com>
wrote:

 5. Using C's floor instead of D's floor. - very significant (why?)
gcc/clang inlines floorf(). gdc generates calls to floor() in both cases, C floor() is just faster. i.e. gdc fails to see that floor() can be converted to intrinsic. the same thing with DMD i believe.
Aug 24 2014
prev sibling next sibling parent reply ketmar via Digitalmars-d-announce <digitalmars-d-announce puremagic.com> writes:
On Sun, 24 Aug 2014 12:51:10 +0000
Mike via Digitalmars-d-announce <digitalmars-d-announce puremagic.com>
wrote:

ps.
 6. This change=20
 (https://github.com/nsf/pnoise/commit/baadfe20c7ae6aa900cb0e4188aa9d20bea=
95918)=20 with GDC has no effect at all.
Aug 24 2014
parent reply "Mike" <none none.com> writes:
On Sunday, 24 August 2014 at 13:13:58 UTC, ketmar via 
Digitalmars-d-announce wrote:
 On Sun, 24 Aug 2014 12:51:10 +0000
 Mike via Digitalmars-d-announce 
 <digitalmars-d-announce puremagic.com>
 wrote:

 ps.
 6. This change 
 (https://github.com/nsf/pnoise/commit/baadfe20c7ae6aa900cb0e4188aa9d20bea95918)
with GDC has no effect at all.
If I undo all of Edmund Smith's changes from today, use C's floor, and remove all the excessive function attributes, I get this http://dpaste.dzfl.pl/1b564efb423e === gcc -O3: 0.141484117 seconds time === D (dmd): 0.446634464 seconds time === D (ldc2): 0.191059330 seconds time === D (gdc): 0.226455762 seconds time Then I add change only #6 above, and remove the excessive function attributes, I get this: http://dpaste.dzfl.pl/f525adab909c === gcc -O3: 0.137815809 seconds time === D (dmd): 0.480525196 seconds time === D (ldc2): 0.139659135 seconds time === D (gdc): 0.131637220 seconds time Approaching twice as fast for GDC. That's significant to me. Also, all those optimization flags should already be on with -O3. Here are the flags I'm using: gcc -std=c99 -O3 -o bin_test_c_gcc test.c -lm dmd -ofbin_test_d_dmd -O -noboundscheck -inline -release test.d ldc2 -O3 -ofbin_test_d_ldc test.d -release gdc -O3 -o bin_test_d_gdc test.d -frelease Maybe I'll make a pull request for it. I don't think users should have to decorate their code like a Christmas tree and use a bunch of special compiler flags to get a well-behaved binary. Mike
Aug 24 2014
next sibling parent "bearophile" <bearophileHUGS lycos.com> writes:
Mike:

 Then I add change only #6 above, and remove the excessive 
 function attributes,
 Maybe I'll make a pull request for it.  I don't think users 
 should have to decorate their code like a Christmas tree
I don't agree, function attributes are not excessive, they are idiomatic in D. Bye, bearophile
Aug 24 2014
prev sibling next sibling parent ketmar via Digitalmars-d-announce <digitalmars-d-announce puremagic.com> writes:
On Sun, 24 Aug 2014 13:44:07 +0000
Mike via Digitalmars-d-announce <digitalmars-d-announce puremagic.com>
wrote:

hm. for my "GDC 4.9.1. git HEAD" #6 has no effect at all.

p.s. it's unfair to specify "-msse3 -mfpmath=3Dsse" for gcc and not for
gdc. gdc can use this flags too! (yeah, the effect is great: sse3
variant is ~2.5 times faster).
Aug 24 2014
prev sibling parent reply ketmar via Digitalmars-d-announce <digitalmars-d-announce puremagic.com> writes:
On Sun, 24 Aug 2014 13:44:07 +0000
Mike via Digitalmars-d-announce <digitalmars-d-announce puremagic.com>
wrote:

p.s. what i did is this:

  auto tm =3D Timer();
  tm.start;
  foreach (; 0..100) {
    auto n2d =3D Noise2DContext(0);
    foreach (i; 0..100) {
      foreach (y; 0..256) {
        foreach (x; 0..256) {
          auto v =3D n2d.get(x * 0.1f, y * 0.1f) *
            0.5f + 0.5f;
          pixels[y*256+x] =3D v;
        }
      }
    }
  }
  tm.stop;
  writeln(tm.toString);

Timer is my simple timer class which uses MonoTime to measure intervals.
this shows ~22 seconds for both variants, with #6 and without #6.

and 57 seconds for variants without sse3 flags. ;-)
Aug 24 2014
parent reply "Mike" <none none.com> writes:
On Sunday, 24 August 2014 at 14:04:22 UTC, ketmar via 
Digitalmars-d-announce wrote:
 On Sun, 24 Aug 2014 13:44:07 +0000
 Mike via Digitalmars-d-announce 
 <digitalmars-d-announce puremagic.com>
 wrote:

 p.s. what i did is this:

   auto tm = Timer();
   tm.start;
   foreach (; 0..100) {
     auto n2d = Noise2DContext(0);
     foreach (i; 0..100) {
       foreach (y; 0..256) {
         foreach (x; 0..256) {
           auto v = n2d.get(x * 0.1f, y * 0.1f) *
             0.5f + 0.5f;
           pixels[y*256+x] = v;
         }
       }
     }
   }
   tm.stop;
   writeln(tm.toString);

 Timer is my simple timer class which uses MonoTime to measure 
 intervals.
 this shows ~22 seconds for both variants, with #6 and without 
 #6.

 and 57 seconds for variants without sse3 flags. ;-)
I'm guessing the dependency is probably due to our configure/build of GDC. I'm using Arch Linux 64's default GDC from their repository. Perhaps it's configured in a way that has these optimizations on by default. It probably should. Mike
Aug 24 2014
next sibling parent "Mike" <none none.com> writes:
On Sunday, 24 August 2014 at 14:09:03 UTC, Mike wrote:
 I'm guessing the dependency is probably due to our 
 configure/build of GDC.  I'm using Arch Linux 64's default GDC 
 from their repository.  Perhaps it's configured in a way that 
 has these optimizations on by default.  It probably should.
"dependency" --> "discrepancy"
Aug 24 2014
prev sibling parent ketmar via Digitalmars-d-announce <digitalmars-d-announce puremagic.com> writes:
On Sun, 24 Aug 2014 14:09:02 +0000
Mike via Digitalmars-d-announce <digitalmars-d-announce puremagic.com>
wrote:

 64's default GDC
i think that 64-bit gcc/gdc turns sse optimisations on anyway, 'cause there is no x86_64-capable CPUs without sse. and i'm on x86 arch.
Aug 24 2014
prev sibling next sibling parent Iain Buclaw via Digitalmars-d-announce writes:
On 24 Aug 2014 14:09, "ketmar via Digitalmars-d-announce" <
digitalmars-d-announce puremagic.com> wrote:
 On Sun, 24 Aug 2014 12:51:10 +0000
 Mike via Digitalmars-d-announce <digitalmars-d-announce puremagic.com>
 wrote:

 5. Using C's floor instead of D's floor. - very significant (why?)
gcc/clang inlines floorf(). gdc generates calls to floor() in both cases, C floor() is just faster. i.e. gdc fails to see that floor() can be converted to intrinsic. the same thing with DMD i believe.
That's because floor isn't an intrinsic. The crippling speed issue was the fact that floor computed and returned at real precision. On recent (sandybridge?) CPU's, it was found that x87 does more ill than good. So I changed it to a template in Phobos (and did some nice tidy ups in the process). This will be pulled down in the 2.066 merge. Speed improvements were discussed in the PR and in the original pnoise thread. Though it's very likely that a hand optimised SSE3 assembly implementation in C's mathlib might still be faster. Iain.
Aug 24 2014
prev sibling next sibling parent ketmar via Digitalmars-d-announce <digitalmars-d-announce puremagic.com> writes:
On Sun, 24 Aug 2014 16:16:43 +0100
Iain Buclaw via Digitalmars-d-announce
<digitalmars-d-announce puremagic.com> wrote:

 That's because floor isn't an intrinsic.  The crippling speed issue
 was the fact that floor computed and returned at real precision.
i'm testing on x86, and the difference between 'call floorf' and inlining is significant. gcc inlines floorf() call, and gdc does not. i don't know anything about x86_64 though.
Aug 24 2014
prev sibling parent Iain Buclaw via Digitalmars-d-announce writes:
On 24 Aug 2014 16:26, "ketmar via Digitalmars-d-announce" <
digitalmars-d-announce puremagic.com> wrote:
 On Sun, 24 Aug 2014 16:16:43 +0100
 Iain Buclaw via Digitalmars-d-announce
 <digitalmars-d-announce puremagic.com> wrote:

 That's because floor isn't an intrinsic.  The crippling speed issue
 was the fact that floor computed and returned at real precision.
i'm testing on x86, and the difference between 'call floorf' and inlining is significant. gcc inlines floorf() call, and gdc does not.
Inline is not quite correct. Floor is a function recognised by the compiler, so if the backend knows an instruction for it, it will favour that intrinsic over calling an external function. Iain
Aug 24 2014