Programming & AI Tips πŸ’‘
46.5K subscribers
67 photos
11 videos
30 files
368 links
Programming & AI:
Tips πŸ’‘
Articles πŸ“•
AI & LLMs πŸ‘Ύ
Design, Architecture, Principles βœ…

πŸ‡³πŸ‡± Contact: @MoienTajik
Download Telegram
Use Strings carefully ⚠️

If two Strings are concatenated using β€œ+” operator in a β€œfor” loop, then it creates a new String Object, every time.

This causes wastage of Memory and increases Performance time.

Also, while instantiating a String Object, constructors should be avoided and instantiation should happen directly. For example:

//Slower Instantiation ❌
String bad = new String("string object");

//Faster Instantiation βœ…
String good = "string object";


#memory #java #string
@ProgrammingTip
Avoiding Memory Leaks By Simple Tricks βœ…

Memory Leaks often cause performance degradation of software. Since, Java manages memory automatically, the developers do not have much control.

But there are still some standard practices which can be used to protect from memory leakages. πŸ™†πŸ»β€β™‚οΈ

1️⃣ - Always release database connections when querying is complete.

2️⃣ - Try to use Finally block as often possible.

3️⃣ - Release instances stored in Static Tables.

#java #memory #performance
@programmingTip
Cloudflare saved 100 TB of RAM with math and Rust πŸ”₯

Cloudflare reclaimed more than 100 TB of RAM globally in a Pingora-based consistent-hashing service. No new hardware. The win came from changing data representation and the algorithms around it.


βœ… Lessons:

β€’ Measure retained memory, not only allocation rate.
β€’ Check collection shape: duplicated keys, oversized buckets, and pointer-heavy graphs add up fast.
β€’ Fix the model first: a smaller or more compact structure usually beats micro-optimizing a hot loop.

For high-cardinality caches, routing tables, or tenant maps, take a heap dump before reaching for another cache node. A few bytes per entry becomes expensive at fleet scale.

[ Blog ] :
https://blog.cloudflare.com/saving-100-tb-of-ram-with-math

〰️〰️〰️〰️〰️〰️
#Performance #Memory #Rust
@ProgrammingTip
Please open Telegram to view this post
VIEW IN TELEGRAM