Closed portlek closed 4 years ago
I don't mind to change the library for parsing / dumping YAML as long as the same behaviour can be achieved. I don't know about eo-yaml but I guess it should work. May involve some work, though.
Current usage of SnakeYAML in this library is at YamlConfiguration, YamlConstructor and YamlRepresenter classes.
You can create a pull request with the migration changes if you want to work on it.
Yea I know, I did it already but it's not in the simple-yaml fork, I will separate these features to create p.r. for this repo.
Also, one more thing that is good with eo-yaml is that it's the fastest and reliable library. I test 4 YAML libraries and the result is this(loading from file)
Benchmark Mode Cnt Score Error Units
BenchmarkRunner.eoyaml avgt 3 0,780 ± 0,089 ms/op
BenchmarkRunner.jacksonyaml avgt 3 4,874 ± 0,702 ms/op
BenchmarkRunner.snakeyaml avgt 3 9,532 ± 0,890 ms/op
BenchmarkRunner.yamlbeans avgt 3 6,773 ± 0,598 ms/op
(low score/error is better) I will try to implement some snakeyaml features into eo-yaml, after that, I will open the p.r. again.
Seems promising!
About the pull request, key ordering and saving dates can be solved with the suggestions I wrote in the review (changing HashMap
to LinkedHashMap
when needed and adding Date.class
to SCALAR_TYPES
). I don't know if there are better solutions.
Changing indentation for dumping may be an interesting feature to develop in eo-yaml. Avoiding wrapping keys with -
character would solve some issues with current tests. Strings with -
character are wrapped too. Strings and keys with :
character are also wrapped, but for keys that's more understandable.
About the pull request, key ordering and saving dates can be solved with the suggestions I wrote in the review (changing
HashMap
toLinkedHashMap
when needed and addingDate.class
toSCALAR_TYPES
). I don't know if there are better solutions.
the library can set/get dates actually we don't need to add to scalar types. I'm working on eo-yaml library for these features.
I did a benchmark again, and the result is
BenchmarkRunner.eoyamlLoadAndGetString avgt 5 15,566 ± 0,124 ms/op
BenchmarkRunner.jacksonyamlLoadAndGetString avgt 5 4,610 ± 0,029 ms/op
BenchmarkRunner.snakeyamlLoadAndGetString avgt 5 9,118 ± 0,109 ms/op
BenchmarkRunner.yamlbeansLoadAndGetString avgt 5 6,462 ± 0,037 ms/op
And probably eo-yaml is the slowest yaml library so, nevermind :D snakeyaml is also bad but we have no choice cuz, other libraries have big sizes .-. eo-yaml is the smallest library but my purpose is finding a minimal+fatest library for yaml.
I guess this issue can be closed then, because no other library has significant size + performance benefits at the moment.
The Simple-YAML project has 350~ kb size. I tested it with another YAML library which has 1.2 YAML 3rd edition support and the file size has been 150~ kb.