News for hackers. Stuff that matters.
Re:Performance comparison: counting words in Python, Go, C++... by ZeroGravitas on Monday March 15, 2021 @08:47AM (#26465406)
I can't really wrap my head around these types of question.

Surely the correct answer is "use some established third party library that does this exact task well". Probably faster, better battle tested against weird input, localised etc etc than anything you can come up with by yourself.

Though obviously that is then useless if the interview is actually for someone who can actually write something like this for some super secret internal thing that is nothing like the problem solved by the standard solutions available. But is that really the case? I have doubts.

If I was hiring though, I'd be more worried about hiring people who would write standard elements from scratch (mostly because that's more fun) than re-use standard building blocks to get a task done correctly.

e.g. for this specific question I'd be most impressed with someone who could talk about Spacy or some other standard library that can do a lot of things in this area very quickly but also be repurposed to do interesting new things. Do I need someone who can write Spacy from scratch or someone who can use Spacy?

Immediately optimising by ignoring non-ASCII and punctuation seems mor elike a red flag than a positive.

Re:Performance comparison: counting words in Python, Go, C++... by jlg23 on Monday March 15, 2021 @08:51AM (#26465453)
> Surely the correct answer is "use some established third party library that does this exact task well". Probably faster, better battle tested against weird input, localised etc etc than anything you can come up with by yourself.

The point of questions like this is to test basic understanding, not the ability to search on SO or similar.

> If I was hiring though, I'd be more worried about hiring people who would write standard elements from scratch (mostly because that's more fun) than re-use standard building blocks to get a task done correctly.

As long as the hire is able to fix/extend the 3rd party library on their own... this is exactly what you figure out with "these types of questions".

Re:Performance comparison: counting words in Python, Go, C++... by hamburglar on Monday March 15, 2021 @08:58AM (#26465543)
It seems almost disingenuous to me to miss the point of this type of interview question, because it is so obvious that the intention is “imagine a scenario where you need to do a high performance implementation of some very well-defined task, for which you don’t have a super fast utility function. Let’s use word frequency counting as an example and ignore the fact that such a problem is almost certainly already solved.” It’s implicit in the asking of the question that they aren’t actually in need of word counts on arbitrary bodies of text and need your help solving that problem. It’s a programming interview. Accept the premise and show them that you can program.
Re:Performance comparison: counting words in Python, Go, C++... by Veedrac on Monday March 15, 2021 @01:15PM (#26468678)
It does irk me too. Being a programmer requires understanding the complexities hidden behind a task, and this brushes them all aside as if they don't matter.

There are cases where your task is nice, simple, and well-defined, but word counting is not one of them. It's better to give a more realistic task that allows people to think about the premises.

Re:Performance comparison: counting words in Python, Go, C++... by hamburglar on Monday March 15, 2021 @01:42PM (#26469017)
Being a programmer involves a lot of things that are difficult to test for all at once in 45 minutes. Be irked all you want, but it seems counterproductive to pretend what’s being asked is in anyway unclear or unreasonable when you’re given a pure programming question with a clear spec. You’re supposed to write the code. That’s all.
Re:Performance comparison: counting words in Python, Go, C++... by Veedrac on Monday March 15, 2021 @01:46PM (#26469068)
My problem isn't that the spec is unclear, it's that the spec is silly. The task makes no sense, and selects for misusing tools. This makes it a bad interview question as given.
Re:Performance comparison: counting words in Python, Go, C++... by hamburglar on Monday March 15, 2021 @06:30PM (#26470138)
I’d argue that the problem does make perfect sense and isn’t a “misuse of tools” if you manage to understand the goal of the interviewer, which is “watch this person write code for a solution to a well-specified but arbitrary (perhaps even silly) problem.”
Re:Performance comparison: counting words in Python, Go, C++... by EvilEy3 on Monday March 15, 2021 @06:10PM (#26469895)
This is litmus test to weed out people who pretend to be programmers. You assess complexities hidden behind the task in system design round.
Re:Performance comparison: counting words in Python, Go, C++... by Veedrac on Monday March 15, 2021 @07:06PM (#26470481)
I was more viewing this in context of the article, which goes on to micro-optimize a version with an IMO unreasonable set of assumptions.

If it's instead explicitly given that this is a quick litmus test, the choices of the first pass implementation don't really matter, and you'll talk about complexities after, then sure.

Re:Performance comparison: counting words in Python, Go, C++... by hamburglar on Monday March 15, 2021 @09:32AM (#26465875)
... otherwise the proper answer is probably “I would recognize I’m sitting in a room with someone who has likely already put enough thought into this task that they could be considered an expert on the solution and I would consult them on the best solution rather than reinventing the wheel,” which would almost certainly not get you hired.
Re:Performance comparison: counting words in Python, Go, C++... by superdimwit on Monday March 15, 2021 @09:26AM (#26465811)
Who writes the third party library, though?
Re:Performance comparison: counting words in Python, Go, C++... by lionkor on Monday March 15, 2021 @10:45AM (#26466639)
SomeOtherGuyWhoCares™ in cooperation with ItWorksOnMyMachineSoYourMachineIsBroken Inc.
Re:Performance comparison: counting words in Python, Go, C++... by IshKebab on Monday March 15, 2021 @09:47AM (#26466040)
> use some established third party library that does this exact task well

I seriously doubt such a library exists for most languages (Javascript might be an exception because they seem to love writing one-line libraries). It's such a simple task!