Welcome to Web-News
A Web-based News Reader
Subject Re: DMD 1.034 and 2.018 releases
From Dave <Dave_member@pathlink.com>
Date Mon, 11 Aug 2008 21:03:46 -0500
Newsgroups digitalmars.D.announce


"Walter Bright" <newshound1@digitalmars.com> wrote in message
news:g7na5s$qg0$1@digitalmars.com...
> bearophile wrote:
>> Walter Bright:
>>> If this happens, then it's worth verifying that the asm code is
>>> actually being run by inserting a printf in it.
>>
>> I presume I'll have to recompile Phobos for that.
>
> Not really, it's easier to just copy that particular function out of the
> library and paste it into your test module, that way it's easier to
> experiment with.
>
>>>> And I haven't seen yet SS2 asm in my compiled programs :-)
>>> The dmd compiler doesn't generate SS2 instructions. But the
>>> routines in internal\array*.d do.
>>
>> I know. I was talking about the parts of the code that for example
>> adds the arrays; according to the phobos source code they use SSE2
>> but in the final source code produces they are absent.
>
> I don't know what you mean. The SSE2 instructions are in
> internal/arrayint.d, and they do get compiled in.

The SSE2 is being used, but what would be nice would be the same code that
Burton used for his benchmarks. Is that available?

Thanks,

- Dave

import std.stdio, std.date, std.conv;

void main(string[] args)
{
    if(args.length < 3)
    {
        writefln("usage: ",args[0]," <array size> <iterations>");
        return;
    }
    auto ASIZE = toInt(args[1]);
    auto ITERS = toInt(args[2]);
    writefln("Array Size = ",ASIZE,", Iterations = ",ITERS);
    int[] ia, ib, ic;
    ia = new int[ASIZE];
    ib = new int[ASIZE];
    ic = new int[ASIZE];
    ib[] = ic[] = 10;
    double[] da, db, dc;
    da = new double[ASIZE];
    db = new double[ASIZE];
    dc = new double[ASIZE];
    db[] = dc[] = 10.0;

    {
    ia[] = 0;
    int sum = 0;
    d_time s = getUTCtime();
    for(size_t i = 0; i < ITERS; i++)
    {
        sum += aops!(int)(ia,ib,ic);
    }
    d_time e = getUTCtime();
    writefln("intaops: ",(e - s) / 1000.0," secs, sum = ",sum);
    }

    {
    ia[] = 0;
    int sum = 0;
    d_time s = getUTCtime();
    for(size_t i = 0; i < ITERS; i++)
    {
        sum += loop!(int)(ia,ib,ic);
    }
    d_time e = getUTCtime();
    writefln("intloop: ",(e - s) / 1000.0," secs, sum = ",sum);
    }

    {
    da[] = 0.0;
    double sum = 0.0;
    d_time s = getUTCtime();
    for(size_t i = 0; i < ITERS; i++)
    {
        sum += aops!(double)(da,db,dc);
    }
    d_time e = getUTCtime();
    writefln("dfpaops: ",(e - s) / 1000.0," secs, sum = ",sum);
    }

    {
    da[] = 0.0;
    double sum = 0.0;
    d_time s = getUTCtime();
    for(size_t i = 0; i < ITERS; i++)
    {
        sum += loop!(double)(da,db,dc);
    }
    d_time e = getUTCtime();
    writefln("dfploop: ",(e - s) / 1000.0," secs, sum = ",sum);
    }
}

T aops(T)(T[] a, T[] b, T[] c)
{
    a[] = b[] + c[];
    return a[$-1];
}

T loop(T)(T[] a, T[] b, T[] c)
{
    foreach(i, inout val; a) val = b[i] + c[i];
    return a[$-1];
}

C:\Zz>dmd -O -inline -release top.d

C:\Zz>top 4000 100000
Array Size = 4000, Iterations = 100000
intaops: 0.204 secs, sum = 2000000
intloop: 0.515 secs, sum = 2000000
dfpaops: 0.625 secs, sum = 2e+06
dfploop: 0.563 secs, sum = 2e+06


Recent messages in this thread
 
