Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/jacobwilliams/json-fortran-benchmarks

Benchmarks for JSON Fortran parsers
https://github.com/jacobwilliams/json-fortran-benchmarks

fortran json

Last synced: about 6 hours ago
JSON representation

Benchmarks for JSON Fortran parsers

Awesome Lists containing this project

README

        

# json-fortran-benchmarks
Benchmarks for JSON Fortran parsers. Also comparison to Python.

## To compile

```
fpm build --profile release
```

## To run tests

```
fpm run read_file_test
fpm run fson_test
fpm run tomlf_test
fpm run rojff_test
fpm run json_fortran_test

python json_test.py
python ujson_test.py
python rapidjson_test.py
```

## Sample results:

The benchmarks were run on an M1 MacBook Pro.

To parse the `canada.json` file:

First, just the time to read the entire file into a `character(len=:),allocatable` string:
```
read file to a string : 0.0004 seconds
```

### Fortran libs
```
json_fortran : 0.1162 seconds
tomlf : 0.1352 seconds
rojff : 0.2367 seconds
fson : 0.8735 seconds
```

### Python libs
```
json : 0.022102208 seconds
ujson : 0.011403209 seconds
rapidjson : 0.032243625 seconds
```

## See also
* [JSON](https://degenerateconic.com/json.html) [degenerateconic.com]