• Cristian Maglie's avatar
    Improved JSON decoding (improves arduino-cli startup time) (#1402) · 20449fce
    Cristian Maglie authored
    * Updated library_index.json for testing
    
    * Use easyjson for parsing library_index
    
    * Added benchmarks for json deconding.
    
    Results:
    
    $ go test -v -benchmem -bench BenchmarkIndexParsing github.com/arduino/arduino-cli/arduino/libraries/librariesindex
    === RUN   TestIndexer
    --- PASS: TestIndexer (0.16s)
    goos: linux
    goarch: amd64
    pkg: github.com/arduino/arduino-cli/arduino/libraries/librariesindex
    cpu: Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
    BenchmarkIndexParsingStdJSON
    BenchmarkIndexParsingStdJSON-8                 5         214872730 ns/op          94.52 MB/s    58956539 B/op     418973 allocs/op
    BenchmarkIndexParsingEasyJSON
    BenchmarkIndexParsingEasyJSON-8               16          69215472 ns/op         293.42 MB/s    56162664 B/op     418966 allocs/op
    PASS
    ok      github.com/arduino/arduino-cli/arduino/libraries/librariesindex 4.442s
    
    easyjson is 3x faster.
    
    * Updated license check cache
    
    * Added easyjson to package_index.json parser
    
    * Allow easyjson to match tags in case-insensitive
    
    See https://github.com/mailru/easyjson/pull/372
    
    * Added easyjson generation task in Taskfile
    
    * Added github action check
    
    * Update .github/workflows/check-easyjson.yml
    Co-authored-by: default avatarper1234 <accounts@perglass.com>
    Co-authored-by: default avatarper1234 <accounts@perglass.com>
    20449fce
index.go 13.9 KB