eed3si9n / sjson-new

a typeclass based JSON codec that's backend independent
Apache License 2.0
36 stars 19 forks source link

construct URI manually in IsoString[File] to avoid stat call #117

Closed jtjeferreira closed 3 years ago

jtjeferreira commented 3 years ago

Path.toUri does a stat to check if it is an directory...

image

The result is not the same file:///tmp/ vs file:/tmp/ but I found this https://stackoverflow.com/questions/46610910/how-to-obtain-correct-uri-of-a-local-file stating that both are valid formats...

jtjeferreira commented 3 years ago

Actually File.toUri also calls isDirectory, so I changed the implementation again, and this time is one order of magnitude faster

[info] Benchmark                      Mode  Cnt       Score        Error  Units
[info] FileIsoStringBenchmark.fileB  thrpt    3  967045.854 ± 343359.509  ops/s
[info] Benchmark                      Mode  Cnt        Score         Error  Units
[info] FileIsoStringBenchmark.fileB  thrpt    3  9664193.530 ± 2379893.741  ops/s
jtjeferreira commented 3 years ago

The travis failure is already present in 58a363cd6ae7fad2f67202ba3977854132fe3a55

jtjeferreira commented 3 years ago

just realized the PR title does not reflect the final solution in case you make some kind of release notes...