Age | Commit message (Collapse) | Author |
|
Updates #9687
|
|
We have been using `go-toml` for language files only. This commit makes it the only TOML library.
It's spec compliant and very fast.
A benchark building a site with 200 pages with TOML front matter:
```bash
name old time/op new time/op delta
SiteNew/Regular_TOML_front_matter-16 48.5ms ± 1% 47.1ms ± 1% -2.85% (p=0.029 n=4+4)
name old alloc/op new alloc/op delta
SiteNew/Regular_TOML_front_matter-16 16.9MB ± 0% 16.7MB ± 0% -1.56% (p=0.029 n=4+4)
name old allocs/op new allocs/op delta
SiteNew/Regular_TOML_front_matter-16 302k ± 0% 296k ± 0% -2.20% (p=0.029 n=4+4)
```
Note that the front matter unmarshaling is only a small part of building a site, so the above is very good.
Fixes #8801
|
|
And remove some now unused code.
See #5324
|
|
See #5324
|
|
```bash
benchmark old ns/op new ns/op delta
BenchmarkStringifyMapKeysStringsOnlyInterfaceMaps-4 3269 3053 -6.61%
BenchmarkStringifyMapKeysStringsOnlyStringMaps-4 4.79 5.23 +9.19%
BenchmarkStringifyMapKeysIntegers-4 2707 2320 -14.30%
benchmark old allocs new allocs delta
BenchmarkStringifyMapKeysStringsOnlyInterfaceMaps-4 16 6 -62.50%
BenchmarkStringifyMapKeysStringsOnlyStringMaps-4 0 0 +0.00%
BenchmarkStringifyMapKeysIntegers-4 16 6 -62.50%
benchmark old bytes new bytes delta
BenchmarkStringifyMapKeysStringsOnlyInterfaceMaps-4 1080 1008 -6.67%
BenchmarkStringifyMapKeysStringsOnlyStringMaps-4 0 0 +0.00%
BenchmarkStringifyMapKeysIntegers-4 1080 1008 -6.67%
```
|
|
|
|
```bash
BenchmarkStringifyMapKeysStringsOnlyInterfaceMaps-4 500000 3269 ns/op 1080 B/op 16 allocs/op
BenchmarkStringifyMapKeysStringsOnlyStringMaps-4 300000000 4.79 ns/op 0 B/op 0 allocs/op
BenchmarkStringifyMapKeysIntegers-4 500000 2707 ns/op 1080 B/op 16 allocs/op
```
|
|
Recurse through result of yaml package parsing and change all
maps from map[interface{}]interface{} to map[string]interface{}
making them jsonable and sortable.
Fixes #2441, #4083
|
|
|
|
The list handling is surprisingly expensive:
```
▶ go test -run="NONE" -bench="BenchmarkFrontmatterTags" -test.benchmem=true ./parser | prettybench
PASS
benchmark iter time/iter bytes alloc allocs
--------- ---- --------- ----------- ------
BenchmarkFrontmatterTags/JSON:1-4 1000000 2039.00 ns/op 912 B/op 20 allocs/op
BenchmarkFrontmatterTags/JSON:11-4 300000 5202.00 ns/op 1640 B/op 44 allocs/op
BenchmarkFrontmatterTags/JSON:21-4 200000 7993.00 ns/op 2392 B/op 65 allocs/op
BenchmarkFrontmatterTags/YAML:1-4 200000 9359.00 ns/op 5928 B/op 66 allocs/op
BenchmarkFrontmatterTags/YAML:11-4 100000 21218.00 ns/op 8408 B/op 140 allocs/op
BenchmarkFrontmatterTags/YAML:21-4 50000 32852.00 ns/op 10920 B/op 211 allocs/op
BenchmarkFrontmatterTags/TOML:1-4 100000 21505.00 ns/op 9231 B/op 173 allocs/op
BenchmarkFrontmatterTags/TOML:11-4 20000 82919.00 ns/op 19808 B/op 625 allocs/op
BenchmarkFrontmatterTags/TOML:21-4 10000 141847.00 ns/op 31200 B/op 1106 allocs/op
ok github.com/spf13/hugo/parser 17.890s
```
See #3464
|
|
Lots of cleanups here:
- Refactor InterfaceToConfig and InterfaceToFrontMatter to use io.Writer.
- Simplify InterfaceToFrontMatter by wrapping InterfaceToConfig.
- Export FrontmatterType since we return it in DetectFrontMatter.
- Refactor removeTOMLIdentifier to avoid blindly replacing "+++".
- Update HandleJSONMetaData to return an empty map on nil input.
- Updates vendored goorgeous package and test for org-mode frontmatter.
- Add tests and godoc comments.
Coverage for parser package increased from 45.2% to 85.2%.
|
|
See #1646
|
|
Many minor fixes to make test logs more consistent and correct a
mispelling.
Standardize on "[%i] got X but expected Y" for log messages. Using
a consistent layout makes it easier to read the test results. This
was mostly changing "Got" to "got". Swapped the order of values on
several calls to bring them in line with the convention.
A few log messages had a sequence number added to identify the
exact scenario that failed. Otherwise, there would be no way to
ascertain which failed When there are many scenarios.
Correct spelling of "expected."
Fixes #1028
Merged be2097e1ad789eca5d893805a059d94defbe5c48
[close #1040]
|
|
|