Skip to content
Mustafa Erbay
Life · 11 min read · görüntülenme Türkçe oku

App Size: A Battle for Every Kilobyte, or Prioritizing Functionality?

Examining the importance of app size in development processes from mobile, web, and backend perspectives; balancing functionality and optimization based on my.

100%

Throughout my software development career, especially over the last 20 years, I’ve constantly sought a balance between system and software aspects. One of these balancing points is the issue of application size. On one side, I have an engineering instinct that says, “Every kilobyte matters, every excess is a cost,” while on the other, a pragmatic perspective that argues, “Delivering value-adding functionality to the user as quickly as possible is essential.” Navigating between these two extremes has been a significant part of my career.

So, should we really fight for every kilobyte? Or should we prioritize functionality? This is a gray area that varies depending on the project’s context, target audience, and even deployment model. In my experience, there’s no clear-cut answer to this question, but the best results can be achieved by asking the right questions and making conscious trade-offs. In this post, I’ll share my thoughts and observations from different fields on this topic.

The Harsh Realities of Size in the Mobile World

The importance of size in mobile applications is undeniable. Especially in markets like Turkey, where mobile internet is widespread but not always fast or unlimited, app size directly affects download rates, user experience, and even how long an app stays on a device. Years ago, while developing my own Android spam application, I experienced this reality repeatedly. The smaller I made the app, the higher the download and installation rates became.

For example, at one point, my app’s main package was around 12MB. After several rounds of optimization (cleaning up unnecessary resources, code compression with ProGuard, optimizing native libraries), I managed to reduce this size to 7MB. This 40% reduction directly reflected in my Play Store download statistics. This difference was critical, especially for users with low-bandwidth connections or those using capped mobile data. Some users even provided feedback stating they refrained from downloading the app simply because of its large size.

Another impact arises during update processes. Users don’t want to download large updates with every new version. This can lead to delays or complete cancellations of in-app updates. When I added a feature to my Android app, if it required a new large library, I considered loading it modularly or offering it only to Premium users. Because I didn’t want every user to download that size. This situation constantly forces mobile developers to balance functionality with size. The app’s cold start time is also directly affected by size; larger applications generally start slower.

Different Dynamics in Web and Enterprise Software

In the web world, especially with modern SPA (Single Page Application) architectures, JavaScript bundle sizes have become a serious problem. The total size of JavaScript, CSS, and other resources that users need to download to their browser directly affects the site’s loading speed. Years ago, while developing a React-based dashboard application for a client project, we found our initial bundle size reached an exorbitant 4MB. This meant a poor initial loading experience.

To remedy the situation, we undertook aggressive optimizations:

  1. Code Splitting / Lazy Loading: We loaded only the necessary components for the main page, splitting other routes and modules to be downloaded when the user needed them.
  2. Tree Shaking: We optimized Webpack configuration to remove unused code from the bundle.
  3. Image Optimization: We switched to modern formats like WebP and compressed images.
  4. CDN Usage: We distributed static assets via global CDNs.

As a result of these steps, we managed to reduce the initial bundle size to around 800KB. This significantly improved the perceived speed of the site for users. According to our measurements, the Largest Contentful Paint (LCP) decreased by 60%. In web projects, this type of optimization can even affect SEO performance. Web performance optimizations and SEO relationship

In enterprise software, the situation is slightly different. Since the end-user typically accesses it from within the corporate network, bandwidth may not be as limited as mobile. However, deployment times and dependency management come to the forefront here. When developing an ERP for a manufacturing company, deploying a new module could sometimes take hours. One reason for this was the repeated deployment of a single large JAR file (monolith) with all its dependencies.

# Example JAR size and deployment time for a monolithic application
# These were typical values seen for a JAR file of approximately 300MB
# Even for a single version change, this time had to be waited.
$ ls -lh my-erp-monolith-1.2.3.jar
-rw-r--r-- 1 erbay erbay 298M May 28 14:30 my-erp-monolith-1.2.3.jar

$ time scp my-erp-monolith-1.2.3.jar user@erp-server:/opt/erp/
my-erp-monolith-1.2.3.jar                          100%  298MB  50.0MB/s   00:05

$ time systemctl restart erp-application.service
# Time for the application to fully start and enter service
real    1m35s
user    0m2s
sys     0m1s

In such cases, size impacts operational speed and agility rather than direct performance. Managing dependencies and enabling different modules to be deployed separately (with a transition towards a microservices architecture) both alleviates the size problem and accelerates development and operational processes.

Indirect Effects of Size in Backend and Infrastructure

