132 points · by hermanschaaf · 13y ago · 74 comments
So...the Python/Django to Go/Revel comparison is basically worthless then? These are huge changes that completely invalidate any speed improvement the author is trying to prove are a result of using Go.
A lot of upvotes for an article with an obviously flawed conclusion.
>"All these things influence the validity of a direct speed comparison between the two versions"
I hope the author wasn't trying to say, "Go is better always forever." I read it more as, "hey I rebuilt my site in Go, and it's fast." Go has potential - I'll be excited to see what people come up with.
Why not just measure/compare the response time of the single request that fetches the (presumably) HTML response, and leave all of the ancillary asset delivery and script execution as an aside? If this is about Go versus Python, all I care about is the portion where those are actually involved. And it would be easy to see in the network panel of the developer tools window in Chrome or Firefox.
Of course, the hosting environment also changed, so... there's that still.
"All these things influence the validity of a direct speed comparison between the two versions, but the speed improvement is nevertheless too overwhelming to attribute only to these small changes. And in fact, many of these changes might even have negatively impacted the speed of the new version in exchange for saving on the monthly bills."
Without showing how many seconds were spent loading Disqus, we don't know how much of the load time improvement was based on eliminating Disqus vs. the switch to Go.
Based on experience I'm guessing the lion's share of the gain is due to eliminating Disqus.
However, in the browser, they felt like the same site. The 199ms head start resulted in only 50-75ms difference in the browser. Anyway, it turned our focus from backend work to CSS and image improvements.
If your back-end is slow, just cache it and forget about it. Front-end is almost always the bottleneck (the exceptions to this rule being near-real-time dynamic sites like New Relic or GoSquared).
I serve my homepage/blog off a small Sinatra (Ruby) app, and while that's not slow, mostly because it caches every single page in memory permanently (my written content grows much slower in size than available memory on dirty cheap servers) just because it's simple to do and makes my testing easy (it does stat to check for modifications), there's pretty much no excuse not to have a CDN or a fast server like Nginx with caching turned on in front of app servers these days, which makes the backend performance pretty much irrelevant for cases where you don't have content that needs to be dynamically generated for a huge percentage of requests.
Wouldn't that by itself be enough to account for the download time differences?
"I removed the Disqus comments and the many many lines of CSS from the old site and replaced it with only a couple of lines of CSS alongside a CDN-hosted copy of Twitter Bootstrap. Finally, the Go site is deployed to a free instance of Heroku and the MongoDB hosted on a developer version of Mongolab, while the old Django site was hosted on a Webfaction shared server. All these things influence the validity of a direct speed comparison between the two versions"
Indeed, all these things _invalidate_ the direct speed comparison between the two versions.
No, author, Go had very little to do with your page load times. Both Go and Django are going to serve a simple blog at the same speeds.
If so, disqus loading is 'postponed' to after page loading? Or is it taken into account?
Additionally it is funny to see the usual comparisons of young developers discovering execution and compilation speeds already possible in 16 bit systems.
As for 16 bit systems, I'd love to see a comparison with the Turbo Pascal compiler, for example, on modern hardware. Maybe my memory is deceiving me and the program sizes just weren't comparable, but it sure did seem like it was just flying on a 4.77MHz 8086 based PC. It'd be an interesting comparison.
Especially given I remember how frustrated I was with a lot of other contemporary compilers (whether for C, Pascal, dBase or others). The only other compiler I remember fondly for being fast was the AmigaE compiler (by Wouter van Oortsmerssen, the strlen.com / Cube engine guy, who I see is now working at Google on Android gaming - nothing but good can possibly come of that)
I'm not sure about C, but it's definitely the case that Go compiles magnitudes faster than C++, for any reasonable sized project. For example, the ~200k lines of Go standard library compiles in about 14 seconds on my workstation, while random C++ libraries frequently take much longer (just my anecdotal impression from waiting on "brew install").
Other languages with module systems also compile quite fast.
It would be interesting to see a table of compilation speed comparisons of compilers for languages with module systems for applications of an considerable size.
16 seconds is crazy slow, a sure sign that previously Something Wasn't Right.
func getRoutes() map[string]customHndlrFnc {
r := make(map[string]customHndlrFnc)
//routes
r["/route_to_url"] = handler
r["/route_to_url2"] = handler2
return r
}
for key, value := range getRoutes() {
http.HandleFunc(key, handlerWrapper(value))
}
All of my routes for this sample were get requests but it could easily be extended. http.HandleFunc("/route_to_url", handlerWrapper(handler))
http.HandleFunc("/route_to_url2", handlerWrapper(handler2))
Is the map used elsewhere?Golang (Still can't believe Google would release a language so piss poor for SEO) WILL be the language I pursue when I start down this path, but right now I don't have any projects that force me to start rebuilding my libraries from scratch.
http://benchmarksgame.alioth.debian.org/u64/benchmark.php?te...
http://benchmarksgame.alioth.debian.org/u64/benchmark.php?te...
There will always be better tools, you just can't beat yourself up trying to pre-optimize for each one per project.
- You can't find people to work on it - Unbounded complexity, type-masturbation - Slow compilation (you need a better computer/SSD) - Might as well use Java, the tooling for Java is great
Do you know if those are still true?
Scala is many things, but that is not one of them. Scala is an OO language with some FP influence.
You can put the solutions in the dedicated thread on the site though if you want to share :)
Second, I disagree that it is 'directly against the rules' - no where there does it say specifically that you must not post solutions elsewhere. I think the intent is there - but if someone simply cribs off another answer somewhere, they're not really learning anyway and are really robbing themselves. Project Euler is altruistic anyway and there's really no 'advantage' to stealing answers. (I guess someone could show off their progress, but I don't think that's much of an advantage, since they aren't really learning anything)
I have learned quite a bit from looking at Project Euler answers from others and am glad they published their solutions. For example, there are many different ways to do #2 in Haskell and it is enlightening to see how they work.
> I learned so much solving problem XXX so is it okay to publish
> my solution elsewhere?
It appears that you have answered your own question.
There is nothing quite like that "Aha!" moment when you finally
beat a problem which you have been working on for some time.
It is often through the best of intentions in wishing to share our
insights so that others can enjoy that moment too. Sadly,
however, that will not be the case for your readers. Real
learning is an active process and seeing how it is done is a
long way from experiencing that epiphany of discovery.
Please do not deny others what you have so richly valued yourself.The core of this problem exists in education at all levels; the learner must be coerced or convinced that it is in their best interest to actually learn the content rather than cheat.
Seriously the web is big, github is big, Euler is pretty big. Overlap is unavoidable. The [thing,] I'd think would be to ask for no direct linkages. "Go ahead, share your prime factor code, but for goodness sake [do] not document it as a 'Euler Problem.'"
Never gets old.
Tomorrow: How I rewrote my bedroom and kitchen using Go and saved lives.