REIMAGINE: Designing files structure for a SSG (C#)
by Andrew N.T.
Photo by Louis Reed
This is the sequence of Designing files structure for a SSG (Rust)
Table of Contents
With the additional request for parsing Markdown,
paper C# implementation removed the
SourceFile class and implemented different class for each type (i.e.
Template is 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.
Separation of file types
Separating the old
TextFile also help organize the methods used by different file types.
C# vs Rust
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.
Originally posted at https://andrewnt.dev/reimagine-designing-files-structure-for-a-ssg-c