November 26, 2008
On Tue, 25 Nov 2008 19:31:25 -0500
bearophile <bearophileHUGS@lycos.com> wrote:

> 1.037 compiles my dlibs fine :-) And with no other increase of exe size.

I compiled dwtx.lib by DMD 1.037, the exe size bloat from 4.3 MB to 10.6 MB

-- 
yidabu <yidabu.spam@gmail.com> http://www.dsource.org/projects/dwin

D 语言-中文(D Chinese): http://www.d-programming-language-china.org/ http://bbs.d-programming-language-china.org/ http://dwin.d-programming-language-china.org/ http://scite4d.d-programming-language-china.org/


November 26, 2008
"Walter Bright" <newshound1@digitalmars.com> wrote in message news:gghtrk$65d$1@digitalmars.com...
>
> http://www.digitalmars.com/d/1.0/changelog.html
> http://ftp.digitalmars.com/dmd.1.037.zip
>
>
>
> http://www.digitalmars.com/d/2.0/changelog.html
> http://ftp.digitalmars.com/dmd.2.021.zip
>

Nice update!

The 2.021.zip contains a folder dmd/src/runtime and dmd/src/druntime.. Is one of them obsolete? Which one?

L. 

November 26, 2008
On Wed, 26 Nov 2008 17:24:03 +1300, yidabu <yidabu.spam@gmail.com> wrote:

> On Tue, 25 Nov 2008 19:31:25 -0500
> bearophile <bearophileHUGS@lycos.com> wrote:
>
>> 1.037 compiles my dlibs fine :-) And with no other increase of exe size.
>
> I compiled dwtx.lib by DMD 1.037, the exe size bloat from 4.3 MB to 10.6 MB
>

Is that 4.3M compiled with dwt aswell? Do you mean that just dmd update alone caused it to grow to 10.6M?
November 26, 2008
On Wed, 26 Nov 2008 19:14:26 +1300
"Tim M" <a@b.com> wrote:

> On Wed, 26 Nov 2008 17:24:03 +1300, yidabu <yidabu.spam@gmail.com> wrote:
> 
> > On Tue, 25 Nov 2008 19:31:25 -0500
> > bearophile <bearophileHUGS@lycos.com> wrote:
> >
> >> 1.037 compiles my dlibs fine :-) And with no other increase of exe size.
> >
> > I compiled dwtx.lib by DMD 1.037, the exe size bloat from 4.3 MB to 10.6 MB
> >
> 
> Is that 4.3M compiled with dwt aswell? Do you mean that just dmd update alone caused it to grow to 10.6M?

4.3 M compiled with dwtx.lib(by dsss 0.75)

dmd ...1.035, 1.036, 1.037 builded dwt or dwtx static library causes exe grow to 10.6 MB.


steps to build static library:

1. create file: dwtx_static, content:

-release
-O
-version=TANGOSVN
-JD:\dwt-addons\res
-JD:\dwt-samples\res
-JD:\dwt-win\res
-lib
-ofdwtx.lib
dwtx\core\commands\AbstractParameterValueConverter.d
dwtx\core\commands\CategoryEvent.d
dwtx\core\commands\CommandEvent.d
...

2. run command:
dmd @dwtx_static






-- 
yidabu <yidabu.spam@gmail.com> http://www.dsource.org/projects/dwin

D 语言-中文(D Chinese): http://www.d-programming-language-china.org/ http://bbs.d-programming-language-china.org/ http://dwin.d-programming-language-china.org/ http://scite4d.d-programming-language-china.org/


November 26, 2008
Lionello Lunesu wrote:
> The 2.021.zip contains a folder dmd/src/runtime and dmd/src/druntime.. Is one of them obsolete? Which one?

runtime is the correct one. Delete the druntime one.
November 26, 2008
Derek Parnell:
> An update to the Bugzilla 313 issue...
> It appears that it is fixed only with respect to accessing routines but not
> fixed when accessing variables.

The important thing is that there's movement still. Because as long as the compiler keeps moving forward, there's hope that eventually all or most of the bad holes in the current type system will be fixed :-)

A request to fill another small hole: this line of code:
import foo;
has to import the module name "foo" in the current namespace. While this other line:
import foo: bar;
Has to import the "bar" name in the current namespace, but not the "foo" name.
This makes things more clean, and for example allows to have the name "foo" inside the module "foo" with no risk of name clash inside the head of the programmer.

