5 SLOC of openssh portable vs. xs
Russtopia edited this page 2023-10-17 00:02:55 -07:00

A comparison of the total code complexity of xs versus openssh-portable

Mostly for my own interest, but a concrete illustration that Golang has a very good net and crypto library and higher-level array/slice handling for buffers and strings than C, which simplifies code immensely and is also hopefully more secure :p

TODO: Add func count/cyclo metrics comparisons

$ sloc openssh-portable 
  Languages  Files    Code  Comment  Blank   Total  CodeLns
      Total    502  112982    14327  15705  143014   100.0%
          C    389  105938    13349  14416  133703    93.5%
      Shell     92    6118      937   1129    8184     5.7%
       Make     16     468       37    131     636     0.4%
        AWK      1     363        0      7     370     0.3%
        C++      3      79        4     18     101     0.1%
       Conf      1      16        0      4      20     0.0%
$ sloc xs
  Language  Files  Code  Comment  Blank  Total
     Total     36  4804     1351    930   6823
        Go     23  4348     1298    764   6149
  Markdown      2   206        0     86    292
      Make      7   155        6     52    213
     Shell      4    95       47     28    169