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.

Popular posts from this blog

Charting API for Financial Markets - JavaScript (SVG)

A brief about the released version of this API is available here.

As a part of the last semester of my graduation program (Bachelor of Engineering in Information Technology), I have been interning with a start-up, namely uTrade Solutions.  uTrade™ Solutions is a financial trading technology company with various products including multi-asset trading platform, algorithms and analytics. Instead of walking through my experience of working in a start-up, I would directly move to a short discussion about my project. 

uTrade Solutions is working to develop a financial analytics portal and every financial analytics portal employs the use of advanced charting. To draw and display different types of charts on the web, there are two main options which are widely used and acknowledged. Namely, Adobe Flash and Scalable Vector Graphics (SVG) . 
Using Adobe Flash has two main disadvantages: It requires the installation of an additional plugin to run content on the browser.It is not compatible with a…

FusionCharts Automated Testing Tool

While working at FusionCharts, every release we were faced with a daunting task of black box testing. Daunting mainly because of the breadth and the depth of the product. This post talks only about black box testing. FusionCharts Product as a whole contains about roughly 90 charts and each chart can be visually tweaked with a set of about 300 chart options/attributes. Ignoring any further permutation and combination, we have right there around 90*300 test cases. Apart from chart options, api testing which consisted of events and methods was needed. Clearly automation was required, as our manual testing would cover only a very small sample set that too based on smart assumptions.

With this problem at hand, I broke it down as follows:
Headless Browser
- Visual Regression
- API TestingUser Browser
- Visual Regression
- API Testing We liked to call it the FusionCharts Automated Testing Suite.

Headless testing would be based of a headless browser and integrated in to our nightly builds. It was…

KDE - Authors //Promoting book writing in KDE

If you are in any way related to KDE even if you are just a user and think you can/want to help/join us then without giving a second thought fire an email to me. (supreetpal@gmail.com)




How it all began . .


Last October, Google invited proposals for a GSOC Doc Camp Sprint. The sprint was organised at their offices in Mountain View, California and luckily a team of KDE-Contributors got their proposal selected (I was one of them). Over there, we were teamed up with independent volunteers who were basically professional editors and were briefed about the whole plan. The layout was simple, we had to spend the first few hours outlining the chapters and target audience for our book, then spend the rest of the sprint working on the content. We had proposed to work on a beginner’s guide to KDE development, for developers. Most of the content required by us was available on the wiki but writing a book is a totally different approach than writing a wiki. Working 12+ hours a day , things were on w…