Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

My favorite optimization: replaced 10,000 lines of code that marshaled structures in a Broadcom driver for transmission to the embedded processor, with a single template of ~20 lines.


I once had the opposite happen, I wrote a ~12 line hack to get something to run which was replaced by ~10,000 lines of code that added no new functionality but was less 'ugly'.


Awesome. I once replaced an intern's 540 lines of code with 12 lines of my own. Feels great.


An intern? Don't pat yourself on the back TOO hard... ;-)

I once sped up an intern's code by just deleting a 30-line function, and doing nothing else. Doofus didn't realize our language had a highly optimized built-in sort, and so he wrote his own inefficient sort (insertion) that overrode the existing one. Poor little guy was so proud of having chosen exactly the right sort, and then implementing it based on his recollection of college... I told him to spend the next few hours just reading the documentation of the core API for our language.


A quote I'm somewhat fond of: "A couple months in the laboratory can save a couple hours in the library."

Unfortunately, I forget who said it.


The programming equivalent that I've heard is: "Weeks of programming can save you hours of planning".



Thanks!


> A quote I'm somewhat fond of: "A couple months in the laboratory can save a couple hours in the library."

Isn't that backwards?


No. It's correct.

I can say this having spent months in the laboratory to learn things which were already known. Who knew that precision quartz pressure gauges were called 'manometers' in the late eighteen-hundreds? I didn't, and thought I'd invented something new for a couple months in my first year of grad school.

The adage is a good one. Reading a lot and reading widely pays off.


That idea might imply that future Google's, using its old self definition are going to play an increasingly critical role in human progress.


No. It's for effect.


No its quite correct, especially holds true for other sciences such as Biology and Chemistry


Calling an intern Doofus is not a good attitude to take. Remember we were all programming noobs at some point.


An intern? Don't pat yourself on the back TOO hard... ;-)

Who's to say an anecdotal 'employee' is any better than his 'intern'?


I can confirm that this is so true. At one place I worked I wasn't allowed to program in C, but did the C code reviews[1].

I was riding in a car with buddies who were much better C programmers than myself and making notes on some code I needed to do the review of the next morning. This is the code pattern that almost crashed our car:

  a = some_function(i);
  a1 = &a;
  a2 = &a1;
  calc(a2);
with calc() reversing it out

I was cussing a bit much[2] and front seat passenger had to look then driver got too curious. Sadly, this was the least "wrong" thing about the code. Its very hard to do a code review where you suggest 500 lines of C can be reduced to 50.

1) cannot have the guy doing code reviews actually coding, that would be improper

2) cussing in private allows positive, motivational tone in public


He had sorting algorithms and data structures drilled in by school. They didn't tell him it's probably a bad idea to ever actually implement them in production code.


What language?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: