r/shittyprogramming • u/[deleted] • Dec 10 '14
This Google new code that makes Google search 100-150 milliseconds faster. Notice that the function ends in line 1.
83
u/UnspeakableEvil Dec 10 '14
I frequently write code which makes things 100-150 milliseconds faster, I just neglect to tell people that's a mathematical statement rather than a range.
74
u/r0Lf Dec 10 '14
p.p.s. yes, I see there is an extra brace in the example; can't fix it now, and it's driving me nuts! And no, we're not throwing exceptions because of it on the search page :-)
Come on man, cut them some slack! It happens to everyone.
25
58
u/Reelix Dec 10 '14
1.) Go to this site
2.) Browse around
3.) Notice there's no lag
4.) Look at Google, and laugh
2
Dec 12 '14
I've just been getting into web dev and this is almost magical to me. I tried it on my site and it really does work well.
0
11
u/ahanix1989 Dec 10 '14
So it only works on Chrome for Android. They intentionally made the mobile version use more data?
0
Dec 10 '14
[deleted]
5
u/ahanix1989 Dec 10 '14
Is it other resources on the same page? Have it preload ads, that shit always drags
4
u/beans-and-rice Dec 10 '14
Wouldn't a unit test have caught that?
4
u/tangerinelion Dec 10 '14
Wouldn't proper indentation have caught that? If it could be validated syntactically my guess is that closing
}at the end is unmatched, or if not that one then the final one at the end of the file.15
u/YRYGAV Dec 10 '14
The image was just an example a google engineer used in a blog post. It's not the actual production code.
7
u/[deleted] Dec 10 '14
More about it here: https://plus.google.com/+IlyaGrigorik/posts/ahSpGgohSDo