-
Notifications
You must be signed in to change notification settings - Fork 306
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Switch from YAML to JSON for build pipeline #4153
Comments
Interesting; why would this be the case? I have noticed that YAML support is often secondary whereas JSON is often native, and the YAML parsing library is more difficult to use, but I wouldn't have thought there would be speed orders of this magnitude. |
I added this to a milestone just so that it doesn't disappear into our massive issues list... |
I'm not sure about the reasons; I think the YAML format has more features at least, but maybe also more ambiguity?
|
Interesting. I suppose JSON parsing has benefited from of ton of focus it's received, being at the heart of web browser data representations. Still, I would never have guessed this. But this is good news, in part because on #4146, I implemented a JSON representation for the issue and was going to switch to YAML, which requires loading an extra library and making a few code changes. I'll stick to JSON. It would be fantastic to have the build speed brought down. |
YAML depends on intendation, so whitespaces have to be counted to create the correct structure. json does not rely on that and therefore probably does not need as much context. Additionally, json is simply everywhere, especially in server to server communication, whereas I have never seen huge yaml structures in production or as a data structure for data transfer. There is a nice video going into detail what all goes into fast json parsing (a few years old already) Switching to json sounds like a no-brainer to me, as human readability is not that important in our use case. |
YAML serialization (even with CDumper) is significantly slower than JSON serialization with msgspec in my testing (by a factor of at least 20); since Hugo also supports JSON for data files, we should probably switch the build pipeline to write JSON files instead.
The text was updated successfully, but these errors were encountered: