Posted By: Charles | May 17th, 2007 @ 6:25 PM | 23,967 Views | 12 Comments
Meet Luke Hoban, Program Manager on the C# Compiler team. Here, we talk about how LINQ works, from a compiler point of view. As you know by now, LINQ is a construct that is built of new language level innovations which of course must have compiler support... As you might imagine, given the nature of LINQ's requisite language level components, we talk about functional programming and it's new role in our good old imperative world. In Orcas, you shouldn't talk about LINQ without showing it in action inside of Visual Studio.

Enjoy.

For the detail-oriented folks out there: I shot this interview a few months ago, so you'll hear references to the Feb/March CTP. Have no fear, Niners, the content in this interview is as pertinent now as it was then (even more so with the release of Orcas beta 1).
Media Downloads:
Rating:
0
0
Charles,

At the begining of the program, you mentioned "February CTP". Did I hear you right? If so, is this old video? I have not gone through the whole video yet.

Thanks.
Raghu/..
Sorry. I should have read your comment. You did mention that it was old video.

Raghu/..
JoshRoss
JoshRoss
A righteous infliction of retribution manifested by an appropriate agent.
Way to go Charles, @ 18:10 whipping out the Distinct keyword! I really have to sharpen-up my linq skills. When I first used Orcas, I was disturbed how aggressively intelisense was in investigating my code. However, it saves a tremendous amount of time, which would otherwise be wasted staring at a blinking pipe. The results of better integration between the IDE and the compiler are truly impressive.
Chadk
Chadk
excuse me - do you has a flavor?
A young dude doing that kind of cool stuff. Respect! Big Smile
Great video!

I love the "simplicity" of LINQ and now I think it's even simpler after listening to Luke's explanations.

Would be nice if you could make a video where it's showed how to make a simple LINQ-to-X interface, since, I think, that where the real power of LINQ is unleashed Smiley

 - Dan


littleguru
littleguru
<3 Seattle
Chadk wrote:
A young dude doing that kind of cool stuff. Respect!


Damn! I want to get the internship next summer! I want to work and chat with you guys...

Great video, Charles - although you could have dug a little bit deeper - but it's hard when you see something for the first time. Smiley
RoyalSchrubber
RoyalSchrubber
One. How many time travellers does it take to change a lightbulb?
Nice video. Smiley

If anybody know, I would be very thankful if someone could explain me speed implications of the LINQ.

I've watche the video and it seems LINQ uses a lot of lambda functions, which I suspect are stack based. So are the linq expressions as fast as normal hand coded loops or they abuse stack and are thus slow. Can JIT compiler/Linq somehow inline those lambda functions to avoid suffering from stack over-use?

Or in other words, can I use linq for some serious math computations as a replacement for 'while' and 'for' statement?

Thanks for any answers. Big Smile
Inlining probably won't happen, because the JIT compiler would have to inline all the .Where, .Group, .Sort and .Select calls and those are definitely not short functions.
Apart from that, LINQ over in-memory structures is written against interfaces (if I'm not mistaken) and therefor uses virtual calls all over the place.
And yes, the lambda expressions are called via delegates.
littleguru
littleguru
<3 Seattle
SealedSun wrote:
Inlining probably won't happen, because the JIT compiler would have to inline all the .Where, .Group, .Sort and .Select calls and those are definitely not short functions.
Apart from that, LINQ over in-memory structures is written against interfaces (if I'm not mistaken) and therefor uses virtual calls all over the place.
And yes, the lambda expressions are called via delegates.


Hmmm. The .Where, .Group, .Sort, ... methods are defined in static classes (the in memory that come with .NET 3.5 - Enumerable is the static class name) and therefore in static methods. I think they can be inlined without any problems (They are also not that long, because they return only an IQueryable instance). The lambda expressions itself are very short and good candidates for inlining.

I wonder if somebody from the team could jump into this discussion and bring some light to it.
Microsoft Communities