Skip to main content

ES6 Babel Transforms : Code Injection and Increase in File Size

This post aims to give a rough idea on the increase of file size after applying babel transforms to ES6 JavaScript. These figures depend highly on your style of writing code since each extra space leads to an additional byte. However, the transform comparisons will give you an idea on how they are treated by babel and how much of additional code will be injected in your file. 

These file sizes are non-uglify, non-gzipped and without any method of compression on OSX.

let - var

  • 3 bytes for the first rename. 
  • 4 bytes for each subsequent rename.

const - var

  • Save 1 byte per declaration.

Class Tranforms

  • 852 bytes for using simple class declaration with a constructor. Adds two new functions, namely, _createClass and _classCallCheck.


  •  
  • 2114 bytes for creating and extending a class.



  • Extending a class adds two more functions let us have a look at them, namely,
    _get and _inherits.










Arrow => functions

  • 20 bytes per usage, depends on the usage as well.


Template Strings

  • A little less than 4 bytes per variable call.



Destructuring

  • Increase is equal to the size of key variables + 2 bytes each.


Default Arguments

  • 77 bytes per default argument.

Custom `arguments` Keyword

  • 117 bytes per function.

Comments

Popular posts from this blog

Nouveau - Summer Project

Implementing a software scripting engine on Fermi to achieve safe memory re-clocking. Fermi stands for Nvidia GPUs based on Fermi architecture. NVidia cards have long had the possibility to reclock at least some of the engines of its GPUs. Up to the geforce 7 (included), reclocking used to happen at boot time and usually didn't involve memory reclocking at all. It changed with geforce 8 (nv50) where almost all laptops got the capability to reclock both the VRAM and the main engines. This was introduced in order to lower power consumption when the GPU was mostly idle. The default boot clocks were usually in some intermediate state between the slowest and the fastest clocks. The reclocking process for these cards is mostly understood and Nouveau is not far from being safely reclock on the fly, even while gaming. Geforce 200 (nva3) introduced load-based reclocking on all the cards. This started being a real problem because the default boot clocks are a third to a half of the

Getting Started with Open Source Projects

Fellow Open-source Enthusiasts Going to conferences is great , getting inspired by attending them is even better but you know what is better? Getting to attend conferences [National/International] for free , getting cool stickers and t-shirts being delivered at your place , being one of the first few to get your hands on a developer device or developer release of an upcoming software/OS and all this for free! I will hopefully be pardoned by true open-source enthusiasts for making this look like an advertisement rather than a motivator but I somehow couldn't resist.  Now , ignoring the above perks because they are 'perks' , the real deal is getting to learn while you work. Being involved with any open-source project brings along a great deal of learning , experience and contribution to real-time projects which people around the globe use in their daily lives. Once you are into development and learning , conferences make a whole lot of more sense as you actually ge

Nouveau Summer Project - Progress Update

This is a summary of all the proceedings related to my project on Nouveau. The start was a little bumpy due to some bugs and incompatibilities with Ubuntu. After spending quite some time to fix things I decided it was better to shift to Arch rather than spending anymore time on it. It took over a day and many reinstalls to get the base system up and running. Then the xorg server was setup and nouveau was installed. This got a basic window system running. It was followed by a git clone of PDAEMON + envytools which was then compiled and successfully run on Arch system. Things worked perfectly on Arch and I would be posting a tutorial on how to install Arch on a usb stick because I find the official documentation not so friendly to newbies. Designing and implementing a PDAEMON to Host communication was my first objective. I planned to work on it in C. I started off with a basic implementation of the  command submission. From there I made incremental modifications improving and testin