none
IDisposable and struct. Finally cost RRS feed

All replies

  • Why ask at a forum?  Measure it yourself.  Use System.Diagnostics.Stopwatch and loop a million times over the code you want to profile.
    Hans Passant.
    Friday, December 5, 2008 1:58 PM
    Moderator
  • Ho, but I will (in this particular case I haven' done yet), even without the stopwatch, which were missing in 1.0.

    But apart from that, I was looking for some answer-opinions about the stack-struct-idisposable  "problems"


    Thank you anyway ;-)
    Friday, December 5, 2008 3:37 PM
  • What problem are you talking about?  Your question was about perf.
    Hans Passant.
    Saturday, December 6, 2008 12:34 AM
    Moderator
  •  

    That is explained in the link in my first message. It is not so much a “problem” than a design/implementation question. Why it is relevant here, is because maybe somebody has opinions related to the way value type are treated in .NET.

    I think there is a missing feature, and it struck me that it would be so easy to support. But because I know better of trusting my opinion only, I would like to find some sources of information.
     

    Is Emitting try-finaly, Dispose call (to empty method) in IL, and then having them *probably?* optimize on the fly by the jit compiler a good design principle ? (I cannot believe that a List<T>.Enumarator (probably in the top10 most created object ever) will became actual cpu wasted cycle (regarding the IDispose implementation))

    But then my question is to fulfill my ignorance, because there will be many runtime to test, on many hardware, with much more complications involve that the few I can guess (like having too much exception handler on the stack). I knew already that simply timing a loop is not enough to have a good point a view (although it helps ;-)

    Monday, December 8, 2008 12:16 PM