-# DMD 1.034 and 2.018 releases Walter Bright 08-Aug-2008 04:24 pm
.-# Re: DMD 1.034 and 2.018 releases Lars Ivar Igesund 08-Aug-2008 04:38 pm
.||# Re: DMD 1.034 and 2.018 releases Walter Bright 08-Aug-2008 05:41 pm
.|-# Re: DMD 1.034 and 2.018 releases Jarrett Billingsley 09-Aug-2008 12:36 am
.|.-# Re: DMD 1.034 and 2.018 releases Lars Ivar Igesund 09-Aug-2008 05:45 am
.|..-# Re: DMD 1.034 and 2.018 releases Walter Bright 09-Aug-2008 02:18 pm
.|...|# Re: DMD 1.034 and 2.018 releases Lars Ivar Igesund 09-Aug-2008 03:21 pm
.|...\# Re: DMD 1.034 and 2.018 releases Sean Kelly 09-Aug-2008 03:41 pm
.-# Re: DMD 1.034 and 2.018 releases dsimcha 08-Aug-2008 04:50 pm
.|\# Re: DMD 1.034 and 2.018 releases Walter Bright 08-Aug-2008 05:42 pm
.|# Re: DMD 1.034 and 2.018 releases Sean Kelly 08-Aug-2008 05:57 pm
.|# Re: DMD 1.034 and 2.018 releases Jonathan Crapuche... 08-Aug-2008 06:17 pm
.-# Re: DMD 1.034 and 2.018 releases Bill Baxter 08-Aug-2008 06:28 pm
.|-# Re: DMD 1.034 and 2.018 releases Walter Bright 08-Aug-2008 06:30 pm
.|.\# Re: DMD 1.034 and 2.018 releases Bill Baxter 09-Aug-2008 01:00 am
.|# Re: DMD 1.034 and 2.018 releases Walter Bright 08-Aug-2008 06:31 pm
.-# Re: DMD 1.034 and 2.018 releases bearophile 08-Aug-2008 08:43 pm
.|-# Re: DMD 1.034 and 2.018 releases bearophile 08-Aug-2008 08:46 pm
.||\# Re: DMD 1.034 and 2.018 releases Walter Bright 09-Aug-2008 01:44 am
.|-# Re: DMD 1.034 and 2.018 releases Walter Bright 09-Aug-2008 01:43 am
.|.|# Re: DMD 1.034 and 2.018 releases Moritz Warning 09-Aug-2008 06:53 am
.|.-# Re: DMD 1.034 and 2.018 releases bearophile 09-Aug-2008 07:45 am
.|..-# Re: DMD 1.034 and 2.018 releases bearophile 09-Aug-2008 08:26 am
.|..|-# Re: DMD 1.034 and 2.018 releases bearophile 09-Aug-2008 09:22 am
.|..||\# Re: DMD 1.034 and 2.018 releases bearophile 09-Aug-2008 11:11 am
.|..|-# Re: DMD 1.034 and 2.018 releases dsimcha 09-Aug-2008 10:46 am
.|..|||# Re: DMD 1.034 and 2.018 releases bearophile 09-Aug-2008 11:14 am
.|..||\# Re: DMD 1.034 and 2.018 releases Don 11-Aug-2008 02:57 am
.|..|-# Re: DMD 1.034 and 2.018 releases Walter Bright 09-Aug-2008 02:24 pm
.|..||-# Re: DMD 1.034 and 2.018 releases bearophile 09-Aug-2008 02:45 pm
.|..||.-# Re: DMD 1.034 and 2.018 releases Walter Bright 10-Aug-2008 02:54 am
.|..||..-# Re: DMD 1.034 and 2.018 releases bearophile 10-Aug-2008 07:45 am
.|..||...-# Re: DMD 1.034 and 2.018 releases Walter Bright 10-Aug-2008 01:57 pm
.|..||....-# Re: DMD 1.034 and 2.018 releases (Current message) Dave 11-Aug-2008 10:03 pm
.|..||.....\# Re: DMD 1.034 and 2.018 releases - Let the games begin! Dave 12-Aug-2008 12:17 am
.|..|\# Re: DMD 1.034 and 2.018 releases Walter Bright 10-Aug-2008 03:26 am
.|..\# Re: DMD 1.034 and 2.018 releases Walter Bright 09-Aug-2008 02:25 pm
.-# Re: DMD 1.034 and 2.018 releases Michael P. 08-Aug-2008 08:43 pm
.|-# Re: DMD 1.034 and 2.018 releases bearophile 08-Aug-2008 08:47 pm
.|.\# Re: DMD 1.034 and 2.018 releases Michael P. 08-Aug-2008 09:05 pm
.-# Re: DMD 1.034 and 2.018 releases JAnderson 09-Aug-2008 02:47 am
.|\# Re: DMD 1.034 and 2.018 releases Walter Bright 09-Aug-2008 03:39 am
.-# Re: DMD 1.034 and 2.018 releases Craig Black 09-Aug-2008 08:30 pm
.|\# Re: DMD 1.034 and 2.018 releases bearophile 09-Aug-2008 09:03 pm
.-# Re: DMD 1.034 and 2.018 releases Don 10-Aug-2008 10:27 am
.|\# Re: DMD 1.034 and 2.018 releases Walter Bright 10-Aug-2008 01:57 pm
.\# Re: DMD 1.034 and 2.018 releases Don 14-Aug-2008 09:20 am