DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
What's in store for DevOps in 2023? Hear from the experts in our "DZone 2023 Preview: DevOps Edition" on Fri, Jan 27!
Save your seat

Wasting time by saving memory

Peter Lawrey user avatar by
Peter Lawrey
·
Dec. 16, 12 · Interview
Like (0)
Save
Tweet
Share
3.13K Views

Join the DZone community and get the full member experience.

Join For Free

Overview

Memory and disk space is getting cheaper all the time, but the cost of an hours development is increasing.  Often I see people trying to save memory or disk space which literally wasn't worth worrying about.

I have a tendancy to do this myself, because I can, not because it is good use of my time. ;)

Costs for comparison

Cheap memory - You can buy 16 GB of memory for £28.
Expensive memory - You can buy 1 GB in a phone for £320. (The entire cost of the phone)
Cheap disk space - You can buy 3 TB of disk for £120
Expensive disk space - You can buy 1 TB of the fastest RAID-1 PCI SDD for £2000.
The living wage in London is £8.55.

You might say that at my company, the hard ware is 10x more expensive, but it also likely you time is costing the company about the same more. 

In any case, this article attempts to demonstate that there is a tipping point where it no longer makes sense to spend time saving memory, or even thinking about it.

time
spent
cheap
memory
expensive
memory
cheap
disk
expensive
disk
a screen refresh
20 ms
      27 KB 150 bytes        1 MB   24 KB
one trivial change
~1 sec
     1.4 MB  7.6 KB      60 MB     1.2 MB
one command
~5 sec
        7 MB   50 KB    400 MB     6 MB
a line of code
~1 min
      84 MB 460 KB  3,600 MB   72 MB
a small change
~20 min
  1600 MB     9 MB 72,000 MB     1.4 GB
a significant change
~1 day
       40 GB  0.2 GB   1,700 GB   35 GB
a major change
~2 weeks
      390 GB   2 GB 17,000 GB 340 GB

Your mileage may vary, but just today some one asked how to save a few bytes by passing short instead of int as method arguments (Java doesn't save any memory if you do) Even if it did save as much as it might, the time taken to ask the question, let alone implement and test it, could have been worth 10,000,000 times the cost of memory it could have saved. 

In short; don't fall into the trap of a mind boggling imbalance of scale.
Memory (storage engine)

Published at DZone with permission of Peter Lawrey, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Deploying Java Serverless Functions as AWS Lambda
  • Microservices Discovery With Eureka
  • Bye Bye, Regular Dev [Comic]
  • Better Performance and Security by Monitoring Logs, Metrics, and More

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: