Ask HN: What are the 20% tips that will get my code to performance 80% faster?
1–10 of 69 posts
Re: Ask HN: What are the 20% tips that will get my code to performance 80% faster?
#2Make your code do less work.
Use less memory so more of your code/data fits in the CPU cache.
Understand the algorithms that you use, their strengths and weaknesses.
No magic tricks, just hard work.
Re: Ask HN: What are the 20% tips that will get my code to performance 80% faster?
#3Re: Ask HN: What are the 20% tips that will get my code to performance 80% faster?
#4This gives you constant time access to data by whatever properties you want to index on (usually by id).
Also, use libraries and reuse your own code/routines. If you find a faster way to do something, all the code that used those routines will benefit immediately.
Re: Ask HN: What are the 20% tips that will get my code to performance 80% faster?
#5Re: Ask HN: What are the 20% tips that will get my code to performance 80% faster?
#6Re: Ask HN: What are the 20% tips that will get my code to performance 80% faster?
#7That might be round trips to a database, round trips to a caching layer, or round trips from client to server.
Generally speaking, grab as much data as you'll need (but not more).
Re: Ask HN: What are the 20% tips that will get my code to performance 80% faster?
#8Re: Ask HN: What are the 20% tips that will get my code to performance 80% faster?
#9Re: Ask HN: What are the 20% tips that will get my code to performance 80% faster?
#10I suggest you to read a book about algorithms. This one is pretty good: "Introduction to Algorithms" by Cormen and Rivest.