My AoC program in D is just as fast as in Python
user1234
user1234 at 12.de
Mon Nov 24 15:49:48 UTC 2025
On Monday, 24 November 2025 at 14:37:22 UTC, Jabba Laci wrote:
> I implemented [Advent of Code 2015, Day 6, Part
> 1](https://adventofcode.com/2015/day/6) in D. The code is here:
> https://github.com/jabbalaci/AdventOfCode2015/tree/main/day06/d/part1 . It runs for 3 seconds. I found it a bit much, so I also wrote it in Python. To my surprise, the Python program also ran for 3 seconds. I expected that the D program should be much faster.
>
> [...]
There are many things to say but first of all, check what is a
`final switch`.
```d
final switch (option){
case Option.off, Option.on: { ... }
case Option.toggle: { ... }
}
```
I dont say perfs will be better, it's more a matter of style.
More information about the Digitalmars-d-learn
mailing list