Tech Off Post

Single Post Permalink

View Thread: is 'new object().property' or 'new object().method()' a good idea?
  • User profile image

    JChung2006 wrote:

    You missed the point so please just drop it.  Yes, reflection is slower than if the references were already there, but guess what?  Reflection is still faster than a network roundtrip or a disk seek by several orders of magnitude.

    "Premature optimization is the root of all evil." -C. A. R. Hoare

    Maybe, but compiler optimisations is one of the reasons your computer is getting faster year-on-year. It's not all hardware you know.

    And even if reflection is faster than a network roundtrip it's less maintainable code, and automatic reasoning agents can't reason over reflection code, so the compiler can't do any optimisations over the function call.

    But I'll assume I've missed the point, and stop pressing the issue.