Could you hire me? Contact me if you like what I’ve done in this article and think I can create value for your company with my skills.

July 28, 2006 / by Zsolt Soczó

Az inline optimalizálás szivatásai

Érdekes esetbe ütköztem.

private static string SettingName()
{
  StackTrace st = new StackTrace();
  StackFrame sf = st.GetFrame(2);
  return sf.GetMethod().Name.Substring(4);
}

private static object GetItemFromStore()
{
   return GetItemFromStore((PersistentSettingsKeys)Enum.Parse(
   typeof(PersistentSettingsKeys),
   SettingName()));
}

No, ami ebben érdekes, hogy a debug verzió simán lefut, a release viszont elszáll, mert a stack frame 1-el rövidebb! A Jitter inlineosítja a SettingName-et, így a reflection is eggyel elcsúszik. Ez nekem azért meglepő, mert az IL kódban még nincs inline-osítás (ok, az nem is egy managed compiler dolga), de ami meglepő, hogy a jitter inline látszik a reflectionön keresztül. A megoldás persze elég egyszerű,

[MethodImpl(MethodImplOptions.NoInlining)]

kell a SettingName elé.

 

(Ha valaki tudna segíteni hogyan lehet kódot szépen elhelyezni wordpressben kérdem segítsen.)

Could you hire me? Contact me if you like what I’ve done in this article and think I can create value for your company with my skills.

LEAVE A COMMENT

4 COMMENTS

  • Meister July 31, 2006

    code {
    font: 1.1em ‘Courier New’, Courier, Fixed;
    }

    helyett:
    code {
    font: 1.1em ‘Courier New’, Courier, Fixed;
    text-align: center;
    font-size: 9pt;
    }

    A 9pt helyett lehet 10, vagy nagyobb kell.

  • Meister July 31, 2006

    Ja, s mindezt ebbe a fájlba:
    http://soci.hu/blog/wp-content/themes/default/style.css

    Aztán még fontos, hogy kijött a 2.0.4-es WP, érdemes frissíteni.

  • Meister July 31, 2006

    Valamint segítehetek a blogod magyarításában is. :-)

    És emellett tudok segíteni mod_rewrite helyettesítésben is IIS6 alatt, ha érdekel, s akkor a cikkek URL-jéből kimaradhat az index.php/

  • Soczó Zsolt August 1, 2006

    Amint lesz rá időm-szándékom érdekelni fog, köszi. A frissítést megcsináltam már tegnap.