5 ms·
>just under 60 million lines of code in 2022. I'm always surprised at the fact that almost every product has more lines of code than the entire Linux repo. The
by Gigachad 4y ago
>just under 60 million lines of code in 2022.
I'm always surprised at the fact that almost every product has more lines of code than the entire Linux repo. The scale of these products is astounding.
- mherrmann 4y agoFrom the rest of the article, it sounds like a big chunk of these lines are from generated files. What I don't understand is why they're checking in generated files into Git.
- b3n 4y agoNote that these files are not statically generated; they are translation files, generated by translators.
- sdflhasjd 4y agoYes, the article glosses over that a little bit, and it's an unusual decision.
- snicker7 4y agoAs a counter-point, package managers generate “lock files” that are designed to be tracked in VC. For these translation files, I’d imagine there may be occasional work to modify them even after they are initially generated.
- onion2k 4y agoThey're using git as a cache. Having generated files stored there means they're available if they're needed (eg in CI) without needing further access controls, they're versioned, and it's a simple and understandable strategy. As the article states, most devs are set up to ignore those files so they're not much of a source of the slowness. It's a common pattern for apps that have to serve lots of different locales.
- fomine3 4y agoI don't think it's good idea to store cache in Git. Any file remains forever in the repository after once committed. Local/remote repository become unnecessary big.
- kadoban 4y agoThe bigger issues for me are it makes history impossible to read (every change is hidden in an avalanche of crap), merges are a mess (you definitely want to spend forever merging autogened files, right?), PR reviews are annoying, etc.
- Gigachad 4y agoDepends how much generated stuff is there. We have our graphql schema in git even though its auto generated via a library. But its useful in PRs to see exactly how the schema changed as a result of the root change.
- kadoban 4y agoYeah if there's not a lot of it, and if it's easy to regenerate, it can be fine.
- _ikke_ 4y agoYou may want to set the '-diff' attribute for these files so that git will not show diffs for these, instead it will show 'Binary files differ'. There is also '-merge', which will cause git to not attempt to merge the contents, but just ask you to pick a side. The challenge however is then verifying the contents of these files in things like merge requests. See https://gitirc.eu/gitattributes.html https://gitirc.eu/gitattributes.html
- robertlagrant 4y agoIt's still surprising to have any generated things there. E.g. you could make the same case for keeping built binaries in Git as well. Is there a reason why that type of file couldn't be better place into an artifact repository, or just generated and consumed in CI as part of generating a final build output?
- wichert 4y agoReading the article they are not generated files, but files that are never touched by developers. Translators will work with those files. I expect that for translators they have a different sparse checkout that only fetches .xlf files for their target languages.
- onion2k 4y agoxlf files are usually generated. They're XML. No one wants to write that by hand.
- Xylakant 4y ago.docx files are archives of xml-files. No one wants to write that by hand. Or, in more words: The format of the files is just the representation on disk - it’s not directly connected to how the files are generated or edited. XML files can be written by hand with suitable editor support.
- onion2k 4y agoI think we have different ideas of what "written by hand" means. Someone making a Word doc is not writing XML by hand.
- lultimouomo 4y agoAlso plain text files are usually generated. They are arrays of 1s and 0s. No one wants to write that by hand. I think that this is not a sensible definition of a generated file. A more sensible definition is that a generated file is created automatically from some source, which is not user input (i.e. an other file). This means generated files do not need to be kept under git, as long as their source is checked in. Translations files, even if they are not created with a plain text editor but with some other tool that handles the XML layer, are clearly not generated, as long as the translation is done by a human.
- onion2k 4y agoFor the app I work at the moment we use https://lokalise.com/ https://lokalise.com/. We add translation strings to a SaaS app, and then the translation team translate them. I've written a build tool that downloads the translation JSON files from the API using the CLI, or as part of our CI process. Other teams have tools that download their language packs for different iOS and Android apps. The translations are versioned in Lokalise and we using a branching strategy to manage the work. Lokalise has an option to generate xlf files (and JSON, xliff, arb, etc). This is a very typical workflow. Most people are not out there modifying xlf files by opening them in a text editor. For a start, translations usually aren't done by developers. (Huge shoutout to Lokalise btw. I can highly recommend it. It makes building a multi-lingual app across different platforms so much easier.)
- epage 4y agoI've been switching a lot of generated files to being checked in (with CI verifying they haven't drifted from the source). The primary motivation has been performance. For example, in Rust code, it means I don't need to foist the code-gen process and all the dependencies needed for it on dependent crates. I've seen this play out similar in other build systems and circumstances. The key is the data needs to be independent of other factors (like the system doing the generation) and the rate of change of the code-gen source and generator has to be relatively low.
- AlfeG 4y agoWe check-in some generated CSS files. That are generated by external theme cli. Just to be sure, that after version update we can track all changes in the generated CSS files.
- jokethrowaway 4y agoIf they're generated you can just re-generate from source every time you need to track changes. You're using git as a cache. You don't need to version a cache.
- gustavohenke 4y agoRegenerating certain things might be fast, but some might not be. Hundreds of engineers pushing code and having to wait for these to be regenerated both locally and on CI means that caching is quite cheap after all.
- shric 4y agoAs well as generated files the sibling mentioned I wonder how much is due to vendoring.
- alexdowad 4y agoThe natural tendency in almost any software is to keep adding and adding, while rarely throwing anything out. More features, more code, more supported platforms, more supported languages, more this, more that, more, more, more. If it was a physical product, you couldn't keep making it bigger and more complex ad infinitum, because making a physical thing bigger takes more material, and bounded physical resources would be consumed. With software, it's all just bits, and computers can hold a lot of bits. This leads to bigger problems than just git running slowly.
- Gigachad 4y agoCanva is absolutely crushing the established design market with their product right now so I'd say having all those features is pretty important for a good tool these days.