Optimization ???
Orvid King
blah38621 at gmail.com
Fri Feb 21 05:38:54 PST 2014
The single biggest reason that this is slower in D than in C# is
because of the GC. By default with MS.Net, and Mono (when compiled
with sgen) an allocation is almost literally just a bump-the-pointer,
with an occasional scan (no compaction for this code) and collection
of the 64kb (on MS.Net it actually the size of your CPU's L1 cache)
gen0 heap. This particular code is unlikely to trigger a collection of
gen1 (L2 cache when on MS.Net), gen2 or the large object heap. In D
however, the allocations are significantly more expensive.
On 2/21/14, John Colvin <john.loughran.colvin at gmail.com> wrote:
> On Friday, 21 February 2014 at 09:29:42 UTC, Mattdef wrote:
>> Thanks for yours replies.
>>
>> I know it is the conversion of uint that is the problem but my
>> C#
>> code has the same conversion. So C# is better than D for string
>> conversions ?
>>
>> (sorry for my english)
>
> It's quite possible that C# has faster string conversion in at
> least some cases.
>
> In particular, making lots of small strings is very garbage heavy
> and the D garbage collector isn't as sophisticated as the one in
> C#
>
More information about the Digitalmars-d-learn
mailing list