miloyip / nativejson-benchmark

C/C++ JSON parser/generator benchmark
MIT License
1.95k stars 262 forks source link

I have a doubt about code size in this benchmark. #117

Closed dota17 closed 5 years ago

dota17 commented 5 years ago

I use cloc to count code size. Here are some results:

 # cloc jsoncpp/
     221 text files.
     216 unique files.
      76 files ignored.

http://cloc.sourceforge.net v 1.64  T=0.42 s (347.0 files/s, 33493.1 lines/s)
-------------------------------------------------------------------------------
Language                     files          blank        comment           code
-------------------------------------------------------------------------------
C++                              6            844            444           7033
C/C++ Header                    13            365            895           1332
Python                          14            171            338           1328
JSON                            94             27              0            312
CMake                            7             59             86            284
Bourne Shell                     6             35             49            154
NAnt script                      1             12              0            103
YAML                             2              5             21             77
HTML                             2              2             16             67
make                             1              5              6             24
-------------------------------------------------------------------------------
SUM:                           146           1525           1855          10714
-------------------------------------------------------------------------------
# cloc rapidjson/
     282 text files.
     266 unique files.
      78 files ignored.

http://cloc.sourceforge.net v 1.64  T=0.73 s (280.9 files/s, 61032.7 lines/s)
-------------------------------------------------------------------------------
Language                     files          blank        comment           code
-------------------------------------------------------------------------------
C++                             51           2341           1198          13836
C/C++ Header                    39           2526           3281          11184
JSON                            97              6              0           8629
CMake                            7             75             25            364
CSS                              1             39              2            233
Python                           1             46             12            225
XML                              1              5              7            182
YAML                             3             11             10            136
Bourne Shell                     1             19             19             83
HTML                             2              0              7             28
make                             1              2              0              6
Javascript                       1              0              0              2
-------------------------------------------------------------------------------
SUM:                           205           5070           4561          34908
-------------------------------------------------------------------------------
# cloc cJSON/
     222 text files.
     211 unique files.
      83 files ignored.

http://cloc.sourceforge.net v 1.64  T=0.56 s (248.0 files/s, 50102.7 lines/s)
-------------------------------------------------------------------------------
Language                     files          blank        comment           code
-------------------------------------------------------------------------------
C                               68           2851           1318          14592
Ruby                            17            446            245           3180
C/C++ Header                    19            327            596           1473
YAML                            20             34             52           1235
JSON                             4            107              0            696
make                             5             69             43            327
CMake                            3             54             20            324
Python                           2             44             20            221
Bourne Shell                     2              3              1             10
-------------------------------------------------------------------------------
SUM:                           140           3935           2295          22058
-------------------------------------------------------------------------------

The code size of these softwares are very different from your data. Althought the unit of data is byte, it should not have such a big difference.

miloyip commented 5 years ago

The code size evaluated are binary executable code (on a particular compiler/platform) that implements the same requirements in the test. This is not related to number of lines in source code.