December 04, 2013 Re: About compiler memory consumption | ||||
---|---|---|---|---|
| ||||
Posted in reply to Puming | On Wednesday, 4 December 2013 at 16:44:14 UTC, Puming wrote:
> Thanks, I'll try that :) are there docs about how to use phobos as a shared lib?
$ cat test.d
import std.stdio;
void main()
{
writeln("Hello");
}
$ dmd test.d -defaultlib=libphobos2.so
$ ls -lah test
-rwxr-xr-x 1 dicebot users 26K Dec 4 17:51 test
$ ldd test
linux-vdso.so.1 (0x00007fffc82e7000)
libphobos2.so.0.64 => /usr/lib/libphobos2.so.0.64 (0x00007ffd253e0000)
libpthread.so.0 => /usr/lib/libpthread.so.0 (0x00007ffd251c2000)
libm.so.6 => /usr/lib/libm.so.6 (0x00007ffd24ebf000)
librt.so.1 => /usr/lib/librt.so.1 (0x00007ffd24cb7000)
libc.so.6 => /usr/lib/libc.so.6 (0x00007ffd2490c000)
libdl.so.2 => /usr/lib/libdl.so.2 (0x00007ffd24708000)
libcurl.so.4 => /usr/lib/libcurl.so.4 (0x00007ffd244a3000)
/lib64/ld-linux-x86-64.so.2 (0x00007ffd25a4e000)
libssh2.so.1 => /usr/lib/libssh2.so.1 (0x00007ffd2427a000)
libssl.so.1.0.0 => /usr/lib/libssl.so.1.0.0 (0x00007ffd2400d000)
libcrypto.so.1.0.0 => /usr/lib/libcrypto.so.1.0.0 (0x00007ffd23c05000)
libz.so.1 => /usr/lib/libz.so.1 (0x00007ffd239ef000)
(from my Arch Linux x64 box)
|
December 04, 2013 Re: About compiler memory consumption | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dicebot | On Wed, Dec 04, 2013 at 05:28:06PM +0100, Dicebot wrote: > While in general one may expect CTFE/template memory consumption to drop considerably, in vibe.d case it is unlikely to make that much of an impact. vibe.d does really lot of computations during compile-time, for example, all Diet templates get loaded and processed during that phase. I can't imagine optimizations that will make possible to fit compilation of any vibe.d project of notable size in 512Mb memory. To be honest, I'd hate to do any DMD + vibe.d development on anything less than 4Gb of RAM. Even without vibe.d, dmd eats way too much memory to be usable on a machine with 512MB RAM. I was quite disappointed to discover this when I tried running dmd on a not-that-old machine with 512MB RAM (aka my office PC), and every time it would soak up all available RAM, force my browser (and probably significant parts of X11) to swap out, making the PC generally unresponsive for several seconds, before the dmd process exits and everything goes back to normal. For all of the good points of D and dmd's compile speeds, the one thing I can't recommend dmd for is efficient memory usage, sad to say. Of course, on a machine with more available RAM, dmd runs at lightning speed, so that at least is a redeeming quality. T -- Guns don't kill people. Bullets do. |
December 04, 2013 Re: About compiler memory consumption | ||||
---|---|---|---|---|
| ||||
Posted in reply to H. S. Teoh | On Wednesday, 4 December 2013 at 17:46:40 UTC, H. S. Teoh wrote:
> Even without vibe.d, dmd eats way too much memory to be usable on a
> machine with 512MB RAM. I was quite disappointed to discover this when I
> tried running dmd on a not-that-old machine with 512MB RAM (aka my
> office PC), and every time it would soak up all available RAM, force my
> browser (and probably significant parts of X11) to swap out, making the
> PC generally unresponsive for several seconds, before the dmd process
> exits and everything goes back to normal.
Heh, that was reason why I was forced to reconsider from setting up a CI suite on my 1Gb-worth VPS :) There are some live projects that require 2.5-3 Gb for routine build.
|
December 04, 2013 Re: About compiler memory consumption | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dicebot | I want to note though that when it comes to template instance bloat which is one of huge memory consumers it is quite possible to design compiler in a much more efficient way, possibly with minor change to language spec. |
December 04, 2013 Re: About compiler memory consumption | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dicebot | On Wed, Dec 04, 2013 at 06:55:35PM +0100, Dicebot wrote: > I want to note though that when it comes to template instance bloat which is one of huge memory consumers it is quite possible to design compiler in a much more efficient way, possibly with minor change to language spec. I'm pretty sure there's a lot of room for optimization in dmd when it comes to handling templates. If only I had the time to dig into the dmd source code... T -- Why are you blatanly misspelling "blatant"? -- Branden Robinson |
December 04, 2013 Re: About compiler memory consumption | ||||
---|---|---|---|---|
| ||||
Posted in reply to H. S. Teoh | On Wednesday, 4 December 2013 at 18:20:36 UTC, H. S. Teoh wrote:
> I'm pretty sure there's a lot of room for optimization in dmd when it
> comes to handling templates. If only I had the time to dig into the dmd
> source code...
I have wasted ~3 months on digging this with no success. And when Walter has finally paid attention to this issue and changed template instance emitting algorithm, I still was hardly able to understand why exactly the changes in pull were necessary to get that result.
Just be warned ;)
|
December 04, 2013 Re: About compiler memory consumption | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dicebot | On Wed, Dec 04, 2013 at 07:22:45PM +0100, Dicebot wrote: > On Wednesday, 4 December 2013 at 18:20:36 UTC, H. S. Teoh wrote: > >I'm pretty sure there's a lot of room for optimization in dmd when it comes to handling templates. If only I had the time to dig into the dmd source code... > > I have wasted ~3 months on digging this with no success. And when Walter has finally paid attention to this issue and changed template instance emitting algorithm, I still was hardly able to understand why exactly the changes in pull were necessary to get that result. > > Just be warned ;) Well, that's why I said I needed more time. :) I'm not expecting it to be a breeze to read through dmd code. I've actually looked into it briefly before when tracking down a compiler bug, but I've to say that in order to understand the code you need to first understand how it works at a high level (yes, it's sorta a chicken-and-egg problem), otherwise you're just looking at the trees and not seeing the forest. T -- What are you when you run out of Monet? Baroque. |
December 04, 2013 Re: About compiler memory consumption | ||||
---|---|---|---|---|
| ||||
Posted in reply to H. S. Teoh | On Wednesday, 4 December 2013 at 18:31:14 UTC, H. S. Teoh wrote:
> ...
Well I have found it to be somewhat reasonable in general but symbol emitting part is one of most arcane ones in whole compiler. Basically only few people know something about it and sometimes it feels like Walter is the only one to really knows it in details.
|
December 05, 2013 Re: About compiler memory consumption | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dicebot | Just to put my 2cents into the conversation, you could also compile vibe.d as a static library and then link against it, as that seems to be enough to keep dmd's memory using within functional limits. (I have a max of 800mb ram that I can easily allow a single program to use, otherwise I start doing a whole lotta' paging)
On 12/4/13, Dicebot <public@dicebot.lv> wrote:
> On Wednesday, 4 December 2013 at 18:31:14 UTC, H. S. Teoh wrote:
>> ...
>
> Well I have found it to be somewhat reasonable in general but symbol emitting part is one of most arcane ones in whole compiler. Basically only few people know something about it and sometimes it feels like Walter is the only one to really knows it in details.
>
|
December 05, 2013 Re: About compiler memory consumption | ||||
---|---|---|---|---|
| ||||
Posted in reply to H. S. Teoh | H. S. Teoh:
> Even without vibe.d, dmd eats way too much memory to be usable on a machine with 512MB RAM.
On Windows32 to compile the whole Phobos DMD takes about 750-850 MB. My D programs are much smaller, so usually I don't need more than 50-300 MB.
Bye,
bearophile
|
Copyright © 1999-2021 by the D Language Foundation