News for hackers. Stuff that matters.
Re:Google’s robots.txt parser is now open source by penagwin on Monday July 01, 2019 @11:40AM (#20326439)
> Is Golang significantly slower than c++ ? > Depends the context, but in general, yes.

I don't believe this is the case. Most optimized, natively compiled languages all perform similarly. Go, C, CPP, Rust, Nim, etc. I'm sure there are edge-cases where this isn't the case, but they all perform roughly the same.

The performance rift only starts when you introduce some form of a VM, and/or use an interpreted language. Even then, under certain workloads their optimizations can put them close to their native counter parts, but otherwise are generally slower.

The real reason Google didn't re-write this in Go is likely because the library is already finished, it works, a re-write would require more extensive testing, etc. Why spend precious man-hours on a needless re-write?

Re:Google’s robots.txt parser is now open source by spullara on Monday July 01, 2019 @11:50AM (#20326575)
Golang and Java have similar performance characteristics. I would not put it in the same class as C/CPP/Rust.

https://benchmarksgame-team.pages.debian.net/benchmarksgame/...

Re:Google’s robots.txt parser is now open source by penagwin on Monday July 01, 2019 @03:54PM (#20329118)
I didn't realize Go was so far behind C in terms of performance.

Like REALLY behind, this surprises me a lot actually. Thanks for showing me that awesome benchmark page :D

Re:Google’s robots.txt parser is now open source by recursive on Monday July 01, 2019 @03:21PM (#20328802)
Presumably less startup time and JIT.
Re:Google’s robots.txt parser is now open source by igouy on Tuesday July 02, 2019 @11:26AM (#20336036)
The run times are seconds not micro-seconds.

How many seconds do you suppose startup time is for those tiny programs?

How many seconds do you suppose JIT is for those tiny programs?

Re:Google’s robots.txt parser is now open source by spullara on Tuesday July 02, 2019 @03:05AM (#20332846)
Depends on if the Java code is ahead of time compiled or not. The AOT compiler is included in the latest JDKs.
Re:Google’s robots.txt parser is now open source by igouy on Tuesday July 02, 2019 @11:15AM (#20335911)
Re:Google’s robots.txt parser is now open source by spullara on Tuesday July 02, 2019 @02:43PM (#20338133)
Nice, good to know the JIT is doing something. Will be interesting to track the performance of this over time.
Re:Google’s robots.txt parser is now open source by igouy on Tuesday July 02, 2019 @03:53PM (#20338806)
And that's graalvm-ce not the enterprise edition.
Re:Google’s robots.txt parser is now open source by davismwfl on Monday July 01, 2019 @12:34PM (#20327038)
> they all perform roughly the same.

This argument to me is usually comes from people who have not done projects of significant scale or that required high performance, which is fine not everyone works on that level of a project. But the small difference of 10ms per operation when having to do a million operations is nearly 2.7 hours of extra time. Even 1ms is an extra 0.25/hr in time. These things start adding up when you are talking about doing millions of operations. And there is nothing wrong with Go or Rust or Python, just they aren't always the right tool in the toolbox when you need raw performance. Neither is C/C++ the right tool if you don't need that level of control/performance.

When doing distributed systems or embedded work you generally learn these rules quickly as one "ok" performing system can wreck a really well planned system, or start costing a ton of money to spin up 10x the number of instances just because of one software component isn't performant.

Re:Google’s robots.txt parser is now open source by neetdeth on Monday July 01, 2019 @02:16PM (#20328139)
Rust was created by/for systems programmers who are in exactly that situation - where performance and control are not optional - and thus have been stuck writing C++ for decades. Although C++ has evolved over the years, there are pain points, particularly regarding modularity, that persist and may require a clean break.

It's still somewhat early but I do already see software being written in Rust with best in class performance (take ripgrep for a prominent example), so lumping it in with Go and Python is really a category error in my opinion.

Personally, I'm still writing C++ for the platform support, etc. but not pretending to like it.

Re:Google’s robots.txt parser is now open source by davismwfl on Monday July 01, 2019 @06:15PM (#20330266)
Yea, I see your point, lumping Rust in with Python or Go isn't really fair nor accurate.

Totally agree C++ definitely has pain points still, but I do love the fact C++ is getting pretty regular updates so it is getting better and less painful generally. Rust is something I want to use in production but haven't seen the right opportunity to do it where the risk to reward ratio was right, yet.

Re:Google’s robots.txt parser is now open source by penagwin on Monday July 01, 2019 @03:24PM (#20328826)
I concede that I mostly work on web applications that don't require that level of performance.

You're certainly right, there IS a performance difference, and in high-computing workloads, such as the one this parser is used for.

From a "regular" web developer perspective (ie. where you only a few servers/VPS's MAX) a lot of newcomers often worry about performance, and usually for most web development the answer with performance is "Yes language [here] is faster then Python/Javascript/Ruby/etc. But those languages/frameworks allow us to develop our application far faster, and ~10ms isn't an issue." Only after performance bottlenecks are discovered would we consider breaking out pieces into a lower level language.

You're completely right though, in HPC it is totally worth worrying about every millisecond, I took the wrong perspective with the implications of the performance differences.

Re:Google’s robots.txt parser is now open source by davismwfl on Monday July 01, 2019 @06:25PM (#20330332)
To be fair, most people do not work on applications that need that level of performance.

Most of the time, and to your point, that level of performance isn't necessary so using a language that is less likely to let you take your foot off is generally the best & most correct choice. I only resort back to C/C++ when I need the pure raw performance like this parser would, or when doing embedded work. Otherwise I reach for other tools in the tool-bag that are less likely to let me maim myself unintentionally.

Re:Google’s robots.txt parser is now open source by Someone on Monday July 01, 2019 @12:08PM (#20326764)
“Most code” is debatable, but one of golang’s goals is ”Go compiles quickly to machine code” (https://golang.org/doc/). Because of that, I can see it being slower than C++ on code that benefits a lot from optimization. That makes it not the right choice for code that runs a lot, as this code likely does (I expect this code runs for many CPU-years each day)
Re:Google’s robots.txt parser is now open source by penagwin on Monday July 01, 2019 @03:55PM (#20329129)
I didn't realize how far off Go's performance was from C/CPP, I have a feeling a lot of it is because of the 25+ years of optimization the c/CPP compilers have gotten.
Re:Google’s robots.txt parser is now open source by dgellow on Monday July 01, 2019 @04:55PM (#20329657)
Go has a “stop the world” garbage collector, and some language features also have performance penalty (defer is well known for being slow). Just to say that’s not only a question of time, even if you wait and invest a huge amount of time and money you will see differences in performances because of language design choices.
Re:Google’s robots.txt parser is now open source by qtplatypus on Monday July 01, 2019 @10:40PM (#20331682)
Go has a concurrent GC not a stop the world GC.
Re:Google’s robots.txt parser is now open source by dgellow on Tuesday July 02, 2019 @04:08AM (#20333148)
Right, thanks for correcting. That doesn’t change my point though.
Re:Google’s robots.txt parser is now open source by igouy on Monday July 01, 2019 @02:20PM (#20328184)
> I don't believe this is the case.

Please show why you don't believe this is the case.

Re:Google’s robots.txt parser is now open source by penagwin on Monday July 01, 2019 @03:26PM (#20328842)
I don't mean to be rude, but the rest of my comment explains why. If there's something about it that's confusing I'd love to clarify it.
Re:Google’s robots.txt parser is now open source by igouy on Monday July 01, 2019 @07:46PM (#20330831)
> the rest of my comment explains why

The rest of the comment makes some claims about performance, but does not show why we should believe those claims.