Click here to Skip to main content
15,881,089 members
Home / Discussions / C#
   

C#

 
GeneralRe: add code to build millisecond to testing progressbar in c# 2008 Pin
KaKoten11-Sep-14 1:39
KaKoten11-Sep-14 1:39 
QuestionAny **FAST** way to convert IEnumerable to IEnumerable<T>? Pin
SledgeHammer019-Sep-14 18:16
SledgeHammer019-Sep-14 18:16 
GeneralRe: Any **FAST** way to convert IEnumerable to IEnumerable<T>? Pin
PIEBALDconsult9-Sep-14 19:42
mvePIEBALDconsult9-Sep-14 19:42 
GeneralRe: Any **FAST** way to convert IEnumerable to IEnumerable<T>? Pin
SledgeHammer019-Sep-14 20:07
SledgeHammer019-Sep-14 20:07 
GeneralRe: Any **FAST** way to convert IEnumerable to IEnumerable<T>? Pin
Pete O'Hanlon9-Sep-14 20:46
mvePete O'Hanlon9-Sep-14 20:46 
GeneralRe: Any **FAST** way to convert IEnumerable to IEnumerable<T>? Pin
SledgeHammer0110-Sep-14 6:46
SledgeHammer0110-Sep-14 6:46 
GeneralRe: Any **FAST** way to convert IEnumerable to IEnumerable<T>? Pin
PIEBALDconsult10-Sep-14 3:14
mvePIEBALDconsult10-Sep-14 3:14 
GeneralRe: Any **FAST** way to convert IEnumerable to IEnumerable<T>? Pin
SledgeHammer0110-Sep-14 6:42
SledgeHammer0110-Sep-14 6:42 
PIEBALDconsult wrote:
That may be, but unless you try it (and/or the Enumerator you show) you'll never
know for sure -- you're only acting on hearsay or prejudice. Get a baseline
reading, then try something else and get another reading, etc. You're assuming
that what you have is "much" faster, but it may not be, you need metrics.

 

What are you trying to do?
Why are you accepting an object[] of
them; can you correct this upstream?
And what actual types are involved?
Value types? Structs? Small simple classes? Large complex classes?


Ok Smile | :) ... well, for the sake of the thread, I did... its not "much, much slower" as I thought it would be... but it is quite a bit slower (about 15%). 3900ms vs 4500ms Frown | :(

What I'm trying to do is given an array of some unknown (at compile time) object (which is why I store them as object[]), I need to convert said object[] into an IEnumerable T where T is known at compile time by the caller of my class.

I could potentially store a T[], but unfortunately, my class has non-T overloads. So its kind of like I need to support:

T GetTheObjects<T>();
IEnumerable<SomeClass> enum = GetTheObjects<SomeClass>();


object GetTheObjects(Type type);
IEnumerable<SomeClass> enum = (IEnumerable<SomeClass>)GetTheObjects(typeof(SomeClass));

If I only had to support the T overloads, I could avoid boxing / unboxing...


PIEBALDconsult wrote:
And that cast to object looks redundant.


Agreed. That's how Reflector shows it. I tried c&p'ing that static method into my dll and removing the extra cast, but it didn't affect performance.
Questionadd row to datagridview by checking child node check box of treeview Pin
Member 110597999-Sep-14 15:39
Member 110597999-Sep-14 15:39 
AnswerRe: add row to datagridview by checking child node check box of treeview Pin
Member 1105979911-Sep-14 7:55
Member 1105979911-Sep-14 7:55 
QuestionChat Application Pin
Kevin Marois9-Sep-14 11:23
professionalKevin Marois9-Sep-14 11:23 
AnswerRe: Chat Application Pin
Ravi Bhavnani9-Sep-14 11:36
professionalRavi Bhavnani9-Sep-14 11:36 
GeneralRe: Chat Application Pin
Kevin Marois9-Sep-14 11:37
professionalKevin Marois9-Sep-14 11:37 
GeneralRe: Chat Application Pin
Ravi Bhavnani9-Sep-14 11:39
professionalRavi Bhavnani9-Sep-14 11:39 
GeneralRe: Chat Application Pin
Kevin Marois9-Sep-14 11:40
professionalKevin Marois9-Sep-14 11:40 
GeneralRe: Chat Application Pin
Kevin Marois9-Sep-14 11:46
professionalKevin Marois9-Sep-14 11:46 
GeneralRe: Chat Application Pin
Ravi Bhavnani9-Sep-14 11:57
professionalRavi Bhavnani9-Sep-14 11:57 
GeneralRe: Chat Application Pin
Kevin Marois9-Sep-14 11:58
professionalKevin Marois9-Sep-14 11:58 
GeneralRe: Chat Application Pin
Ravi Bhavnani9-Sep-14 12:00
professionalRavi Bhavnani9-Sep-14 12:00 
GeneralRe: Chat Application Pin
PIEBALDconsult9-Sep-14 13:58
mvePIEBALDconsult9-Sep-14 13:58 
GeneralRe: Chat Application Pin
Kevin Marois9-Sep-14 14:01
professionalKevin Marois9-Sep-14 14:01 
GeneralRe: Chat Application Pin
PIEBALDconsult9-Sep-14 14:16
mvePIEBALDconsult9-Sep-14 14:16 
AnswerRe: Chat Application Pin
PIEBALDconsult9-Sep-14 12:20
mvePIEBALDconsult9-Sep-14 12:20 
GeneralRe: Chat Application Pin
Kevin Marois9-Sep-14 12:27
professionalKevin Marois9-Sep-14 12:27 
GeneralRe: Chat Application Pin
PIEBALDconsult9-Sep-14 13:25
mvePIEBALDconsult9-Sep-14 13:25 

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.