TheDeveloperBlog.com

Home | Contact Us

C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML

Visual Studio Tab Options

This Visual Studio article examines tab character handling. It compares file sizes.

Tab options. Some XML files have tabs instead of spaces.

We can replace the tabs in Visual Studio. Here we find out what Microsoft's developers have to say and consider the options. We investigate XML tabs.

Intro. If you have a project that parses thousands of XML files per day, you want to optimize the XML. Microsoft, in developing the Open XML (.docx, .xlsx) format, investigated XML performance with tag name length.

Let's imagine we have... 7 million elements and 10 million attributes. If on average each attribute and element is about 2 characters long, then you have 34 megabytes of data to parse. If instead though, the average length of an attribute and element were more like 10 characters, then you're talking about 170 megabytes.

Does tag size matter?

Note: Minifying the XML saved a huge amount of disk space (almost 140 megabytes) and processor time (when compressing or sending).

Minify XML. The term "minifying" is applied to CSS and JavaScript on the web, but it also can work for XML. In Visual Studio, a tab character is usually equal to 4 spaces. So we can save a lot of space by using tabs instead of spaces.

First steps. In Visual Studio Go to Tools > Options... This will bring up the Options window. In the left, there are a bunch of arrows and labels. Click on Text Editor, and then go to XML.

Indent size: This is where you can save bytes. Choose "Keep tabs" if it isn't already selected. This decreases the size of XML files.

Tabify. Here we can change lines in Visual Studio to use tabs. This will reduce file size in your XML files on the selection. Please go to Edit > Advanced. There are many useful options on this dialog.

To measure tab characters' effect on file size, I measured a sitemap XML file with spaces, and then with tabs. The results show the size in bytes for the resulting XML file when formatted with spaces and when formatted with tabs.

Size in bytes for file types

XML file with spaces: 30967 bytes
XML file with tabs:   25891 bytes [smaller, Tabify]

 

Summary. Here we saw that changing tabs in Visual Studio XML files has a significant effect on file size. Use Tabify and Untabify wisely and always keep in mind the coding guidelines of your project.


Related Links

Adjectives Ado Ai Android Angular Antonyms Apache Articles Asp Autocad Automata Aws Azure Basic Binary Bitcoin Blockchain C Cassandra Change Coa Computer Control Cpp Create Creating C-Sharp Cyber Daa Data Dbms Deletion Devops Difference Discrete Es6 Ethical Examples Features Firebase Flutter Fs Git Go Hbase History Hive Hiveql How Html Idioms Insertion Installing Ios Java Joomla Js Kafka Kali Laravel Logical Machine Matlab Matrix Mongodb Mysql One Opencv Oracle Ordering Os Pandas Php Pig Pl Postgresql Powershell Prepositions Program Python React Ruby Scala Selecting Selenium Sentence Seo Sharepoint Software Spellings Spotting Spring Sql Sqlite Sqoop Svn Swift Synonyms Talend Testng Types Uml Unity Vbnet Verbal Webdriver What Wpf