In backend applications or infrastructure components, size is often given less importance because it doesn’t directly affect the end-user. However, indirect costs and operational burdens arise here too. Especially since I started working with container technologies, I’ve personally experienced how critical Docker image sizes can be.

The size of a Docker image can directly affect deployment time, disk usage, network traffic, and even security vulnerabilities. For example, running an application in an Alpine Linux-based image (approx. 5MB base size) instead of an Ubuntu-based image (approx. 100MB base size) creates significant differences in network traffic and storage space saved with each new deployment.

# Ubuntu-based, larger image example
FROM ubuntu:22.04
RUN apt-get update && apt-get install -y python3 python3-pip && rm -rf /var/lib/apt/lists/*
COPY requirements.txt .
RUN pip install -r requirements.txt
COPY . .
CMD ["python3", "app.py"]

# Alpine-based, smaller image example
FROM python:3.9-alpine
COPY requirements.txt .
RUN pip install -r requirements.txt --no-cache-dir
COPY . .
CMD ["python", "app.py"]

The difference between these two Dockerfiles can result in hundreds of megabytes in the final image size. In the backend of one of my side products, for services continuously passing through the CI/CD pipeline, I saw deployment times shortened by 30% using Alpine-based images. This is a significant gain, especially in an environment where deployments happen dozens of times a day. Container image optimization techniques

The issue of disk space also comes into play here. When running multiple containers on a server, their logs, temporary files, and image layers can eventually fill up the disk. Especially in an environment running with journald’s default settings, log sizes can sometimes get out of control. Similarly, build caches or intermediate images in CI/CD processes can also occupy unnecessary disk space, reducing performance. Once, on my self-hosted CI/CD runner, I saw pipelines halt because Docker build caches completely filled the disk. This was a concrete example of how size directly impacts not only the end-user but also operational costs.

The Fine Line Between Functionality and Speed

In the application development process, adding a new feature usually means a new library or more code. This inevitably increases the application’s size. The real question here is whether the functional gain brought by this size increase justifies the resulting cost. Sometimes, we realize we’ve added a very large library for a very small piece of functionality.

For example, when a need for PDF generation arises in a project, including a popular PDF library (e.g., iText in Java or ReportLab in Python) in the project can increase the package size by tens of megabytes. If this PDF feature is only for specific reports and used rarely, alternatives can be considered, such as running it as a separate microservice or generating it server-side and only sending the output to the client, instead of including this large library in the main package.

This situation becomes even more pronounced when under pressure for rapid delivery. It can be tempting to opt for the easiest solution (often the largest library) “to get a feature out quickly.” However, this accumulates technical debt and makes future optimizations more difficult. In my experience, these “quick solutions” often lead to higher costs in the medium and long term. While adding a 50KB library might seem insignificant initially, the accumulation of such additions over time can seriously affect the overall performance and maintenance of the application. This once again proves that software architecture is not just about writing code, but also about anticipating organizational flows and potential future growth scenarios.

Pragmatic Approach: Where and How Much to Optimize?

Extreme approaches like “give up everything” or “don’t care about anything” usually don’t work in application size optimization. The important thing is to strike a pragmatic balance according to the needs of the project and the target user group. There are some questions I ask myself to find this balance:

  • Who is my target audience? Mobile users in developing countries, or professionals in a high-bandwidth corporate network?
  • How often is the application downloaded/updated? Is it a one-time download, or a continuously updated SaaS product?
  • What would be the benefit of optimization? How many seconds would a 1MB reduction save, how many users would it satisfy?
  • What would be the cost of optimization? Development time, maintenance difficulty, loss of readability?

The answers to these questions have led me to different strategies. For example, while I might fight for every kilobyte in a consumer-facing mobile app, I can tolerate larger bundle sizes in an internal corporate management panel. The important thing here is to make a conscious decision and stand by it.

When developing an internal platform for a bank, even a frontend bundle size of 10MB was not much of an issue. Because users accessed the platform from a fixed network with powerful computers, and the browser cache kicked in after the initial load. However, for the financial calculators of my side product, fast page loading was critical. So I compressed every JavaScript and CSS file, optimized images, and even rendered some dynamic content server-side.

// Webpack example for code splitting and lazy loading
// This ensures only main page components are loaded into the main bundle,
// other modules are downloaded when the user needs them.
import React, { Suspense, lazy } from 'react';

const Dashboard = lazy(() => import('./Dashboard'));
const Reports = lazy(() => import('./Reports'));

function App() {
  return (
    <div>
      <Suspense fallback={<div>Loading...</div>}>
        {/* Router-based lazy loading */}
        {window.location.pathname === '/dashboard' && <Dashboard />}
        {window.location.pathname === '/reports' && <Reports />}
      </Suspense>
    </div>
  );
}

