May 19, 2025
Trending News

7 comments

  • February 3, 2024
  • 0

Internet rules say that writing everything in capital letters on the Internet is like shouting. This doesn’t look very good, so the normal thing is to write while

7 comments

Internet rules say that writing everything in capital letters on the Internet is like shouting. This doesn’t look very good, so the normal thing is to write while respecting the use of capital letters and lower case letters of Spanish grammar. The thing is, if you want to save data, you should still write everything in lowercase and forget about uppercase letters.

All letters occupy one byte. As a developer named Nathaniel explains very well on his blog, all letters, whether uppercase or lowercase, use the same amount of data: one byte. Neither more nor less. The funny thing is that the way the internet works means that using more lowercase letters as possible will allow you to save data.

English (somewhat) abuses capital letters. In English, it is common to find titles and titles in which important words are capitalized. We see this all the time in movie or game titles (‘(The Legend of) Zelda: Tears of the Kingdom’, ‘Spider-Man: Across the Spider-Verse’), but the Pan-Spanish Dictionary of Doubt (Capitals, 5.2.24: ” It is not correct to write all important elements in capital letters (⊗‍Libro de Buen Amor), as the obligatory use of italics sufficiently restricts them.”

Look, I saved you 31 bytes.. The author of the discovery did an experiment: He changed the “Title Case” (capitalizing every important word in the title) on the cover of Hacker News into the “Sentence Case” (only at the beginning of the sentence or proper nouns). . The page is minimalist and consists of 30 top stories of the day, but making this change still saves 31 bytes. How is this possible if uppercase and lowercase letters take up the same space?

Compression. As Nathaniel explains, the secret is in text compression on the internet. ZIP files, for example, use the ‘deflate’ algorithm, which makes use of two compression methods: Huffman coding and LZSS, and in both cases the use of lowercase or uppercase letters greatly changes the final amount of information. For example, in Huffman, trees are used based on the frequency of each letter: If we eliminate (grammatically) unnecessary uppercase letters, that tree is optimized because lowercase letters gain frequency, trees become smaller and fewer in number. improved branches and final compression. A similar situation occurs with LZSS, which detects duplicate parts in data and replaces them with short references.

You save bytes and CO2 emissions. In Nathaniel’s testing, the HTML on the Hacker News cover took up 5,992 bytes, but removing all caps except the grammatically correct ones resulted in the HTML taking up 5,961 bytes. You not only save on data, but also on carbon dioxide emissions. At least according to Sustainable Web Design, each visit to Hacker News will save 0.00001059642g. It’s not much, but when you multiply that by millions of visits, the numbers add up (or subtract, depending on how you look at it).

Web developers, your job is easy. There are tools in any web development that fully allow you to do something like this. Searches diminutivesTools that reduce code size by changing the way code works can apply a set of rules to prevent capitalization. They normally “minimize” JS and CSS code to optimize it and make our websites lighter and faster to load, but they can also introduce such changes to HTML code. This can happen, for example, with hexadecimal colors (‘color:#ABCDEF’ to ‘color:#abcdef’) or character encodings (‘‘ with ‘‘. These are minor changes, but as we said, everything helps if this type of code is loaded millions of times.

Image | Aryan Dhiman

in Xataka | 20 GOTO 10: When spaghetti code, capital letters and line numbers torture programmers

Source: Xataka

Leave a Reply

Your email address will not be published. Required fields are marked *