Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>"I've had been told [by whom?] that since .net linq is so slow [for what?] we shouldn't use it"</p> <p>In my experience, basing decisions such as what technique, library or language to use solely on what <em>someone</em> has <em>once</em> told you is a bad idea. </p> <p>First of all, does the information come from a source you trust? If not, you might be making a huge mistake trusting this (perhaps unknown) person to make your design decisions. Secondly, is this information still relevant today? But okay, based on your simple and not very realistic benchmark, you've concluded that LINQ is slower than manually performing the same operation. The natural question to ask yourself is this: is this code performance critical? Will the performance of this code be limited by <em>other</em> factors than the execution speed of my LINQ query -- think database queries, waiting on I/O, etc?</p> <p>Here's how I like to work:</p> <ol> <li>Identify the problem to be solved, and write the simplest feature-complete solution given the requirements and limitations you already know of</li> <li>Determine whether your implementation actually fulfills the requirements (is it fast enough? Is the resource consumption kept at an acceptable level?).</li> <li>If it does, you're done. If not, look for ways to optimize and refine your solution until it passes the test at #2. This is where you <em>may</em> need to consider giving up on something because it's too slow. Maybe. Chances are, though, that the bottleneck isn't where you expected it to be at all.</li> </ol> <p>To me, this simple method serves a single purpose: <strong>maximizing</strong> my productivity by <strong>minimizing</strong> the time I spend improving code that is already perfectly adequate. </p> <p>Yes, the day might come when you find that your original solution doesn't cut it any more. Or it might not. If it does, deal with it then and there. I suggest you avoid wasting your time trying to solve hypothetical (future) problems.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload