Unreadable Code and Its Silver Lining

There’s no bullet-proof obfuscation technique; your code will only be safe until someone with unwavering determination breaks it.The Cost of SecurityAlthough minification and obfuscation protect the code, they can also have their drawbacks in both file size and rendering performance..We did a couple of tests to assess the impact of applying these techniques to our code base..We were mainly focusing on how long it takes to render and the file size of an APK/IPA in the end.Rendering TimeHaving silky smooth transitions and animations is what amazes everyone who uses a mobile application, so we must absolutely be sure this isn’t affected by our changes..To try this out, I applied minification and obfuscation transformations to one of our generated applications and measured the time it took to render an animated list of 100 elements with it.Time to render an animated list with 100 elements.Although the time differences seem small, we can’t neglect an increase of the rendering times..Depending on what the application does and the mobile phones it is targeting, the rendering time may or may not have an impact..But in the worst case scenario, it can affect the end-user experience.File SizeIn the mobile-centric world we live in, the amount of storage available in a device is becoming less of a concern..However, file size is still a problem when the devices can easily connect to 3G or 4G networks or use pay-by-the-byte data plans..Android’s Developer page even has an article on how to reduce the APK size.Here you can see how applying both minification and obfuscation to one of our app’s code affected the installer size.The difference in size of the installers after applying the transformations.At first look, we would think that having an increase in the file size wouldn’t be expected since we were applying minification techniques..But after further scrutiny, it actually makes sense.Obfuscation can add a lot of unnecessary code to increase its resilience, and that’s what causes the increase in the file size..Having minification applied over it doesn’t help much since it only removes unnecessary whitespaces.Note that these numbers are the result of applying both techniques..Had I applied them individually, I would have gotten different results.Balancing Security and PerformanceAfter these tests, we could conclude that because of the amount of unnecessary code, obfuscation can impact both file size and rendering time..Obviously, without neglecting the end users and to give them the best experience possible, both techniques should always be applied.. More details

Leave a Reply