Coding Challenges - Dlang or Generic
Siarhei Siamashka
siarhei.siamashka at gmail.com
Thu Jan 19 02:42:47 UTC 2023
On Wednesday, 18 January 2023 at 11:10:01 UTC, matheus wrote:
> On Wednesday, 18 January 2023 at 01:05:58 UTC, Siarhei
> Siamashka wrote:
>> On Tuesday, 17 January 2023 at 23:27:03 UTC, matheus wrote:
>>> I ran in two sites: https://onecompiler.com/d and then
>>> https://godbolt.org/, with the latter I set LDC with -O2.
>>>
>>> My version (Source in the end) ran about 2x faster than the
>>> version with ranges.
>>
>> Well, the use of ranges is not the only difference.
>> ...
>
> What are the other differences?
Can't you easily see them yourself? For example, the
https://github.com/quickfur/dcal/blob/master/dcal.d
implementation uses
https://dlang.org/library/std/format/format.html but I don't see
it in your code. And this is not the only difference. Your code
even doesn't produce the same output.
> Just remember what I said above:
>
>> I ran my version against the one with ranges (From:
>> https://github.com/quickfur/dcal/blob/master/dcal.d), and I
>> modified to just print the calendar for some year.
>
> Again I ran both versions with/without ranges only generating
> and printing the months.
You are comparing two completely different implementations. If
you wanted to specifically measure the overhead of using ranges,
then you could just remove them without changing how the
std.datetime api calls are done and how strings are formatted.
More information about the Digitalmars-d-learn
mailing list