Click here to Skip to main content
15,910,411 members
Home / Discussions / C#
   

C#

 
Questionint[] sort Pin
yesu prakash1-Apr-09 17:49
yesu prakash1-Apr-09 17:49 
AnswerRe: int[] sort Pin
Judah Gabriel Himango1-Apr-09 17:54
sponsorJudah Gabriel Himango1-Apr-09 17:54 
AnswerRe: int[] sort Pin
N a v a n e e t h1-Apr-09 18:02
N a v a n e e t h1-Apr-09 18:02 
GeneralRe: int[] sort Pin
Judah Gabriel Himango2-Apr-09 4:01
sponsorJudah Gabriel Himango2-Apr-09 4:01 
GeneralRe: int[] sort Pin
Luc Pattyn2-Apr-09 4:24
sitebuilderLuc Pattyn2-Apr-09 4:24 
GeneralRe: int[] sort Pin
Judah Gabriel Himango2-Apr-09 5:13
sponsorJudah Gabriel Himango2-Apr-09 5:13 
GeneralRe: int[] sort Pin
Luc Pattyn2-Apr-09 5:22
sitebuilderLuc Pattyn2-Apr-09 5:22 
GeneralRe: int[] sort Pin
Judah Gabriel Himango2-Apr-09 5:34
sponsorJudah Gabriel Himango2-Apr-09 5:34 
(I'm amused by this thread, as we've so wildly veered off helping this guy and are now deeply engaged in an irrelevant, pseudo-friendly programming pissing match! Smile | :) )

Is the compiler smart enough to convert that into a for loop? Otherwise we have the overhead of allocating an iterator, making a manual for loop being the fastest (or at least, requiring the fewest allocations).

Of course, we're trading readability for fewer allocations in the hopes of better performance, trading our nice declarative code for very detailed imperative code that's hard to optimize, since we're being so specific about how we want the results, rather than declaring the results we want.

In this era of 4 and 8 core desktop machines, with 32 cores coming in the next 5 years, perhaps the fastest and most readable will be:

var greatest = ints.AsParallel().OrderByDescending(i => i).First();

Oh hell yes.

Your move. Wink | ;)



Religiously blogging on the intarwebs since the early 21st century: Kineti L'Tziyon
Judah Himango



GeneralRe: int[] sort Pin
Luc Pattyn2-Apr-09 6:02
sitebuilderLuc Pattyn2-Apr-09 6:02 
GeneralRe: int[] sort Pin
Judah Gabriel Himango2-Apr-09 6:07
sponsorJudah Gabriel Himango2-Apr-09 6:07 
GeneralRe: int[] sort Pin
Luc Pattyn2-Apr-09 6:13
sitebuilderLuc Pattyn2-Apr-09 6:13 
GeneralRe: int[] sort Pin
Henry Minute2-Apr-09 4:27
Henry Minute2-Apr-09 4:27 
GeneralRe: int[] sort [modified] Pin
Judah Gabriel Himango2-Apr-09 5:16
sponsorJudah Gabriel Himango2-Apr-09 5:16 
GeneralRe: int[] sort Pin
Henry Minute2-Apr-09 6:25
Henry Minute2-Apr-09 6:25 
QuestionCreate table with DrawRectangle..?? Pin
iman_ridwan1-Apr-09 17:39
iman_ridwan1-Apr-09 17:39 
AnswerRe: Create table with DrawRectangle..?? Pin
Judah Gabriel Himango1-Apr-09 17:49
sponsorJudah Gabriel Himango1-Apr-09 17:49 
Questionstring comparision ignores escape sequence and html tags [modified] Pin
LiYS1-Apr-09 16:22
LiYS1-Apr-09 16:22 
AnswerRe: string comparision ignores escape sequence and html tags Pin
Judah Gabriel Himango1-Apr-09 17:32
sponsorJudah Gabriel Himango1-Apr-09 17:32 
GeneralThreading issue in winforms Pin
Mycroft Holmes1-Apr-09 16:22
professionalMycroft Holmes1-Apr-09 16:22 
GeneralRe: Threading issue in winforms Pin
Judah Gabriel Himango1-Apr-09 16:59
sponsorJudah Gabriel Himango1-Apr-09 16:59 
GeneralRe: Threading issue in winforms Pin
Mycroft Holmes1-Apr-09 17:16
professionalMycroft Holmes1-Apr-09 17:16 
GeneralRe: Threading issue in winforms Pin
Judah Gabriel Himango1-Apr-09 17:46
sponsorJudah Gabriel Himango1-Apr-09 17:46 
GeneralRe: Threading issue in winforms Pin
Mycroft Holmes1-Apr-09 17:56
professionalMycroft Holmes1-Apr-09 17:56 
GeneralRe: Threading issue in winforms Pin
N a v a n e e t h1-Apr-09 17:34
N a v a n e e t h1-Apr-09 17:34 
GeneralRe: Threading issue in winforms Pin
Mycroft Holmes1-Apr-09 17:54
professionalMycroft Holmes1-Apr-09 17:54 

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.