Continuing the logical progression from A Fortran formatter written in Fortran, i present fdoc, a drop-in replacement for FORD, written completely in Fortran.
Here are the dependencies (all compiled via FPM):
Fdoc depends on fformat to do the actual Fortran parsing/tokenization. Fdot is another new library, a port of just the parts of Graphviz that we need, so we don’t have the overhead of calling an external dependency for the graphs either. Fdoc also understands fypp, so we don’t need Python to do the preprocessing either (note: I’ve only ported the parts used by stdlib, so there is room for improvement there probably). Finally, OpenMP-based parallelization is used to speed up the entire process (parsing files, preprocessing, generating graphs, etc.)
Example output can be seen here.
The speed comparison is staggering. This table shows the time to generate each project’s documentation, using the project’s own settings (i.e., from the the ford.md file):
| Project | Lines | FORD | fdoc | Speedup |
|---|---|---|---|---|
| fformat | 6,902 | 27.1 s | 0.1 s | 226× |
| bspline-fortran | 13,222 | 22.8 s | 0.1 s | 163× |
| rklib | 17,025 | 62.3 s | 0.2 s | 271× |
| json-fortran | 17,715 | 64.5 s | 0.6 s | 115× |
| Fortran-Astrodynamics-Toolkit | 25,174 | 60.3 s | 0.2 s | 274× |
| qt-fortran | 25,831 | 314 s | 0.9 s | 338× |
| stdlib | 614,270 | 680 s | 2.3 s | 297× |
So no Python needed at all, orders of magnitude faster!
