Ask HN: What is your go to performance optimization?
11–20 of 47 posts
Re: Ask HN: What is your go to performance optimization?
#12umm this is kinda tongue-in-cheek ``` #include #include int main(int argc, char argv[]) { int i = 0; time_t timep; /* * ok so now we are printing something **/ printf("Greetings!\n"); /* * this is a for loop from 0..9 **/ for(i=0; i } ``` now, the canonical ``` $> gcc tz-test.c -o obj/tz-test ``` now do this ``` $> unset TZ $> strace -ff ./obj/tz-test 2>&1 | grep 'local' | wc 10 77 851 $> export TZ=:/etc/localtime $>…
Re: Ask HN: What is your go to performance optimization?
#13@njit on any for loops w/ numpy that require a recursive calculation
Re: Ask HN: What is your go to performance optimization?
#14On 32bit it remains -fomit-frame-pointer for me. On native compiles -march=native
Re: Ask HN: What is your go to performance optimization?
#15Reduce how often something runs and the amount of work it does when it does run. Sometimes, things are done too often, or process unnecessary data. I once had a project where a SAP system was crawling and literally causing company-wide stoppages. We found a job that literally ran every minute of every day and it processed a table that contained a few thousand tasks. This was something that could be done once per hour…
I ask business how often should something be updated - they say “real time” (not going into details what real time means really) - it is hard to explain processing all data all the time so everything is fresh takes forever….
After couple of months it turns out they never ever open their “super important dashboard” or do it once in 6 months.
Great after a year of bogging down everything I can clean up and make jobs run once a day instead of once a minute because now it is acceptable.
Re: Ask HN: What is your go to performance optimization?
#16Re: Ask HN: What is your go to performance optimization?
#17I've spent the last couple of years identifying and resolving N+1 problems in a Django codebase. https://planetscale.com/blog/what-is-n-1-query-problem-and-h... Aside from the performance gains, it's very satisfying to go from 1,000+ inefficient DB queries to 1-2 optimized queries.
"You might expect that many small queries would be fast and one large, complex query will be slow. This is rarely the case. In practice, the opposite is true."
Re: Ask HN: What is your go to performance optimization?
#18Re: Ask HN: What is your go to performance optimization?
#19The fastest code is code that isn't executed.
It's a pity computers are so fast and have so much memory that people can get away with not caring about minimalism.
Re: Ask HN: What is your go to performance optimization?
#20The fastest code is code that isn't executed.