This is the sequence of Designing files structure for a SSG (Rust)
With the additional request for parsing Markdown,
paperC# implementation removed the
SourceFileclass and implemented different class for each type (i.e.
Templateis named more concisely as
HtmlFile. Anything that genereate
TextFile.Parse()can convert the result to .html using
HtmlFile.Parse(). This removes the reduntdant of html parsing logic, and can easily supports and future file types.
Separating the old
TextFilealso help organize the methods used by different file types.
Coding in C# certainly has less overhead to worry about (e.g. memory management), but Rust is undoubtedly more performant. As a fun experiment, I had an input directory like this
The logic for both implemenetation are identical, but C# took ~5 seconds to generate the output. Meanwhile, Rust was ~1 second. Mind blowing.