Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8688113
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T23:16:41+00:00 2026-06-12T23:16:41+00:00

Iam playing with lambda, linq and parallel and one question arrives. Is lambda faster

  • 0

Iam playing with lambda, linq and parallel and one question arrives.

Is lambda faster than linq queries?

O write some test code (Fork it in GitHub) and the lambda method seems faster. It is true or i am missing something?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T23:16:42+00:00Added an answer on June 12, 2026 at 11:16 pm

    Your queries aren’t the same.

    Query expression:

    from p in lista 
    where p.Age > 18 && p.Age < 60 && p.Phone.StartsWith("11")
    select p
    

    Regular extension method calls:

    .Where(n => n.Age > 18).
     Where(n => n.Age < 60).
     Where(n => n.Phone.StartsWith("11"))
    

    The first one calls Where once; the second calls Where three times. To make them behave exactly the same you should use:

    .Where(n => n.Age > 18 && n.Age < 60 && n.Phone.StartsWith("11"))
    

    At that point, the two forms will compile to exactly the same code.

    Additionally, there’s a huge hole in your testing: you’re testing building the query… you’re never actually evaluating it:

    sw.Start();
    IEnumerable listaSemParalelismoLinq = from p in lista
                                          where p.Age > 18 && p.Age < 60 && 
                                                p.Phone.StartsWith("11")
                                          select p;
    sw.Stop();
    

    You must use the query in some form, e.g. calling Count() on it, in order to make it actually “execute”. (You’ll need to change the type to the generic IEnumerable form, e.g. using var.) The time taken to simply construct the query is basically irrelevant in almost all cases.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am playing around with the HTML canvas and write some text on it
I am playing around with ctypes a little bit to massage some C code
I am playing up with some code and have problem with my site master
I am playing around with backbone and gmaps.js and for some reason the map
I am playing around with d3 to build some scatter plots. For some reason,
iam playing around with OPEN CV from Intel with the associated PHP Extensions. Works
Iam looking for playing media files inside webview Can you please help me out
I just started playing with lambdas and Linq expression for self learning. I took
I am playing with the FileSystem API in Google Chrome 16 but can't write
I need some help making a linq query that will select a list of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.