Click here to Skip to main content
15,919,245 members
Home / Discussions / C#
   

C#

 
GeneralRe: GPS Data String Pin
Mark Churchill9-Feb-08 14:34
Mark Churchill9-Feb-08 14:34 
QuestionStatic function explained Pin
steve_rm9-Feb-08 2:38
steve_rm9-Feb-08 2:38 
GeneralRe: Static function explained Pin
Not Active9-Feb-08 2:42
mentorNot Active9-Feb-08 2:42 
GeneralRe: Static function explained Pin
DeveshKumar9-Feb-08 5:10
DeveshKumar9-Feb-08 5:10 
GeneralRe: Static function explained Pin
Pete O'Hanlon9-Feb-08 9:29
mvePete O'Hanlon9-Feb-08 9:29 
GeneralLinq query vs foreach loop [modified] Pin
DaveyM699-Feb-08 1:13
professionalDaveyM699-Feb-08 1:13 
GeneralRe: Linq query vs foreach loop Pin
That's Aragon9-Feb-08 1:30
That's Aragon9-Feb-08 1:30 
GeneralRe: Linq query vs foreach loop Pin
Daniel Grunwald9-Feb-08 2:27
Daniel Grunwald9-Feb-08 2:27 
LINQ is a bit slower due to the overhead of tons of method calls (there are lots of calls to MoveNext() and the closure). The current JIT is not able to optimize this, but it's possible to write an IL-level optimizer that inlines all LINQ method calls, then inlines the closure method calls and removes the closure objects, converting the fields representing captured variables back into local variables.
I've written a prototype optimizer that can remove the closure in code like this:
static List<int> someIntList = new List<int>();

static bool ExistsTest(int divisor)
{
	return Exists(someIntList, i => i % divisor == 0);
}

static bool Exists(IEnumerable<int> input, Predicate<int> pred)
{
	if (pred == null) {
		throw new ArgumentNullException("pred");
	}
	foreach (int i in input) {
		if (pred(i))
			return true;
	}
	return false;
}</int></int></int></int>

What's missing until it gets useful is cross-assembly inlining and support for generic methods.



GeneralRe: Linq query vs foreach loop Pin
DaveyM699-Feb-08 3:04
professionalDaveyM699-Feb-08 3:04 
GeneralRe: Linq query vs foreach loop Pin
Gareth H9-Feb-08 1:31
Gareth H9-Feb-08 1:31 
GeneralRe: Linq query vs foreach loop Pin
Daniel Grunwald9-Feb-08 2:36
Daniel Grunwald9-Feb-08 2:36 
GeneralRe: Linq query vs foreach loop Pin
DaveyM699-Feb-08 3:03
professionalDaveyM699-Feb-08 3:03 
GeneralRe: Linq query vs foreach loop Pin
WillemM9-Feb-08 7:54
WillemM9-Feb-08 7:54 
GeneralRe: Linq query vs foreach loop Pin
DaveyM699-Feb-08 8:29
professionalDaveyM699-Feb-08 8:29 
GeneralRe: Linq query vs foreach loop Pin
Guffa9-Feb-08 8:30
Guffa9-Feb-08 8:30 
GeneralRe: Linq query vs foreach loop Pin
DaveyM699-Feb-08 8:44
professionalDaveyM699-Feb-08 8:44 
GeneralRe: Linq query vs foreach loop Pin
Guffa9-Feb-08 11:40
Guffa9-Feb-08 11:40 
GeneralRe: Linq query vs foreach loop Pin
Guffa13-Feb-08 8:19
Guffa13-Feb-08 8:19 
QuestionDocument scanning in C# Pin
Member 26713148-Feb-08 23:27
Member 26713148-Feb-08 23:27 
GeneralRe: Document scanning in C# Pin
Gareth H9-Feb-08 1:33
Gareth H9-Feb-08 1:33 
GeneralRe: Document scanning in C# Pin
Thomas Stockwell9-Feb-08 2:49
professionalThomas Stockwell9-Feb-08 2:49 
GeneralRe: Document scanning in C# Pin
Pete O'Hanlon9-Feb-08 9:27
mvePete O'Hanlon9-Feb-08 9:27 
GeneralRe: Document scanning in C# Pin
Member 267131411-Feb-08 6:44
Member 267131411-Feb-08 6:44 
QuestionResultant Image???? Pin
jamilkhan0078-Feb-08 23:00
jamilkhan0078-Feb-08 23:00 
Questionmy program How to print a pyramid is not working properly Pin
Member 43170178-Feb-08 22:08
Member 43170178-Feb-08 22:08 

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.