Skip to content

Cross-language micro-optimizations and coding patterns that improve runtime efficiency and readability in everyday programming.

Notifications You must be signed in to change notification settings

maikelsalazar/dev-microtips

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

7 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🧠 Code Micro Tips

Small, practical programming tips to write cleaner, faster, and more maintainable code.
Each tip focuses on micro-optimizations, readability improvements, or subtle language behaviors.


πŸ“‚ Structure

Folder Description
general/ Tips that apply across all programming languages (naming, readability, design).
php/ Language-specific micro-optimizations, syntax tricks, and best practices.

🧩 Example Tip

Prefer prefix increment (++i) over postfix (i++)

In most languages (C, C++, Java, PHP, JavaScript, etc.), ++i increments the variable and returns the new value directly,
while i++ returns a copy of the old value, then increments β€” creating an unnecessary temporary object.

// βœ… Faster β€” increments directly
++i;

// ❌ Slightly slower β€” returns old value before incrementing
i++;

πŸ“Š Impact:

Negligible in high-level code, but measurable in tight loops or performance-critical sections (e.g. millions of iterations in C/Java).

πŸ’‘ Rule of thumb:

Use ++i when you don’t need the previous value. Use i++ only if you explicitly need the value before incrementing.

πŸš€ Goal

Collect small but valuable insights that make code:

  • More efficient ⚑
  • More readable πŸ“–
  • More maintainable πŸ”§

About

Cross-language micro-optimizations and coding patterns that improve runtime efficiency and readability in everyday programming.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published