{"id":79,"date":"2006-07-28T20:32:32","date_gmt":"2006-07-28T18:32:32","guid":{"rendered":"http:\/\/soci.hu\/blog\/index.php\/2006\/07\/28\/az-inline-optimalizalas-szivatasai\/"},"modified":"2006-07-31T14:01:40","modified_gmt":"2006-07-31T12:01:40","slug":"az-inline-optimalizalas-szivatasai","status":"publish","type":"post","link":"https:\/\/soci.hu\/blog\/index.php\/2006\/07\/28\/az-inline-optimalizalas-szivatasai\/","title":{"rendered":"Az inline optimaliz\u00e1l\u00e1s szivat\u00e1sai"},"content":{"rendered":"<p>\u00c9rdekes esetbe \u00fctk\u00f6ztem.<\/p>\n<p><code>private static string SettingName()<br \/>\n{<br \/>\n\u00a0 StackTrace st = new StackTrace();<br \/>\n\u00a0 StackFrame sf = st.GetFrame(2);<br \/>\n\u00a0 return sf.GetMethod().Name.Substring(4);<br \/>\n}<\/code><\/p>\n<p><code>private static object GetItemFromStore()<br \/>\n{<br \/>\n\u00a0\u00a0 return GetItemFromStore((PersistentSettingsKeys)Enum.Parse(<br \/>\n\u00a0\u00a0 typeof(PersistentSettingsKeys),<br \/>\n\u00a0 \u00a0SettingName()));<br \/>\n} <\/code><\/p>\n<p>No, ami ebben\u00a0\u00e9rdekes, hogy a debug\u00a0verzi\u00f3 sim\u00e1n lefut, a release viszont elsz\u00e1ll, mert a stack frame\u00a01-el\u00a0r\u00f6videbb!\u00a0A Jitter inlineos\u00edtja a SettingName-et, \u00edgy a reflection is eggyel elcs\u00faszik. Ez nekem az\u00e9rt meglep\u0151, mert az IL k\u00f3dban m\u00e9g nincs inline-os\u00edt\u00e1s (ok, az nem is egy managed compiler dolga), de ami meglep\u0151, hogy a jitter inline l\u00e1tszik a reflection\u00f6n kereszt\u00fcl. A megold\u00e1s persze el\u00e9g egyszer\u0171,<\/p>\n<p>[MethodImpl(MethodImplOptions.NoInlining)]<\/p>\n<p>kell a SettingName el\u00e9.<\/p>\n<p>\u00a0<\/p>\n<p>(Ha valaki tudna seg\u00edteni hogyan lehet k\u00f3dot sz\u00e9pen elhelyezni wordpressben k\u00e9rdem seg\u00edtsen.)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u00c9rdekes esetbe \u00fctk\u00f6ztem. private static string SettingName() { \u00a0 StackTrace st = new StackTrace(); \u00a0 StackFrame sf = st.GetFrame(2); \u00a0 return sf.GetMethod().Name.Substring(4);&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8,4],"tags":[],"class_list":["post-79","post","type-post","status-publish","format-standard","hentry","category-net","category-szakmai-elet"],"_links":{"self":[{"href":"https:\/\/soci.hu\/blog\/index.php\/wp-json\/wp\/v2\/posts\/79","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/soci.hu\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/soci.hu\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/soci.hu\/blog\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/soci.hu\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=79"}],"version-history":[{"count":0,"href":"https:\/\/soci.hu\/blog\/index.php\/wp-json\/wp\/v2\/posts\/79\/revisions"}],"wp:attachment":[{"href":"https:\/\/soci.hu\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=79"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/soci.hu\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=79"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/soci.hu\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=79"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}