Click here to Skip to main content
15,884,472 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: The sky was looking ominous so I asked Siri ... Pin
jeron18-Feb-21 12:16
jeron18-Feb-21 12:16 
GeneralRe: The sky was looking ominous so I asked Siri ... Pin
DRHuff8-Feb-21 16:07
DRHuff8-Feb-21 16:07 
GeneralRe: The sky was looking ominous so I asked Siri ... Pin
jeron19-Feb-21 4:12
jeron19-Feb-21 4:12 
GeneralRe: The sky was looking ominous so I asked Siri ... Pin
davecasdf9-Feb-21 5:04
davecasdf9-Feb-21 5:04 
GeneralRe: The sky was looking ominous so I asked Siri ... Pin
Jörgen Andersson8-Feb-21 20:45
professionalJörgen Andersson8-Feb-21 20:45 
GeneralRe: The sky was looking ominous so I asked Siri ... Pin
Richard Deeming8-Feb-21 22:13
mveRichard Deeming8-Feb-21 22:13 
QuestionRe: The sky was looking ominous so I asked Siri ... Pin
Eddy Vluggen9-Feb-21 8:52
professionalEddy Vluggen9-Feb-21 8:52 
GeneralUnpopular opinions: LINQ PinPopular
honey the codewitch8-Feb-21 7:57
mvahoney the codewitch8-Feb-21 7:57 
I'm not a fan of LINQ. I love functional programming but .NET's enumerator paradigm is not up to the task. It creates too many objects too quickly to be a real grown up functional language, whose iteration is highly optimized because it's a first class operation.

I've benched LINQ against hand written pseudo-functional operations that do the same thing. It was not encouraging. For things that make heavy use of functional computation like parser generators, where your LINQ query might be half a page, it's a Bad Idea(TM)

Worse, I think its use has been over encouraged by Microsoft. It makes green developers write even worse code, and makes it harder for a seasoned developer to understand the performance implications of the code they are writing (and I'm not talking about bit twiddling here, I'm talking about figuring out your Big O expression)

I tend to avoid its use, preferring - at least in C# - to make my iteration operations explicit and long hand. If .NET had truly optimized iteration paradigm - one that didn't create new objects for every single iteration operation** - i might consider using it.

** yes i understand that LINQ combines multiple operations into a single iteration *sometimes* - in practice it's not often enough to make up for the overhead of enumerators.

Now, there's a case where all of the above doesn't matter, and that's PLINQ.

Theoretically, for a large enough operation, that can be highly parallelized, the overhead of enumerators suddenly isn't the biggest part of the performance equation. What I mean is it essentially pays for itself. Also, given the issues with synchronization and other cross task communication (is your operation clustered over a network?) enumerators are actually not a bad idea since you can lock behind them or RPC behind them. Contrast that with C++ iterators that are usually lightly wrapped pointer ops and you realize their limitations fast: In order to enable all of the stuff you need to make iteration operations work with each other in parallel you have to wrap every iterator operator anyway, making it as "heavy" as an enumerator in .NET, not counting the general overhead of running managed code.

So basically, PLINQ is where LINQ finally covers its costs - where it reaches the point where its advantages outweigh its disadvantages.

All of this of course, is one developer's opinion.

And some of this doesn't necessarily apply to business software, where performance almost doesn't matter for most scenarios.
Real programmers use butterflies

GeneralRe: Unpopular opinions: LINQ Pin
PIEBALDconsult8-Feb-21 8:00
mvePIEBALDconsult8-Feb-21 8:00 
GeneralRe: Unpopular opinions: LINQ Pin
honey the codewitch8-Feb-21 8:02
mvahoney the codewitch8-Feb-21 8:02 
GeneralRe: Unpopular opinions: LINQ Pin
User 150257758-Feb-21 8:08
User 150257758-Feb-21 8:08 
GeneralRe: Unpopular opinions: LINQ Pin
User 150257758-Feb-21 8:14
User 150257758-Feb-21 8:14 
GeneralRe: Unpopular opinions: LINQ Pin
honey the codewitch8-Feb-21 8:15
mvahoney the codewitch8-Feb-21 8:15 
GeneralRe: Unpopular opinions: LINQ Pin
User 150257758-Feb-21 8:41
User 150257758-Feb-21 8:41 
GeneralRe: Unpopular opinions: LINQ Pin
PIEBALDconsult8-Feb-21 8:14
mvePIEBALDconsult8-Feb-21 8:14 
GeneralRe: Unpopular opinions: LINQ Pin
User 150257758-Feb-21 8:17
User 150257758-Feb-21 8:17 
GeneralRe: Unpopular opinions: LINQ Pin
honey the codewitch8-Feb-21 8:19
mvahoney the codewitch8-Feb-21 8:19 
GeneralRe: Unpopular opinions: LINQ Pin
Daniel Pfeffer8-Feb-21 8:27
professionalDaniel Pfeffer8-Feb-21 8:27 
GeneralRe: Unpopular opinions: LINQ Pin
honey the codewitch8-Feb-21 8:31
mvahoney the codewitch8-Feb-21 8:31 
GeneralRe: Unpopular opinions: LINQ Pin
Daniel Pfeffer8-Feb-21 8:39
professionalDaniel Pfeffer8-Feb-21 8:39 
GeneralRe: Unpopular opinions: LINQ Pin
honey the codewitch8-Feb-21 8:44
mvahoney the codewitch8-Feb-21 8:44 
GeneralRe: Unpopular opinions: LINQ Pin
Roger House9-Feb-21 8:14
Roger House9-Feb-21 8:14 
GeneralRe: Unpopular opinions: LINQ Pin
Rick York8-Feb-21 16:12
mveRick York8-Feb-21 16:12 
GeneralRe: Unpopular opinions: LINQ Pin
honey the codewitch8-Feb-21 16:19
mvahoney the codewitch8-Feb-21 16:19 
GeneralRe: Unpopular opinions: LINQ Pin
afigegoznaet9-Feb-21 1:26
professionalafigegoznaet9-Feb-21 1:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.