Bye,
bearophile
November 26, 2008
Walter Bright wrote:

> http://www.digitalmars.com/d/2.0/changelog.html http://ftp.digitalmars.com/dmd.2.021.zip

It is nice that there is now a way to have non-heap-allocating delegates, but it is bad that it is a breaking change (in terms of D1 vs D2).

But how does it work? If I have

foo(scope void delegate()) { }

will then

foo({ ... });

not allocate?

-- 
Lars Ivar Igesund
blog at http://larsivi.net
DSource, #d.tango & #D: larsivi
Dancing the Tango
November 26, 2008
To test the new scoping features of D 2.021 I have used a small stressing program, coming from this page, originally by Knuth:

http://www.rosettacode.org/wiki/Man_or_boy_test

More info:
http://en.wikipedia.org/wiki/Man_or_boy_test

My purpose is to see the D2 compiler being able to compute results up to N=25 on my PC (that has 2 GB RAM and a 32 bit operating system).

---------------------------

This is the code I have used for DMD 1.037:

import std.c.stdio: printf;

int a(int k, lazy int x1, lazy int x2, lazy int x3, lazy int x4, lazy int x5) {
    int delegate() b;
    b = {
        k -= 1;
        return a(k, b(), x1, x2, x3, x4);
    };
    return k <= 0 ? x4 + x5 : b();
}

void main() {
    printf("%d\n", a(15, 1, -1, -1, 1, 0)); // N is 15
}

---------------------------

This is the code I have used for DMD 2.021. I was not sure how to use the scope, so if you have improvements please tell me:

import std.c.stdio: printf;

int a(scope int k, lazy int x1, lazy int x2, lazy int x3, lazy int x4, lazy int x5) {
    scope int delegate() b;
    b = {
        k -= 1;
        return a(k, b(), x1, x2, x3, x4);
    };
    return k <= 0 ? x4 + x5 : b();
}

void main() {
    printf("%d\n", a(15, 1, -1, -1, 1, 0)); // N is 15
}

---------------------------

The results for higher values of N are:
k   21           22            23         24          25
A   -389695     -865609     -1922362    -4268854    -9479595

In both cases I have compiled the code with:
dmd -O -release -inline -L/STACK:1700000000 man_or_boy.d

The results:

DMD V.1.037 (exe: 168_476: bytes):
  N=24:  788 MB RAM, 3 seconds
  N=25: 1.57 GB RAM, 6.42 seconds

DMD V.2.021 (exe: 99_356 bytes):

The code was too much slow in D2, so I have stopped it. Do you know if the D2 code can be improved to have performance similar to D1 ones?

Bye,
bearophile
November 26, 2008
bearophile Wrote:

> - What is module(system) Identifier; syntax?
I think, module(safe) was meant, docs mention module(safe).

> - Added range support to foreach statement. What is this?
Good question, because what is called foreach range statement was implemented long ago.

> - >The 'this' parameter to struct member functions is now a reference type,< I know this was discussed, but how does this change code? Does this forces to change C code when it is ported to D? How to do such porting? Few examples of situations may be useful.

I'm affraid, this breaks my resource parser

struct ResourceTable
{
	ushort Shift; //alignment shift count
	ResourceType* FirstType()
	{
		return cast(ResourceType*)(this+1);
	}
}
November 26, 2008
On Wed, Nov 26, 2008 at 7:34 AM, bearophile <bearophileHUGS@lycos.com> wrote:
> This is the code I have used for DMD 2.021. I was not sure how to use the scope, so if you have improvements please tell me:
>
> import std.c.stdio: printf;
>
> int a(scope int k, lazy int x1, lazy int x2, lazy int x3, lazy int x4, lazy int x5) {
>    scope int delegate() b;
>    b = {
>        k -= 1;
>        return a(k, b(), x1, x2, x3, x4);
>    };
>    return k <= 0 ? x4 + x5 : b();
> }
>
> The code was too much slow in D2, so I have stopped it. Do you know if the D2 code can be improved to have performance similar to D1 ones?

Can you try declaring b as a nested function instead of as a delegate literal and see if that helps?  (why are you declaring it the way you are, anyway?