{"id":215355,"date":"2014-03-11T15:02:03","date_gmt":"2014-03-11T11:02:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=215355"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=215355","title":{"rendered":"<span class=\"post_title\">\u041f\u043e\u0438\u0441\u043a \u043f\u0440\u0438\u0447\u0438\u043d \u0441\u0442\u0440\u0430\u043d\u043d\u043e\u0439 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438<\/span>"},"content":{"rendered":"<div class=\"content html_format\">\n<h4>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h4>\n<p>  \u041d\u0430\u043a\u043e\u043d\u0435\u0446-\u0442\u043e \u043f\u043e\u043b\u0435\u0437 \u0434\u0435\u0442\u0430\u043b\u044c\u043d\u043e \u0438\u0437\u0443\u0447\u0430\u0442\u044c Java-\u0431\u0430\u0439\u0442\u043a\u043e\u0434, \u0438 \u043f\u043e\u0447\u0442\u0438 \u0441\u0440\u0430\u0437\u0443 \u0436\u0435 \u0432 \u0433\u043e\u043b\u043e\u0432\u0435 \u0432\u043e\u0437\u043d\u0438\u043a \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0439 \u0432\u043e\u043f\u0440\u043e\u0441. \u0415\u0441\u0442\u044c \u0442\u0430\u043c \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f <b>NOP<\/b>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043d\u0435 \u0434\u0435\u043b\u0430\u0435\u0442 \u043d\u0438\u0447\u0435\u0433\u043e. \u0422\u0430\u043a \u0432\u043e\u0442, \u0430 \u043a\u0430\u043a \u044d\u0442\u043e \u00ab\u043d\u0438\u0447\u0435\u0433\u043e\u00bb \u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438? \u0421\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0433\u043e \u0438 \u043e\u043f\u0438\u0441\u0430\u043d \u0432 \u043f\u043e\u0441\u0442\u0435.<\/p>\n<h4>\u0414\u0438\u0441\u043a\u043b\u0435\u0439\u043c\u0435\u0440<\/h4>\n<p>  \u0421\u0430\u043c \u0440\u0430\u0441\u0441\u043a\u0430\u0437, \u0432 \u043f\u0435\u0440\u0432\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c, \u043d\u0435 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u043e\u043d\u043e \u0440\u0435\u0430\u043b\u044c\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, \u0430 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a\u0438\u0445 \u043e\u0448\u0438\u0431\u043e\u043a \u0441\u0442\u043e\u0438\u0442 \u043e\u043f\u0430\u0441\u0430\u0442\u044c\u0441\u044f \u043f\u0440\u0438 \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f\u0445 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438.<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h4>\u0418\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b<\/h4>\n<p>  \u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u0433\u043b\u0430\u0432\u043d\u043e\u0433\u043e: \u043a\u0430\u043a \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u043b\u0438\u0441\u044c \u0432\u0441\u0435 \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f. \u0414\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043a\u043e\u0434\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0430\u0441\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 <a href=\"http:\/\/asm.ow2.org\/\">ASM<\/a>, \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0441\u0430\u043c\u043e\u0433\u043e \u0431\u0435\u043d\u0447\u043c\u0430\u0440\u043a\u0430 \u2014 <a href=\"http:\/\/openjdk.java.net\/projects\/code-tools\/jmh\/\">JMH<\/a>.<\/p>\n<p>  \u0427\u0442\u043e\u0431\u044b \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c reflection, \u0431\u044b\u043b \u0441\u043e\u0437\u0434\u0430\u043d \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441:  <\/p>\n<pre><code class=\"java\">public interface Getter {     int get(); } <\/code><\/pre>\n<p>  \u0414\u0430\u043b\u044c\u0448\u0435, \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043b\u0441\u044f \u043a\u043b\u0430\u0441\u0441, \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0449\u0438\u0439 \u043c\u0435\u0442\u043e\u0434 <b>get<\/b>:  <\/p>\n<pre><code class=\"java\">  public get()I     NOP     ...     NOP     LDC 20     IRETURN <\/code><\/pre>\n<p>  \u041c\u043e\u0436\u043d\u043e \u0432\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043d\u043e\u043f\u043e\u0432.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u0434 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"java\">public class SimpleGetterClassLoader extends ClassLoader {      private static final String GENERATED_CLASS_NAME = &quot;other.GeneratedClass&quot;;      private static final ClassLoader myClassLoader = new SimpleGetterClassLoader();      @SuppressWarnings(&quot;unchecked&quot;)     public static Getter newInstanceWithNOPs(int nopCount) throws Exception {         Class&lt;?&gt; clazz = Class.forName(GENERATED_CLASS_NAME + &quot;_&quot; + nopCount, false, myClassLoader);         return (Getter) clazz.newInstance();     }      @NotNull     @Override     protected Class&lt;?&gt; findClass(@NotNull String name) throws ClassNotFoundException {         if (!name.startsWith(GENERATED_CLASS_NAME))             throw new ClassNotFoundException(name);          int nopCount = Integer.parseInt(name.substring(GENERATED_CLASS_NAME.length() + 1));          ClassWriter cw = new ClassWriter(0);         cw.visit(V1_5, ACC_PUBLIC, name.replace('.', '\/'), null, getInternalName(Object.class), new String[]{getInternalName(Getter.class)});         {             MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, &quot;&lt;init&gt;&quot;, &quot;()V&quot;, null, null);             mv.visitCode();             mv.visitVarInsn(ALOAD, 0);             mv.visitMethodInsn(INVOKESPECIAL, getInternalName(Object.class), &quot;&lt;init&gt;&quot;, &quot;()V&quot;);             mv.visitInsn(RETURN);             mv.visitMaxs(1, 1);             mv.visitEnd();         }         {             MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, &quot;get&quot;, &quot;()I&quot;, null, null);             mv.visitCode();             for (int i = 0; i &lt; nopCount; i++) {                 mv.visitInsn(NOP);             }             mv.visitLdcInsn(20);             mv.visitInsn(IRETURN);             mv.visitMaxs(1, 1);             mv.visitEnd();         }         cw.visitEnd();          byte[] bytes = cw.toByteArray();          return defineClass(name, bytes, 0, bytes.length);     } } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0411\u0435\u043d\u0447\u043c\u0430\u0440\u043a<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"java\">@State(Scope.Benchmark) @OutputTimeUnit(TimeUnit.MICROSECONDS) public class Bench {      private Getter nop_0;     private Getter nop_10;     ...      @Setup     public void setup() throws Exception {         nop_0 = newInstanceWithNOPs(0);         nop_10 = newInstanceWithNOPs(10);         ...     }      @GenerateMicroBenchmark     public int nop_0() {         return nop_0.get();     }      @GenerateMicroBenchmark     public int nop_10() {         return nop_10.get();     }     ... <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<h4>\u041f\u043e\u0438\u0441\u043a \u0438\u0441\u0442\u0438\u043d\u044b<\/h4>\n<p>  \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0431\u044b\u043b\u0438 \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u044b 2 \u0442\u0435\u0441\u0442\u0430: \u0431\u0435\u0437 \u043d\u043e\u043f\u043e\u0432 \u0438 \u0441 2000.<\/p>\n<pre><code class=\"java\">Benchmark            Mode   Samples         Mean   Mean error    Units b.Bench.nop_0       thrpt         5      838,753       48,962   ops\/us b.Bench.nop_2000    thrpt         5      298,428        7,965   ops\/us <\/code><\/pre>\n<p>  \u0418 \u0441\u0440\u0430\u0437\u0443 \u0436\u0435 \u044f \u0441\u0434\u0435\u043b\u0430\u043b \u043e\u0447\u0435\u043d\u044c \u043c\u043e\u0449\u043d\u044b\u0439 \u0432\u044b\u0432\u043e\u0434: \u00ab\u0413\u043b\u0443\u043f\u044b\u0439 JIT \u043d\u0435 \u0432\u044b\u0440\u0435\u0437\u0430\u0435\u0442 \u043d\u043e\u043f\u044b, \u0430 \u0442\u0440\u0430\u043d\u0441\u043b\u0438\u0440\u0443\u0435\u0442 \u0438\u0445 \u0432 \u043c\u0430\u0448\u0438\u043d\u043d\u044b\u0435.\u00bb  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0412\u043e\u043f\u0440\u043e\u0441 \u0437\u043d\u0430\u0442\u043e\u043a\u0430\u043c:<\/b><\/p>\n<div class=\"spoiler_text\">\u0415\u0441\u043b\u0438 \u0431\u044b \u044d\u0442\u043e \u0431\u044b\u043b\u043e \u043f\u0440\u0430\u0432\u0434\u043e\u0439, \u0442\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f \u0431\u044b\u043b \u0431\u044b \u043f\u043e\u0445\u043e\u0436? \u0418\u043b\u0438 \u0431\u044b\u043b\u043e \u0431\u044b \u0447\u0442\u043e-\u0442\u043e \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u0434\u0440\u0443\u0433\u043e\u0435?<\/div>\n<\/div>\n<p>  \u041d\u043e \u044d\u0442\u043e, \u0432\u0441\u0435-\u0442\u0430\u043a\u0438, \u0431\u044b\u043b\u0430 \u0433\u0438\u043f\u043e\u0442\u0435\u0437\u0430, \u0438 \u043e\u0447\u0435\u043d\u044c \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0435\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c. \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0443\u0431\u0435\u0434\u0438\u043b\u0441\u044f \u0447\u0442\u043e \u044d\u0442\u0438 \u043c\u0435\u0442\u043e\u0434\u044b \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u044e\u0442\u0441\u044f JIT`\u043e\u043c, \u0437\u0430\u0442\u0435\u043c \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u043b \u0432\u043e \u0447\u0442\u043e. \u0415\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 \u0430\u0441\u0441\u0435\u043c\u0431\u043b\u0435\u0440 \u0431\u044b\u043b \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0438\u0434\u0435\u043d\u0442\u0438\u0447\u043d\u044b\u043c. \u0418 \u0432\u043e\u0442 \u0442\u0443\u0442 \u044f \u043f\u043e\u043d\u044f\u043b \u0447\u0442\u043e \u0447\u0435\u0433\u043e-\u0442\u043e \u043d\u0435 \u043f\u043e\u043d\u0438\u043c\u0430\u044e. \u0418\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u0439 \u043a\u043e\u0434 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0435\u0442, \u0430 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u0432 2,5 \u0440\u0430\u0437\u0430. \u0421\u0442\u0440\u0430\u043d\u043d\u043e.<\/p>\n<p>  \u0414\u0430\u043b\u044c\u0448\u0435 \u043e\u0447\u0435\u043d\u044c \u0437\u0430\u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 \u0432\u0438\u0434 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438.  <\/p>\n<pre><code class=\"java\">Benchmark             Mode   Samples         Mean   Mean error    Units b.Bench.nop_0        thrpt         5      813,010       71,510   ops\/us b.Bench.nop_2000     thrpt         5      302,589       12,360   ops\/us b.Bench.nop_10000    thrpt         5        0,268        0,017   ops\/us <\/code><\/pre>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0421\u043a\u0440\u044b\u0442\u043e\u0435 \u0437\u043d\u0430\u043d\u0438\u0435<\/b><\/p>\n<div class=\"spoiler_text\">\u042d\u0442\u043e \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u0435 \u0432\u043e\u043e\u0431\u0449\u0435 \u0448\u0438\u043a\u0430\u0440\u043d\u043e\u0435. 3 \u0442\u043e\u0447\u043a\u0438, \u0438 \u0432\u0441\u0435 \u0438\u0437 \u0440\u0430\u0437\u043d\u044b\u0445 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0435\u0439.<\/div>\n<\/div>\n<p>  \u0417\u0434\u0435\u0441\u044c \u0441\u0442\u043e\u0438\u0442 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0434\u043b\u044f \u043d\u043e\u0432\u043e\u0439 \u0442\u043e\u0447\u043a\u0438 \u043d\u0438 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043b\u0438 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u044f, \u043d\u0438 \u0447\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435, \u044f \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0435 \u0441\u043c\u043e\u0442\u0440\u0435\u043b. \u0410\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043b, \u0447\u0442\u043e \u0432\u0441\u0435 \u0442\u0430\u043a \u0436\u0435, \u043a\u0430\u043a \u043f\u0440\u0438 0\/2\u043a. \u0427\u0442\u043e \u0431\u044b\u043b\u043e \u043e\u0448\u0438\u0431\u043a\u043e\u0439.<\/p>\n<p>  \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u043b \u044f \u043d\u0430 \u044d\u0442\u043e, \u0438 \u0441\u0434\u0435\u043b\u0430\u043b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0434\u0430\u043b\u0435\u043a\u043e \u0438\u0434\u0443\u0449\u0438\u0439 \u0432\u044b\u0432\u043e\u0434: \u00ab\u0417\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c \u043e\u0447\u0435\u043d\u044c \u0441\u0438\u043b\u044c\u043d\u043e \u043d\u0435\u043b\u0438\u043d\u0435\u0439\u043d\u0430\u044f.\u00bb. \u041d\u043e, \u0447\u0442\u043e \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u0432\u0430\u0436\u043d\u0435\u0435, \u0432 \u044d\u0442\u043e\u043c \u043c\u0435\u0441\u0442\u0435 \u044f \u043d\u0430\u0447\u0430\u043b \u043f\u043e\u0434\u043e\u0437\u0440\u0435\u0432\u0430\u0442\u044c, \u0447\u0442\u043e \u0440\u0435\u0430\u043b\u044c\u043d\u043e \u0434\u0435\u043b\u043e \u0442\u0443\u0442 \u043d\u0435 \u0432 \u0441\u0430\u043c\u0438\u0445 \u043d\u043e\u043f\u0430\u0445, \u0430 \u0432 \u0440\u0430\u0437\u043c\u0435\u0440\u0435 \u043c\u0435\u0442\u043e\u0434\u0430.<\/p>\n<p>  \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u043c\u044b\u0441\u043b\u044c \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u043b\u0430\u0441\u044c \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043c\u0435\u0442\u043e\u0434\u044b \u0443 \u043d\u0430\u0441 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435, \u0437\u043d\u0430\u0447\u0438\u0442 \u043e\u043d\u0438 \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432. \u041c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0441\u0430\u043c\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u0447\u0443\u0432\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u0430 \u043a \u0440\u0430\u0437\u043c\u0435\u0440\u0443? \u0414\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0435\u0440\u0435\u043d\u0435\u0441 \u043a\u043e\u0434 \u0432 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u044b, \u0438, \u0435\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043d\u0435 \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u043e\u0441\u044c \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0438\u0447\u0435\u0433\u043e.  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0412\u043e\u043f\u0440\u043e\u0441 \u0437\u043d\u0430\u0442\u043e\u043a\u0430\u043c 2<\/b><\/p>\n<div class=\"spoiler_text\">\u042d\u0442\u0430 \u043c\u044b\u0441\u043b\u044c \u044f\u0432\u043b\u044f\u043b\u0430\u0441\u044c \u043f\u043e\u043b\u043d\u043e\u0439 \u0433\u043b\u0443\u043f\u043e\u0441\u0442\u044c\u044e? \u0418\u043b\u0438 \u0436\u0435 \u0447\u0442\u043e-\u0442\u043e \u0437\u0434\u0440\u0430\u0432\u043e\u0435 \u0432 \u043d\u0435\u0439 \u0432\u0441\u0435 \u0436\u0435 \u0431\u044b\u043b\u043e?<\/div>\n<\/div>\n<p>  \u0414\u0430\u043b\u044c\u0448\u0435, \u043e\u0442 \u043d\u0435\u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f, \u043f\u043e\u043b\u0435\u0437 \u0438\u0441\u043a\u0430\u0442\u044c \u043f\u0440\u0438 \u0447\u0435\u043c \u0442\u0443\u0442 \u0440\u0430\u0437\u043c\u0435\u0440 \u043c\u0435\u0442\u043e\u0434\u0430. \u041e\u0442\u0432\u0435\u0442 \u0431\u044b\u043b \u043d\u0430\u0439\u0434\u0435\u043d \u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0430\u0445 openjdk:  <\/p>\n<pre><code class=\"cpp\">  develop(intx, HugeMethodLimit,  8000,                                     \\           &quot;Don't compile methods larger than this if &quot;                      \\           &quot;+DontCompileHugeMethods&quot;)       <\/code><\/pre>\n<p>  \u0418\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e, \u043a\u0430\u043a \u0440\u0430\u0437 \u043c\u0435\u0436\u0434\u0443 2\u043a \u0438 10\u043a. \u041f\u043e\u0441\u0447\u0438\u0442\u0430\u0435\u043c \u0440\u0430\u0437\u043c\u0435\u0440 \u043c\u043e\u0435\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430: 3 \u0431\u0430\u0439\u0442\u0430 \u043d\u0430 \u00abreturn 20\u00bb, \u043e\u0441\u0442\u0430\u0435\u0442\u0441\u044f 7997.  <\/p>\n<pre><code class=\"java\">Benchmark             Mode   Samples         Mean   Mean error    Units b.Bench.nop_0        thrpt         5      797,376       12,998   ops\/us b.Bench.nop_2000     thrpt         5      306,795        0,243   ops\/us b.Bench.nop_7997     thrpt         5      303,314        7,161   ops\/us b.Bench.nop_7998     thrpt         5        0,335        0,001   ops\/us b.Bench.nop_10000    thrpt         5        0,269        0,000   ops\/us <\/code><\/pre>\n<p>  \u0423\u0433\u0430\u0434\u0430\u043b\u0438, \u044d\u0442\u0430 \u0433\u0440\u0430\u043d\u0438\u0446\u0430 \u043f\u043e\u043d\u044f\u0442\u043d\u0430. \u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u043f\u043e\u043d\u044f\u0442\u044c \u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0434\u043e 8000 \u0431\u0430\u0439\u0442. \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0442\u043e\u0447\u0435\u043a:  <\/p>\n<pre><code class=\"java\">Benchmark             Mode   Samples         Mean   Mean error    Units b.Bench.nop_0        thrpt         5      853,499       61,847   ops\/us b.Bench.nop_10       thrpt         5      845,861      112,504   ops\/us b.Bench.nop_100      thrpt         5      867,068       20,681   ops\/us b.Bench.nop_500      thrpt         5      304,116        1,665   ops\/us b.Bench.nop_1000     thrpt         5      299,295        8,745   ops\/us b.Bench.nop_2000     thrpt         5      306,495        0,578   ops\/us b.Bench.nop_7997     thrpt         5      301,322        7,992   ops\/us b.Bench.nop_7998     thrpt         5        0,335        0,005   ops\/us b.Bench.nop_10000    thrpt         5        0,269        0,004   ops\/us b.Bench.nop_25000    thrpt         5        0,105        0,007   ops\/us b.Bench.nop_50000    thrpt         5        0,053        0,001   ops\/us <\/code><\/pre>\n<p>  \u041f\u0435\u0440\u0432\u043e\u0435, \u0447\u0442\u043e \u043d\u0430\u0441 \u0437\u0434\u0435\u0441\u044c \u0440\u0430\u0434\u0443\u0435\u0442 \u2014 \u043f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a jit \u043e\u0442\u043a\u043b\u044e\u0447\u0438\u043b\u0441\u044f, \u043e\u0447\u0435\u043d\u044c \u0445\u043e\u0440\u043e\u0448\u043e \u0432\u0438\u0434\u043d\u0430 \u043b\u0438\u043d\u0435\u0439\u043d\u0430\u044f \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c. \u0427\u0442\u043e \u0432 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438 \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0435\u0442 \u0441 \u043d\u0430\u0448\u0438\u043c \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u0435\u043c, \u0442.\u043a. \u043a\u0430\u0436\u0434\u044b\u0439 NOP \u043d\u0430\u0434\u043e \u044f\u0432\u043d\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c. <\/p>\n<p>  \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435, \u043d\u0430 \u0447\u0442\u043e \u043f\u0430\u0434\u0430\u0435\u0442 \u0433\u043b\u0430\u0437 \u2014 \u0435\u0441\u0442\u044c \u0441\u0438\u043b\u044c\u043d\u043e\u0435 \u043e\u0449\u0443\u0449\u0435\u043d\u0438\u0435 \u0447\u0442\u043e \u0434\u043e 8\u043a \u043d\u0435 \u043e\u0434\u043d\u0430 \u043a\u0430\u043a\u0430\u044f-\u0442\u043e \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c, \u0430 \u043f\u0440\u043e\u0441\u0442\u043e 2 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b. \u0415\u0449\u0435 5 \u043c\u0438\u043d\u0443\u0442 \u0440\u0443\u0447\u043d\u043e\u0433\u043e \u0431\u0438\u043d\u0430\u0440\u043d\u043e\u0433\u043e \u043f\u043e\u0438\u0441\u043a\u0430, \u0438 \u0433\u0440\u0430\u043d\u0438\u0446\u0430 \u043d\u0430\u0439\u0434\u0435\u043d\u0430.  <\/p>\n<pre><code class=\"java\">Benchmark             Mode   Samples         Mean   Mean error    Units b.Bench.nop_0        thrpt         5      805,466       10,074   ops\/us b.Bench.nop_10       thrpt         5      862,027        4,756   ops\/us b.Bench.nop_100      thrpt         5      861,462        9,881   ops\/us b.Bench.nop_322      thrpt         5      863,176       22,385   ops\/us b.Bench.nop_323      thrpt         5      303,677        5,130   ops\/us b.Bench.nop_500      thrpt         5      299,368       11,143   ops\/us b.Bench.nop_1000     thrpt         5      302,884        3,373   ops\/us b.Bench.nop_2000     thrpt         5      306,682        3,598   ops\/us b.Bench.nop_7997     thrpt         5      301,457        4,209   ops\/us b.Bench.nop_7998     thrpt         5        0,337        0,001   ops\/us b.Bench.nop_10000    thrpt         5        0,268        0,004   ops\/us b.Bench.nop_25000    thrpt         5        0,107        0,002   ops\/us b.Bench.nop_50000    thrpt         5        0,053        0,000   ops\/us <\/code><\/pre>\n<p>  \u041f\u043e\u0447\u0442\u0438 \u0432\u0441\u0435, \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u043f\u043e\u043d\u044f\u0442\u044c \u0447\u0442\u043e \u0436\u0435 \u044d\u0442\u043e \u0437\u0430 \u0433\u0440\u0430\u043d\u0438\u0446\u0430. \u041f\u043e\u0441\u0447\u0438\u0442\u0430\u0435\u043c: 3 + 323 == 325. \u0418\u0449\u0435\u043c \u0447\u0442\u043e \u0436\u0435 \u044d\u0442\u043e \u0437\u0430 \u043c\u0430\u0433\u0438\u0447\u0435\u0441\u043a\u043e\u0435 325, \u0438 \u043d\u0430\u0445\u043e\u0434\u0438\u043c \u043d\u0435\u043a\u0438\u0439 \u043a\u043b\u044e\u0447\u0438\u043a <b>-XX:FreqInlineSize<\/b>  <\/p>\n<blockquote><p>FreqInlineSize is 325 on modern 64bit Linux<\/p><\/blockquote>\n<p>  \u0438 \u0435\u0433\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0438\u0437 \u0434\u043e\u043a\u0438:  <\/p>\n<blockquote><p>Integer specifying maximum number of bytecode instructions in a frequently executed method which gets inlined.<\/p><\/blockquote>\n<p>  \u0423\u0440\u0430! \u041d\u0430\u043a\u043e\u043d\u0435\u0446-\u0442\u043e \u0432\u0441\u0435 \u0441\u043e \u0432\u0441\u0435\u043c \u0441\u043e\u0448\u043b\u043e\u0441\u044c. \u0418\u0442\u043e\u0433\u043e, \u043c\u044b \u043d\u0430\u0448\u043b\u0438 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043e\u0442 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u043c\u0435\u0442\u043e\u0434\u0430 (\u0435\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u00ab\u043f\u0440\u0438 \u043f\u0440\u043e\u0447\u0438\u0445 \u0440\u0430\u0432\u043d\u044b\u0445\u00bb).<br \/>  1. JIT + inline<br \/>  2. JIT<br \/>  3. \u0447\u0435\u0441\u0442\u043d\u0430\u044f \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0446\u0438\u044f<\/p>\n<h4>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h4>\n<p>  \u041a\u0430\u043a \u044f \u0443\u0436\u0435 \u0433\u043e\u0432\u043e\u0440\u0438\u043b \u0432 \u043d\u0430\u0447\u0430\u043b\u0435, \u0433\u043b\u0430\u0432\u043d\u043e\u0435, \u043d\u0430 \u0447\u0442\u043e \u0441\u0442\u043e\u0438\u0442 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u2014 \u044d\u0442\u043e \u043d\u0435 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435. \u041e\u043d\u043e \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u044b\u043c, \u0438, \u0443\u0432\u0435\u0440\u0435\u043d, \u043e\u043f\u0438\u0441\u0430\u043d\u043e \u0432 \u0434\u043e\u043a\u0435 (\u043d\u0435 \u0447\u0438\u0442\u0430\u043b, \u043d\u0435 \u0437\u043d\u0430\u044e). \u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u043c\u043e\u0439 \u043f\u043e\u0441\u044b\u043b \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u0432\u0430\u0436\u043d\u043e \u0434\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u0437\u0434\u0440\u0430\u0432\u043e\u043c\u0443 \u0441\u043c\u044b\u0441\u043b\u0443, \u0438 \u0435\u0441\u043b\u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u0439 \u0445\u043e\u0442\u044c \u0447\u0443\u0442\u044c-\u0447\u0443\u0442\u044c \u0441 \u043d\u0438\u043c \u0440\u0430\u0441\u0445\u043e\u0434\u044f\u0442\u0441\u044f, \u0438\u043b\u0438 \u0436\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u043a\u0430\u0436\u0443\u0442\u0441\u044f \u043d\u0435\u043f\u043e\u043d\u044f\u0442\u043d\u044b\u043c\u0438, \u0442\u043e \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0430\u0434\u043e \u0432\u0441\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u0438 \u043f\u0435\u0440\u0435\u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c.<\/p>\n<p>  \u041d\u0430\u0434\u0435\u044e\u0441\u044c, \u043a\u043e\u043c\u0443-\u043d\u0438\u0431\u0443\u0434\u044c \u044d\u0442\u043e\u0442 \u043f\u043e\u0441\u0442 \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u0441\u044f \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u043c.<\/p>\n<h4>P.S.<\/h4>\n<p>  \u042f \u0432\u0441\u0435 \u0432\u0440\u0435\u043c\u044f \u0441\u0447\u0438\u0442\u0430\u043b \u0438 8000, \u0438 325 \u0432 \u0431\u0430\u0439\u0442\u0430\u0445 \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e. \u041f\u043e\u0445\u043e\u0436\u0435, \u043d\u0430\u0434\u043e \u0431\u044b\u043b\u043e \u044d\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u0432 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f\u0445 \u043d\u0435\u0432\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0412\u043e\u043f\u0440\u043e\u0441 \u0437\u043d\u0430\u0442\u043e\u043a\u0430\u043c 3<\/b><\/p>\n<div class=\"spoiler_text\">\u041f\u043e\u0447\u0435\u043c\u0443 \u0438\u043c\u0435\u043d\u043d\u043e 325 \u0438 8000? \u042d\u0442\u043e \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0435 \u0447\u0438\u0441\u043b\u0430, \u0438\u043b\u0438 \u0436\u0435 \u0437\u0430 \u043d\u0438\u043c\u0438 \u0447\u0442\u043e-\u0442\u043e \u0441\u0442\u043e\u0438\u0442?<\/div>\n<\/div>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/215355\/\"> http:\/\/habrahabr.ru\/post\/215355\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">\n<h4>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h4>\n<p>  \u041d\u0430\u043a\u043e\u043d\u0435\u0446-\u0442\u043e \u043f\u043e\u043b\u0435\u0437 \u0434\u0435\u0442\u0430\u043b\u044c\u043d\u043e \u0438\u0437\u0443\u0447\u0430\u0442\u044c Java-\u0431\u0430\u0439\u0442\u043a\u043e\u0434, \u0438 \u043f\u043e\u0447\u0442\u0438 \u0441\u0440\u0430\u0437\u0443 \u0436\u0435 \u0432 \u0433\u043e\u043b\u043e\u0432\u0435 \u0432\u043e\u0437\u043d\u0438\u043a \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0439 \u0432\u043e\u043f\u0440\u043e\u0441. \u0415\u0441\u0442\u044c \u0442\u0430\u043c \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f <b>NOP<\/b>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043d\u0435 \u0434\u0435\u043b\u0430\u0435\u0442 \u043d\u0438\u0447\u0435\u0433\u043e. \u0422\u0430\u043a \u0432\u043e\u0442, \u0430 \u043a\u0430\u043a \u044d\u0442\u043e \u00ab\u043d\u0438\u0447\u0435\u0433\u043e\u00bb \u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438? \u0421\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0433\u043e \u0438 \u043e\u043f\u0438\u0441\u0430\u043d \u0432 \u043f\u043e\u0441\u0442\u0435.<\/p>\n<h4>\u0414\u0438\u0441\u043a\u043b\u0435\u0439\u043c\u0435\u0440<\/h4>\n<p>  \u0421\u0430\u043c \u0440\u0430\u0441\u0441\u043a\u0430\u0437, \u0432 \u043f\u0435\u0440\u0432\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c, \u043d\u0435 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u043e\u043d\u043e \u0440\u0435\u0430\u043b\u044c\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, \u0430 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a\u0438\u0445 \u043e\u0448\u0438\u0431\u043e\u043a \u0441\u0442\u043e\u0438\u0442 \u043e\u043f\u0430\u0441\u0430\u0442\u044c\u0441\u044f \u043f\u0440\u0438 \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f\u0445 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-215355","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/215355","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=215355"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/215355\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=215355"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=215355"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=215355"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}