While implementing such strategies, I constantly measured the performance I achieved. I observed the effects of changes with Lighthouse scores, Core Web Vitals metrics, and my own custom telemetry systems. For example, when I applied an image compression algorithm, I saw that the page size decreased by 15% and the LCP (Largest Contentful Paint) value improved by an average of 0.5 seconds. These concrete data showed that my optimization efforts were not in vain.

Conclusion

The issue of application size is a good example of a trade-off cycle we frequently encounter in engineering. The answer to the question “A battle for every kilobyte, or prioritizing functionality?” is not black or white, but a shade of gray that varies according to the project’s context. My clear position has always been in favor of “conscious balance.”

On mobile platforms or in low-bandwidth environments, size optimization is vital. On the web, especially for sites where initial loading speed is critical, the importance of size is also great. In the backend and infrastructure, size primarily affects operational costs and deployment speed. In every case, our duty as developers is to provide the best user experience while not neglecting operational efficiency. This sometimes means tolerating an extra few kilobytes, and sometimes it means compressing every byte with hours of optimization work. The important thing is to support these decisions with data and act in line with the overall goals of the project.

Paylaş:

Bu yazı faydalı oldu mu?

Yükleniyor...

How was this post?

Frequently Asked Questions

Common questions readers have about this article.

Where should I start to reduce my app's size?
I started by analyzing the app's package structure to identify the largest files and libraries. Android Studio's 'APK Analyzer' is the first stop, as it shows the size of each .dex, image, and native .so file within the .apk. Then I cleaned up unnecessary manifest permissions, debug code, and unused resources. After that, I performed code compression with ProGuard/R8 and replaced commonly used libraries with lighter variants like 'api' or 'runtimeOnly' instead of 'implementation'. Keeping these steps as a checklist allows for progress by measuring the size difference at each step.
What are the trade-offs between ProGuard and native library optimization?
When I use ProGuard (or R8), code readability is lost, and debugging becomes difficult; especially libraries using reflection can be accidentally removed, so the keep-rules file must be meticulously created. Shrinking native .so files requires balancing CPU architectures (armeabi-v7a, arm64-v8a); if you only package one architecture, the app will be smaller, but it won't run on some devices. I chose to combine the two strategies, keeping critical platforms and offering the rest as 'split APKs'; this way, the total download size decreases while maintaining device compatibility.
How should I debug if I encounter unexpected errors during size optimization?
I first compiled with 'gradle assembleDebug' and monitored runtime errors via 'adb logcat'; 'ClassNotFoundException' after ProGuard usually results from a missing keep-rule. Then I temporarily enabled the '-dontobfuscate' flag and isolated the source of the error. For native library errors, I checked the symbols of the .so file with 'ndk-stack' and 'readelf' tools. If the problem still wasn't resolved, I reverted to the previous stable build and performed regression tests by adding changes step by step. This approach clearly reveals which optimization caused the error.
Is fighting for every kilobyte always the best strategy, or is it more reasonable to prioritize functionality?
In my 20 years of experience, the 'every kilobyte' tactic can be excessive unless I consider the context. If the target audience is in a market with low bandwidth, size optimization takes priority because download time and storage limitations are critical. However, in an enterprise web service or desktop application, adding new features and providing performance improvements might hold higher value. In every project, I create a 'size-benefit' matrix, comparing user expectations, device profiles, and business goals; this way, I avoid unnecessary shrinking efforts and achieve an optimal balance by preserving functionality.
ME

Mustafa Erbay

Sistem Mimarisi · Network Uzmanı · Altyapı, Güvenlik ve Yazılım

2006'dan bu yana sistem mimarisi, network, sunucu altyapıları, büyük yapıların kurulumu, yazılım ve sistem güvenliği ekseninde çalışıyorum. Bu blogda sahada karşılığı olan teknik deneyimlerimi paylaşıyorum.

Kişisel Notlar

Bu notlar sadece sizde saklanır. Tarayıcınızda yerel olarak tutulur.

Hazır 0 karakter

Comments

Server-side AI Moderation

Comments are AI-moderated server-side and stored permanently.

?
0/2000

Server-side AI moderation

✉️ Free · No spam · Unsubscribe anytime

Get notified about new posts

New content and technical notes — straight to your inbox.

  • 📌
    Best of the week Single most-worth-reading post
  • 🔧
    Toolbox notes Real tools I used this week
  • 🧠
    Behind-the-scenes Notes that don't make it to blog

We don't spam. Unsubscribe anytime. · Tracked only by Umami (self-hosted, no Google).

Your Reading Stats

0

Posts Read

0m

Reading Time

0

Day Streak

-

Favorite Category

Related Posts