I've been learning GenAI and always struggled with proper roadmaps, resources. After asking many professionals and searching many courses, i made a cheatsheet kinda thing -
https://t.co/gFVpJ6sQPP
(hope it helps people)
Exception handling is expensive, and it is 66x+ slower than compared to regular function call 🤯
I was digging deeper into the JVM to understand the cost of try-catch, and there are some interesting things that I found. First, the one I mentioned - 66x slower, but what if the exception never occurs, does it still impact the performance?
Turns out, even the "harmless" try block itself isn't truly free. try/catch has some impact on performance as it prevents the JVM from doing some optimizations. JVM treats any code within a try block as potentially exception-throwing, preventing some optimizations like
- code reordering across try block boundaries
- method inlining optimizations
- dead code elimination assumptions
Also, what makes handling exceptions expensive is that when they occur, the runtime does two things
1. captures the complete call stack
2. JVM searches up the call stack for appropriate handlers
Now, if the catch block for the exception is located in the same method, the impact is not so bad. However, the further down the handler is in the call stack, the longer it takes the JVM to find the exception handler, and hence the greater the penalty.
So, the bottom line is - you should use a try/catch block only for error conditions, but never for simply controlling the program flow.
Hope this helps.
10 Things I Learned Building My Own Expense Tracker App – SpendSight💸
Over the past few weeks, I’ve been building SpendSight— app that helps you track expenses, sync Gmail transactions
Here are 10 things I learned while working on it 👇
🔟 Building a product > reading about one
Docs and tutorials help, but building something real — with bugs, edge cases, auth, and syncing — that’s where the real learning happens.
Caching is one of the most powerful tools to scale systems and speed up responses.
💡 What is Caching?
It’s like keeping your most-used docs on your desk (RAM) instead of going to the filing room (DB) every time.
✅ Fast
✅Cheap (vs. DB load)
✅ Crucial for scalability
Tools: Cloudflare CloudFront
=>Use case: Img, CSS, JS, Static pages, media delivery
⚠️ Not for dynamic or personalized content
5. DB-Level Cache: It inside or next to the DB itself
Analogy: You pre-print a report that people often ask for- instead of recalculating it every time.