Hacker News new | ask | show | jobs
by corresation 4484 days ago
There's no fundamental reason why LINQ to Objects should be any slower than say a foreach over a set.

There's no fundamental reason why LINQ to Objects should be any faster than a foreach over a set. Which is precisely the point. LINQ has an amazing way of hiding details in a manner that allows for massively inefficient code to look completely innocuous. For throw-away, one-off "command line utility to convert A to B" type code, it is absolutely golden. For long-term use code that may be called millions of times, it can be disastrous.

You have no interest in a reasoned discussion, and your argument style is best described as defensive. That is all. Have a nice day.

1 comments

This is quite incredible. Maybe have a read through the various arguments you're having on this entire topic and see who's being defensive. If you really cared about performance you wouldn't use C#, you'd use C or C++. Anything where you could absolutely control every aspect of memory allocation, memory access, bounds checking, IO, etc.

I'm out of this thread, it's not adding to the discussion.

If you really cared about performance you wouldn't use C#, you'd use C or C++

This, in a nutshell, is your argument. And it's an incredibly poor, out of place argument that is founded on ignorance, and does absolutely no service to .NET.

Performance in most modern applications is achieved through proper algorithms and data structures. LINQ is often a hasty short-cut around those, but it offers the illusion of elegance such that many people (such as, apparently, you. It's all functional-like and such, so it has to be good, right?), are blissfully unaware.

Again, a lot of the time that's perfectly fine and causes no real harm -- similar to the way regular expressions might be a costly but powerful catch all -- but in other cases it is not good. That is the case with large scale financial software. If you have a different experience, good for, but simply saying "incredible!" over and over again does absolutely nothing to make your case.

Taking a line out of DHH's playbook, perhaps it would be better to discuss a concrete code sample. E.g https://news.ycombinator.com/item?id=7335211