The D Language: A sweet-spot between Python and C

Laeeth Isharc via Digitalmars-d digitalmars-d at puremagic.com
Sun Mar 29 22:43:15 PDT 2015


On Monday, 30 March 2015 at 05:04:57 UTC, Rikki Cattermole wrote:
> On 30/03/2015 5:48 p.m., weaselcat wrote:
>> On Monday, 30 March 2015 at 04:35:44 UTC, Rikki Cattermole 
>> wrote:
>>> On 30/03/2015 5:25 p.m., Laeeth Isharc wrote:
>>>> On Monday, 30 March 2015 at 04:16:38 UTC, weaselcat wrote:
>>>>> On Monday, 30 March 2015 at 00:57:06 UTC, Walter Bright 
>>>>> wrote:
>>>>>> http://blog.experimentalworks.net/2015/01/the-d-language-a-sweet-spot-between-python-and-c/
>>>>>>
>>>>>>
>>>>>>
>>>>>> Reddit:
>>>>>> https://www.reddit.com/r/programming/comments/30qqck/the_d_language_a_sweetspot_between_python_and_c/
>>>>>>
>>>>>>
>>>>>
>>>>> a lot of the people in the thread are unaware that D even 
>>>>> has RAII
>>>>> like C++, and think it's just a GC language like java/etc. 
>>>>> Maybe this
>>>>> is something worth mentioning more on the introduction?
>>>>
>>>> Also, there is a perception that you can't  use the standard 
>>>> library and
>>>> nicer language features if you do your own allocation and 
>>>> don't depend
>>>> on the GC.  A guy worrying about hygiene problems mixing GC 
>>>> and Raii
>>>> libraries.  Whereas most garbage is small and fine to use GC 
>>>> for in some
>>>> applications - only a subset of real time applications 
>>>> suffer from
>>>> generating gazillions of tiny objects.  It would be good to 
>>>> set out
>>>> somewhere what you lose as regards std library by insisting 
>>>> on using
>>>> nogc.  The point about std.algorithm should be made more 
>>>> prominent.
>>>
>>> I'm currently working on the forcing GC cleanup mechanism for 
>>> my web
>>> server. I would like to add, that post GC disabled it can be 
>>> forced to
>>> do a cleanup.
>>>
>>> But I would go a step further, do a force minimize of memory 
>>> back to
>>> the OS and reserve e.g. 32mb. Really what would be nice is a,
>>> reserveMax function that and anything else is free'd back to 
>>> the OS.
>>>
>>> The reserve, means that even if you are sloppy and end up 
>>> using the GC
>>> in critical code, it won't matter. The memory is already 
>>> allocated.
>>> Cleaning up can happen during non critical times. After all, 
>>> if you
>>> are using more then e.g. 32mb in critical code, you are doing
>>> something wrong.
>>
>>
>> I actually use D for a pet project of mine(a game! ;) ) and 
>> this is what
>> I do. I leave the GC disabled and essentially just use it as a 
>> free
>> store(while not haphazardly abusing it,) and just manually 
>> clean it
>> during opportune times.
>>
>> It's also better to have a single pause for a large cleanup 
>> than many
>> small pauses, the overhead of actually scanning the memory 
>> will kill you.
>
> Atleast with web servers, a whole bunch of pauses can't be 
> dealt with. But one large one, can easily be via load balances.

How about we (ie you, the language expert!) jot down a few more 
points  to later turn into a short but useful article on how to 
deal with the GC in practical  situations?


More information about the Digitalmars-d mailing list