{"id":348513,"date":"2023-06-08T15:04:38","date_gmt":"2023-06-08T15:04:38","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=348513"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=348513","title":{"rendered":"<span>\u041f\u0440\u043e\u0444\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435, \u0430\u0441\u0441\u0435\u043c\u0431\u043b\u0435\u0440 \u0438 \u0432\u0441\u0435-\u0432\u0441\u0435-\u0432\u0441\u0435<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<p>\u041f\u0440\u0438\u0432\u0435\u0442, \u0441\u0435\u0433\u043e\u0434\u043d\u044f \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u044a\u0451\u043c\u043d\u0430\u044f \u0438 \u043e\u0431\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f \u043e \u043d\u0438\u0437\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u043e\u043c \u043f\u0440\u043e\u0444\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0438 \u0434\u0438\u0430\u0433\u043d\u043e\u0441\u0442\u0438\u043a\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438. \u041c\u043d\u043e\u0433\u043e\u043a\u0440\u0430\u0442\u043d\u043e \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445 \u043a \u0434\u043e\u043a\u043b\u0430\u0434\u0430\u043c \u0438 \u0441\u0442\u0430\u0442\u044c\u044f\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u0432\u044b\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u043b\u0438 \u043f\u043e\u0436\u0435\u043b\u0430\u043d\u0438\u0435 \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432 &#171;\u043a\u0430\u043a \u043d\u0443\u0436\u043d\u043e&#187; \u0438 &#171;\u043a\u0430\u043a \u043d\u0435 \u043d\u0443\u0436\u043d\u043e&#187;, \u0430 \u0446\u0435\u043b\u043e\u0441\u0442\u043d\u0443\u044e \u0438\u0441\u0442\u043e\u0440\u0438\u044e. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u043e\u0442 \u0432\u0430\u043c \u0441\u0442\u0430\u0442\u044c\u044f \u043f\u0440\u043e \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0439 \u043a\u0435\u0439\u0441 \u0438 \u0435\u0433\u043e \u0438\u0441\u0442\u043e\u0440\u0438\u044e :). \u041d\u0435 \u0443\u0434\u0438\u0432\u043b\u044f\u0439\u0442\u0435\u0441\u044c, \u0447\u0442\u043e \u043d\u0430\u0447\u043d\u0451\u043c \u043c\u044b \u0441 JPA, \u0445\u043e\u0442\u044f \u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0431\u044b \u0433\u0434\u0435 \u043e\u043d\u043e \u0438 \u0433\u0434\u0435 \u0430\u0441\u0441\u0435\u043c\u0431\u043b\u0435\u0440. \u041f\u043e \u0445\u043e\u0434\u0443 \u0434\u0435\u043b\u0430 \u0432\u044b \u0432\u0441\u0451 \u043f\u043e\u0439\u043c\u0451\u0442\u0435.<\/p>\n<p>\u0427\u0430\u0441\u0442\u044c \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0430, \u043b\u0451\u0433\u0448\u0435\u0433\u043e \u0432 \u043e\u0441\u043d\u043e\u0432\u0443 \u044d\u0442\u043e\u0433\u043e \u0434\u043e\u043a\u043b\u0430\u0434\u0430 \u0440\u0430\u043d\u0435\u0435 \u0440\u0430\u0437\u043c\u0435\u0449\u0430\u043b\u0430\u0441\u044c \u043c\u043d\u043e\u0439 <a href=\"https:\/\/habr.com\/ru\/post\/432824\/\" rel=\"noopener noreferrer nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a>, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0435\u0441\u043b\u0438 \u0432\u0434\u0440\u0443\u0433 \u0432\u0430\u043c \u043f\u043e\u043a\u0430\u0436\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0433\u0434\u0435-\u0442\u043e \u0432\u044b \u0443\u0436\u0435 \u0447\u0438\u0442\u0430\u043b\u0438 \u044d\u0442\u043e, \u0442\u043e \u0447\u0443\u0442\u044c\u0451 \u0432\u0430\u0441 \u043d\u0435 \u043f\u043e\u0434\u0432\u0435\u043b\u043e :). \u0418 \u0432\u0441\u0451 \u0436\u0435 \u044d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043b\u0430\u0433\u0438\u0430\u0442\u043e\u043c, \u0430 \u0441\u043a\u043e\u0440\u0435\u0435 \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u043b\u043d\u043e\u0439 \u0438 \u0440\u0430\u0437\u0432\u0451\u0440\u043d\u0443\u0442\u043e\u0439 \u0438\u0441\u0442\u043e\u0440\u0438\u0435\u0439, \u043e\u0431\u044a\u044f\u0441\u043d\u044f\u044e\u0449\u0435\u0439 \u0447\u0442\u043e, \u043a\u0430\u043a, \u043f\u043e\u0447\u0435\u043c\u0443 \u0438 \u0437\u0430\u0447\u0435\u043c. \u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d <a href=\"https:\/\/github.com\/stsypanov\/assembly-profiling-and-all-all-all\" rel=\"noopener noreferrer nofollow\">\u0442\u0443\u0442<\/a>.<\/p>\n<h3>\u0418\u0441\u0442\u043e\u0440\u0438\u044f<\/h3>\n<p>\u041e\u0434\u043d\u0430\u0436\u0434\u044b \u043d\u0430\u043c \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u043b\u0438 \u0437\u0430\u0434\u0430\u0447\u0443 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u0438 <s>\u0434\u0440\u0435\u0432\u043d\u0435\u0433\u043e \u043a\u0430\u043a \u043f\u043e\u043c\u0451\u0442 \u043c\u0430\u043c\u043e\u043d\u0442\u0430<\/s> \u0434\u043e\u043b\u0433\u043e\u0436\u0438\u0432\u0443\u0449\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0432\u0448\u0435\u0433\u043e \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u043e\u0431\u044b\u0447\u043d\u044b\u0439 \u044d\u043d\u0442\u0435\u0440\u043f\u0440\u0430\u0439\u0437-\u043d\u0430\u0431\u043e\u0440: \u0421\u0423\u0411\u0414 Oracle, Hibernate, Spring Data JPA. \u041e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044c\u044e \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0431\u044b\u043b\u043e \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0436\u0438\u0440\u043d\u0435\u043d\u044c\u043a\u0438\u0445 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439 (\u0441 \u0434\u0435\u0441\u044f\u0442\u043a\u0430\u043c\u0438 \u043f\u043e\u043b\u0435\u0439), \u043f\u0440\u0438 \u0447\u0451\u043c \u0447\u0430\u0441\u0442\u043e \u043d\u0430\u043c \u0431\u044b\u043b\u0438 \u043d\u0443\u0436\u043d\u044b \u0431\u0443\u043a\u0432\u0430\u043b\u044c\u043d\u043e \u0441\u0447\u0438\u0442\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u043d\u0438\u0445. \u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u0438\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043f\u043e\u043b\u0435\u0439 \u0438\u0437 \u043c\u043d\u043e\u0433\u0438\u0445 (\u043c\u0438\u043d\u0443\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u0432\u0441\u0435\u0439 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438 \u0438 \u0443\u043c\u0435\u043d\u044c\u0448\u0430\u044f \u0442\u0440\u0430\u0444\u0438\u043a) \u043c\u044b \u0440\u0435\u0448\u0430\u043b\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e DTO:<\/p>\n<pre><code class=\"java\">\/\/ \u0436\u0438\u0440\u043d\u0430\u044f \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044c @Entity public class ManyFieldsEntity {    @Id   private Long id;    @Column   private String extId;    @Column   private String name;    @Column   private BigDecimal amount1;    @Column   private BigDecimal amount2;    @Column   private BigDecimal amount3;    @Column   private BigDecimal amount4;    @Column   private BigDecimal amount5;    @Column   private BigDecimal amount6;    @Column   private BigDecimal amount7;    @Column   private BigDecimal amount8; }  \/\/ DTO @Getter @RequiredArgsConstructor public class HasIdAndNameDto {   private final Long id;   private final String name; }  \/\/ \u043c\u0435\u0442\u043e\u0434 \u0434\u043b\u044f \u0438\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 public interface ManyFieldsRepository extends JpaRepository&lt;ManyFieldsEntity, Long&gt; {    @Query(\"select new com.tsypanov.domain.HasIdAndNameDto(e.id, e.name)\" +          \"  from ManyFieldsEntity e \" +          \" where e.name = :name\")   Collection&lt;HasIdAndNameDto&gt; findAllByNameUsingDto(String name); }<\/code><\/pre>\n<p>\u0423\u0432\u0435\u0440\u0435\u043d, \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u0438\u0437 \u0432\u0430\u0441 \u0445\u043e\u0442\u044c \u0440\u0430\u0437 \u043f\u0438\u0441\u0430\u043b\u043e \u0447\u0442\u043e-\u0442\u043e \u043f\u043e\u0434\u043e\u0431\u043d\u043e\u0435. \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u0434\u0438\u043d \u0438\u0437 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0438\u043b \u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u0443 \u2014 \u043f\u0440\u043e\u0435\u043a\u0446\u0438\u0438.<\/p>\n<h3>\u0427\u0442\u043e \u044d\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u0438 \u0441 \u0447\u0435\u043c \u0438\u0445 \u0435\u0434\u044f\u0442?<\/h3>\n<p>\u041f\u0440\u043e\u0435\u043a\u0446\u0438\u044f \u2014 \u044d\u0442\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0447\u0430\u0441\u0442\u0438 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u0441 \u0433\u0435\u0442\u0442\u0435\u0440\u0430\u043c\u0438, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c\u0438 \u0438\u043c\u0435\u043d\u0430\u043c \u043f\u043e\u043b\u0435\u0439:<\/p>\n<pre><code class=\"java\">public interface HasIdAndName {   Long getId();    String getName(); }<\/code><\/pre>\n<p>\u042d\u0442\u043e\u0442 \u043f\u043e\u0434\u0445\u043e\u0434 \u0438\u043c\u0435\u0435\u0442 \u0440\u044f\u0434 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432 \u043f\u0435\u0440\u0435\u0434 \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u044b\u043c\u0438 DTO:<\/p>\n<ul>\n<li>\n<p>\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u044b \u0441\u0430\u043c\u0438 \u043f\u043e \u0441\u0435\u0431\u0435 \u0431\u043e\u043b\u0435\u0435 \u0433\u0438\u0431\u043a\u0438\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442, \u0447\u0435\u043c \u043a\u043b\u0430\u0441\u0441. \u0420\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0432 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0432 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0439 \u0432\u044b\u0448\u0435 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438 \u0438 DTO \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0435\u0440\u0432\u0438\u0441\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434, \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u0439 \u0438 \u0441 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044c\u044e, \u0438 \u0441 \u043f\u0440\u043e\u0435\u043a\u0446\u0438\u0435\u0439, \u0438 \u0441 DTO<\/p>\n<\/li>\n<li>\n<p>\u0434\u043b\u044f \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u044f \u043c\u0435\u0442\u043e\u0434\u0430 \u0432\u043d\u0443\u0442\u0440\u0438 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f \u0431\u043e\u043b\u0435\u0435 \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u044f\u0432\u043d\u043e\u0435 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0430, \u0447\u0442\u043e \u0441\u0438\u043b\u044c\u043d\u043e \u0432\u0441\u0451 \u0443\u043f\u0440\u043e\u0449\u0430\u0435\u0442 (\u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u043a\u043e\u0433\u0434\u0430 \u0432 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0435 DTO \u043d\u0435 1-2 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430, \u0430 10), \u0430 \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432\u043e\u043e\u0431\u0449\u0435 \u043e\u0442\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u043e\u0442 <code>@Query<\/code> \u0432 \u043f\u043e\u043b\u044c\u0437\u0443 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430 (\u0421\u043f\u0440\u0438\u043d\u0433 \u0441\u043e\u0437\u0434\u0430\u0441\u0442 \u0437\u0430\u043f\u0440\u043e\u0441 \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e). \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043a\u043e\u0434 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043b\u0430\u043a\u043e\u043d\u0438\u0447\u043d\u0435\u0435:<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"java\">public interface ManyFieldsRepository extends JpaRepository&lt;ManyFieldsEntity, Long&gt; {   Collection&lt;HasIdAndName&gt; findAllByName(String name); }<\/code><\/pre>\n<ul>\n<li>\n<p>&#171;\u0418\u0434\u0435\u044f&#187; \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u043f\u0440\u043e\u0435\u043a\u0446\u0438\u0438 \u0438 \u0434\u0430\u0451\u0442 \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u043a\u0438 \u043f\u0440\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u043d\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u0441\u043d\u0438\u0436\u0430\u044f \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043a\u0440\u0438\u0432\u043e\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443\u043f\u0430\u0434\u0451\u0442 \u0442\u043e\u043b\u044c\u043a\u043e  \u043f\u0440\u0438 \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0438 \u043a \u043d\u0435\u043c\u0443. \u041a \u0442\u043e\u043c\u0443 \u0436\u0435 \u043f\u0440\u0438 \u0440\u0435\u0444\u0430\u043a\u0442\u043e\u0440\u0438\u043d\u0433\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u0441\u0430\u043c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u0442\u0440\u043e\u043d\u0443\u0442 (\u0432 \u0441\u0442\u0430\u0440\u044b\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445 &#171;\u0418\u0434\u0435\u0438&#187; \u043f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435\/\u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435\/\u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u0435\u0439 \u0432 DTO <a href=\"https:\/\/youtrack.jetbrains.com\/issue\/IDEA-177272\/Result-of-rename-is-ignored-in-Spring-Data-JPA-query\" rel=\"noopener noreferrer nofollow\">\u043d\u0435 \u0437\u0430\u0442\u0440\u0430\u0433\u0438\u0432\u0430\u043b\u043e \u0438\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0432 JPQL-\u0437\u0430\u043f\u0440\u043e\u0441\u0430\u0445<\/a>, \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u0430 \u043f\u043e\u0434\u0441\u0432\u0435\u0442\u043a\u0430 \u043f\u0440\u0438 \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0432 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0435 \u0438 \u0442. \u043f.)<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/c78\/991\/277\/c78991277bbed07dae8e807f45e5b2d6.png\" width=\"444\" height=\"263\"><\/figure>\n<figure class=\"\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/e0\/bx\/is\/e0bxisrsopeqeuo0jgvruzek56q.png\" width=\"auto\" height=\"auto\"><\/figure>\n<\/li>\n<\/ul>\n<p>\u0418 \u043c\u044b \u0440\u0435\u0448\u0438\u043b\u0438 \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u0440\u043e\u0435\u043a\u0446\u0438\u0439.<\/p>\n<h3>\u041b\u043e\u0436\u043a\u0430 \u0434\u0451\u0433\u0442\u044f<\/h3>\n<p>\u0412\u0435\u0440\u043e\u044f\u0442\u043d\u043e, \u0432\u044b \u0443\u0436\u0435 \u0434\u043e\u0433\u0430\u0434\u0430\u043b\u0438\u0441\u044c, \u0447\u0442\u043e \u0432 \u043e\u0433\u0440\u043e\u043c\u043d\u043e\u0439 \u0431\u043e\u0447\u043a\u0435 \u043c\u0451\u0434\u0430 \u043e\u043a\u0430\u0437\u0430\u043b\u0430\u0441\u044c \u043b\u043e\u0436\u043a\u0430 \u0434\u0451\u0433\u0442\u044f \u043f\u043b\u043e\u0445\u043e\u0439 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438. \u0421\u0440\u0430\u0432\u043d\u0438\u043c \u0432\u0440\u0435\u043c\u044f \u043e\u0442\u043a\u043b\u0438\u043a\u0430 \u043f\u0440\u0438 \u0432\u044b\u0433\u0440\u0443\u0437\u043a\u0435 1 \u0438 100 DTO\/\u043f\u0440\u043e\u0435\u043a\u0446\u0438\u0439 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u0431\u0435\u043d\u0447\u043c\u0430\u0440\u043a\u0430:<\/p>\n<pre><code class=\"java\">@State(Scope.Thread) @OutputTimeUnit(TimeUnit.MICROSECONDS) @BenchmarkMode(value = Mode.AverageTime) public class ProjectionVsDtoBenchmark {    private ManyFieldsRepository repository;    @Param({\"1\", \"100\"})   private int count;    @Setup   public void init() {     ConfigurableApplicationContext context = SpringApplication.run(Application.class);     context.registerShutdownHook();      repository = context.getBean(ManyFieldsRepository.class);     List&lt;ManyFieldsEntity&gt; entities = ThreadLocalRandom.current()         .longs(count)         .boxed()         .map(randomLong -&gt; new ManyFieldsEntity(randomLong, String.valueOf(randomLong), \"ivan\"))         .collect(Collectors.toList());      repository.saveAll(entities);   }    \/\/DTO \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 HasIdAndName, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u0439 \u0442\u0438\u043f \u0442\u043e\u0442 \u0436\u0435    @Benchmark   public Collection&lt;HasIdAndName&gt; dto() {     return repository.findAllByNameUsingDto(\"ivan\");   }    @Benchmark   public Collection&lt;HasIdAndName&gt; projection() {     return repository.findAllByName(\"ivan\");   } }<\/code><\/pre>\n<p>\u041c\u043e\u0436\u0435\u0442 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u0440\u0430\u0437 \u043c\u044b \u043e\u0431\u0440\u0430\u0449\u0430\u0435\u043c\u0441\u044f \u043a \u0431\u0430\u0437\u0435 (\u043f\u0443\u0441\u0442\u044c \u0434\u0430\u0436\u0435 \u044d\u0442\u043e \u0438 H2 \u043d\u0430 \u043d\u0430\u0448\u0435\u043c \u0445\u043e\u0441\u0442\u0435), \u0442\u043e \u043b\u044c\u0432\u0438\u043d\u0430\u044f \u0434\u043e\u043b\u044f \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0442\u0440\u0430\u0442\u0438\u0442\u0441\u044f \u0438\u043c\u0435\u043d\u043d\u043e \u043d\u0430 \u0437\u0430\u043f\u0440\u043e\u0441 \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0443 \u0434\u0430\u043d\u043d\u044b\u0445, \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0446\u0438\u0444\u0440\u044b \u0431\u0443\u0434\u0443\u0442 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u043c\u0438.<\/p>\n<p>\u041e\u0434\u043d\u0430\u043a\u043e:<\/p>\n<pre><code>Benchmark                        (count)       Score       Error   Units  dto                                    1      11,409 \u00b1     0,741   us\/op projection                             1      12,886 \u00b1     0,194   us\/op  dto                                  100      40,326 \u00b1     0,738   us\/op projection                           100     220,189 \u00b1     5,668   us\/op  dto:\u00b7gc.alloc.rate.norm                1   13994,528 \u00b1    22,042    B\/op projection:\u00b7gc.alloc.rate.norm         1   21224,235 \u00b1    19,369    B\/op  dto:\u00b7gc.alloc.rate.norm              100   33313,019 \u00b1    22,609    B\/op projection:\u00b7gc.alloc.rate.norm       100  517354,738 \u00b1    34,719    B\/op<\/code><\/pre>\n<p>\u0418\u0442\u043e\u0433 \u043f\u0440\u043e\u0433\u043e\u043d\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043e\u0431\u0435\u0441\u043a\u0443\u0440\u0430\u0436\u0438\u0432\u0430\u0435\u0442: \u0435\u0441\u043b\u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u043e\u0434\u043d\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0441\u0442\u043e\u0438\u0442 \u0431\u043e\u043b\u0435\u0435-\u043c\u0435\u043d\u0435\u0435 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e, \u0442\u043e \u043f\u0440\u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0438 100 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0449\u0438\u0439 \u043f\u0440\u043e\u0435\u043a\u0446\u0438\u044e \u043c\u0435\u0442\u043e\u0434 <code>ManyFieldsRepository.findAllByNameUsingDto()<\/code> \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442 \u0441\u0438\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0438\u0433\u0440\u044b\u0432\u0430\u0442\u044c. \u042d\u0442\u043e \u043a\u043e\u043d\u0442\u0440\u0438\u043d\u0442\u0443\u0438\u0442\u0438\u0432\u043d\u043e, \u0432\u0435\u0434\u044c \u0447\u0430\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u043d\u0430 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u043e\u0442\u043a\u043b\u0438\u043a\u0430 \u0432\u043b\u0438\u044f\u0435\u0442 \u0438\u043c\u0435\u043d\u043d\u043e \u0437\u0430\u043f\u0440\u043e\u0441. \u0427\u0442\u043e \u0436, \u043d\u0443\u0436\u043d\u043e \u0440\u0430\u0441\u0447\u0435\u0445\u043b\u044f\u0442\u044c \u043f\u0440\u043e\u0444\u0438\u043b\u0438\u0440\u043e\u0432\u0449\u0438\u043a \u0438 \u0438\u0441\u043a\u0430\u0442\u044c \u0443\u0437\u043a\u0438\u0435 \u043c\u0435\u0441\u0442\u0430. <\/p>\n<p><a href=\"https:\/\/visualvm.github.io\/\" rel=\"noopener noreferrer nofollow\">VisualVM<\/a> \u0432\u0432\u0438\u0434\u0443 \u0435\u0433\u043e &#171;\u043f\u043e\u043f\u0441\u043e\u0432\u043e\u0441\u0442\u0438&#187; \u0438 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 <a href=\"https:\/\/www.youtube.com\/watch?v=QiGrTvsCZmA&amp;t=595\" rel=\"noopener noreferrer nofollow\">\u0432\u0440\u043e\u0436\u0434\u0451\u043d\u043d\u044b\u0445 \u043f\u043e\u0440\u043e\u043a\u043e\u0432<\/a> \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u043d\u0435 \u0431\u0443\u0434\u0435\u043c, \u043d\u0430\u0447\u043d\u0451\u043c \u0441 JFR, \u0431\u043b\u0430\u0433\u043e \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u0438\u0437 \u0431\u0435\u043d\u0447\u043c\u0430\u0440\u043a\u0430 (\u0432\u043e\u043e\u0431\u0449\u0435 \u0437\u0430\u043f\u0443\u0441\u043a \u0438\u0437 \u0433\u043b\u0430\u0432\u043d\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430 &#8212; \u044d\u0442\u043e \u043d\u0435 \u043e\u0447\u0435\u043d\u044c &#171;\u043f\u0440\u0430\u0432\u043e\u0441\u043b\u0430\u0432\u043d\u044b\u0439&#187; \u043f\u043e\u0434\u0445\u043e\u0434, \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u0435\u0435 \u0432\u0441\u0451-\u0442\u0430\u043a\u0438 \u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0431\u0435\u043d\u0447\u043c\u0430\u0440\u043a \u0438\u0437 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438, \u043d\u043e \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e \u043d\u0435 \u0441\u0442\u043e\u043b\u044c \u0432\u0430\u0436\u043d\u043e):<\/p>\n<pre><code class=\"java\">public class BenchmarkRunner {    public static void main(String[] args) throws Exception {     Options opt = new OptionsBuilder()       .include(ProjectionProfilingBenchmark.class.getSimpleName())       .warmupIterations(10)       .warmupTime(TimeValue.seconds(1))       .measurementIterations(2) \/\/ \u0434\u0432\u0430 \u0434\u043b\u0438\u043d\u043d\u044b\u0445 \u043f\u0440\u043e\u0433\u043e\u043d\u0430       .measurementTime(TimeValue.seconds(15))       .addProfiler(JavaFlightRecorderProfiler.class)       .forks(1) \/\/ 1 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0434\u043b\u044f \u0441\u0442\u0430\u0431\u0438\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430       .shouldFailOnError(true)       .jvmArgsAppend( \/\/ \u0434\u043e\u043f\u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0434\u043b\u044f \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b         \"-XX:+UnlockDiagnosticVMOptions\",         \"-XX:+DebugNonSafepoints\"       )       .build();      new Runner(opt).run();   } }<\/code><\/pre>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u043e\u043f\u044b\u0442 \u0441\u0442\u0430\u0432\u0438\u0442\u0441\u044f \u043d\u0430 &#171;\u0432\u043e\u0441\u044c\u043c\u0451\u0440\u043a\u0435&#187; (\u044d\u0442\u043e \u0432\u0430\u0436\u043d\u043e, \u0434\u0430\u043b\u0435\u0435 \u0432\u044b \u043f\u043e\u0439\u043c\u0451\u0442\u0435 \u043f\u043e\u0447\u0435\u043c\u0443). \u041f\u0440\u043e\u0433\u043e\u043d \u0437\u0430\u0432\u0435\u0440\u0448\u0451\u043d, \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u0447\u0438\u0441\u043b\u0430 (\u043d\u0430\u0436\u043c\u0438\u0442\u0435 \u043d\u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u043f\u043e\u043b\u043d\u043e\u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0430):<\/p>\n<figure class=\"\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/31\/in\/8g\/31in8gjpebyjg1aixjngywgnvfe.png\" width=\"auto\" height=\"auto\"><\/figure>\n<p>\u0417\u0434\u0435\u0441\u044c \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u043e, \u0447\u0442\u043e \u043b\u0438\u0448\u044c \u043e\u043a\u043e\u043b\u043e 6% \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u0430, \u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 &#8212; \u0431\u0435\u0437 \u043c\u0430\u043b\u043e\u0433\u043e 80%. \u0420\u0430\u0437\u0443\u043c\u0435\u0435\u0442\u0441\u044f, \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 &#171;\u0431\u043e\u0435\u0432\u043e\u0439&#187; \u0411\u0414 \u043d\u0430 \u0443\u0434\u0430\u043b\u0451\u043d\u043d\u043e\u043c \u0445\u043e\u0441\u0442\u0435 \u0441\u043e\u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0435 \u0441\u043c\u0435\u0441\u0442\u0438\u0442\u0441\u044f \u0432 \u0441\u0442\u043e\u0440\u043e\u043d\u0443 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430.<br \/>\u0420\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0432 \u043c\u0435\u0442\u043e\u0434 <code>ResultProcessor.processResult()<\/code> \u0432\u0438\u0434\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<ul>\n<li>\n<p>77% \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0435\u043a\u0446\u0438\u0438<\/p>\n<\/li>\n<li>\n<p>35% \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 <code>ConcurrentReferenceHashMap<\/code><\/p>\n<\/li>\n<li>\n<p>25% \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 <code>ProxyFactory.getProxy()<\/code><\/p>\n<\/li>\n<\/ul>\n<figure class=\"\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/zf\/z1\/yv\/zfz1yvcjkpw42oquhdewkt5xqsu.png\" alt=\" \" title=\" \" width=\"auto\" height=\"auto\"><\/p>\n<div><figcaption> <\/figcaption><\/div>\n<\/figure>\n<p>\u041f\u0440\u043e\u043a\u0430\u0447\u0438\u0432\u0430\u043d\u0438\u0435 <code>ProxyFactory.getProxy()<\/code> \u043e\u043f\u0438\u0441\u0430\u043d\u043e <a href=\"https:\/\/github.com\/spring-projects\/spring-framework\/pull\/25660\" rel=\"noopener noreferrer nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a>, \u0442\u0430\u043c \u0432\u0441\u0451 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043f\u0440\u043e\u0441\u0442\u043e \u0438 \u043d\u0435\u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e. \u041b\u0443\u0447\u0448\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 <code>ConcurrentReferenceHashMap<\/code>:  \u0433\u043e\u0440\u044f\u0447\u0438\u043c\u0438 \u043c\u0435\u0442\u043e\u0434\u0430\u043c\u0438 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440, \u043c\u0435\u0442\u043e\u0434 <code>calculateShift()<\/code> \u0438 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 <code>CRHM$Segment<\/code> (\u0437\u0434\u0435\u0441\u044c \u0438 \u0434\u0430\u043b\u0435\u0435 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 <code>CRHM<\/code> \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0441\u044f \u043a \u0432\u0435\u0440\u0441\u0438\u0438 \u0421\u043f\u0440\u0438\u043d\u0433\u0430 5.1.3). \u0412\u043e\u0442 \u043e\u043d\u0438:<\/p>\n<pre><code class=\"java\">public ConcurrentReferenceHashMap( int initialCapacity, float loadFactor, int concurrencyLevel, ReferenceType referenceType) {    Assert.isTrue(initialCapacity &gt;= 0, \"Initial capacity must not be negative\");   Assert.isTrue(loadFactor &gt; 0f, \"Load factor must be positive\");   Assert.isTrue(concurrencyLevel &gt; 0, \"Concurrency level must be positive\");   Assert.notNull(referenceType, \"Reference type must not be null\");   this.loadFactor = loadFactor;   this.shift = calculateShift(concurrencyLevel, MAXIMUM_CONCURRENCY_LEVEL);   int size = 1 &lt;&lt; this.shift;   this.referenceType = referenceType;   int roundedUpSegmentCapacity = (int) ((initialCapacity + size - 1L) \/ size);   this.segments = (Segment[]) Array.newInstance(Segment.class, size);   for (int i = 0; i &lt; this.segments.length; i++) {     this.segments[i] = new Segment(roundedUpSegmentCapacity);   } }  public Segment(int initialCapacity) {   this.referenceManager = createReferenceManager();   this.initialSize = 1 &lt;&lt; calculateShift(initialCapacity, MAXIMUM_SEGMENT_SIZE);   this.references = createReferenceArray(this.initialSize);   this.resizeThreshold = (int) (this.references.length * getLoadFactor()); }  protected static int calculateShift(int minimumValue, int maximumValue) {   int shift = 0;   int value = 1;   while (value &lt; minimumValue &amp;&amp; value &lt; maximumValue) {     value &lt;&lt;= 1;     shift++;   }   return shift; }<\/code><\/pre>\n<p>\u041f\u0435\u0440\u0432\u043e\u0435, \u0447\u0442\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0441\u043e\u043c\u043d\u0435\u043d\u0438\u044f \u0432 \u0434\u043e\u0441\u0442\u043e\u0432\u0435\u0440\u043d\u043e\u0441\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0446\u0438\u0444\u0440 &#8212; \u044d\u0442\u043e \u0434\u043e\u043b\u044f  <code>calculateShift()<\/code>. \u0421\u043e\u043c\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e, \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u044e\u0449\u0438\u0439 \u043c\u0435\u0442\u043e\u0434 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 \u043f\u043e\u0447\u0442\u0438 17%.<\/p>\n<p>\u041d\u0443\u0436\u043d\u0430 \u043f\u043e\u0432\u044b\u0448\u0435\u043d\u043d\u0430\u044f \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c, \u0430 \u0437\u043d\u0430\u0447\u0438\u0442 \u043d\u0430 \u043f\u043e\u043c\u043e\u0449\u044c \u0438\u0434\u0451\u0442 <a href=\"https:\/\/github.com\/jvm-profiling-tools\/async-profiler\" rel=\"noopener noreferrer nofollow\">async-profiler<\/a>. \u0423\u043f\u0440\u043e\u0441\u0442\u0438\u043c \u0431\u0435\u043d\u0447\u043c\u0430\u0440\u043a, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0444\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 <code>CRHM<\/code>:<\/p>\n<pre><code class=\"java\">@OutputTimeUnit(TimeUnit.NANOSECONDS) @BenchmarkMode(value = Mode.AverageTime) public class CRHMBenchmark {   @Benchmark   public Object instantiate() {     return new ConcurrentReferenceHashMap&lt;&gt;();   } }<\/code><\/pre>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0435\u0433\u043e \u0432 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043d\u0430\u0448\u0435\u0433\u043e \u0431\u0435\u043d\u0447\u043c\u0430\u0440\u043a\u0430 \u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u043c <code>AsynProfiler<\/code>:<\/p>\n<pre><code class=\"java\">public class BenchmarkRunner {    public static void main(String[] args) throws Exception {     Options opt = new OptionsBuilder()       .include(CRHMBenchmark.class.getSimpleName())       .warmupIterations(10)       .warmupTime(TimeValue.seconds(1))       .measurementIterations(10)       .measurementTime(TimeValue.seconds(1))       .addProfiler(AsyncProfiler.class)       .forks(1)       .shouldFailOnError(true)       .build();      new Runner(opt).run();   } }<\/code><\/pre>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0432 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0430\u043c \u0443\u0436\u0435 \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0412\u041c, \u043e\u043d\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 <code>AsyncProfiler.addJVMOptions()<\/code>. \u0421\u043c\u043e\u0442\u0440\u0438\u043c \u0432\u044b\u0432\u043e\u0434:<\/p>\n<pre><code>        ns  percent  samples  top ----------  -------  -------  --- 4270110916   27.81%      427  o.s.u.ConcurrentReferenceHashMap$Segment.&lt;init&gt; 3920827445   25.53%      392  o.s.u.ConcurrentReferenceHashMap$ReferenceManager.&lt;init&gt; 3691037002   24.04%      369  o.s.u.ConcurrentReferenceHashMap.createReferenceManager 1719959854   11.20%      172  o.s.u.ConcurrentReferenceHashMap.&lt;init&gt;  439959922    2.87%       44  java.lang.ref.ReferenceQueue.&lt;init&gt;  279927288    1.82%       28  java.util.concurrent.locks.ReentrantLock.&lt;init&gt;   70590822    0.46%        7  smp_call_function_single_[k]<\/code><\/pre>\n<p>\u0418\u0437 \u043f\u0440\u043e\u0444\u0438\u043b\u044f \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u043e \u043f\u0440\u043e\u043f\u0430\u043b <code>calculateShift()<\/code>, \u043f\u0440\u0430\u0432\u0434\u0430, \u044f\u0441\u043d\u043e\u0441\u0442\u0438 \u043e\u0442 \u044d\u0442\u043e\u0433\u043e \u043d\u0435 \u043f\u0440\u0438\u0431\u0430\u0432\u0438\u043b\u043e\u0441\u044c. \u0412\u044b\u0447\u0438\u0442\u043a\u0430 \u043a\u043e\u0434\u0430 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432\u044b\u044f\u0432\u0438\u0442\u044c \u043e\u0434\u043d\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0435 \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u0435: \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0430 <code>Segment(int)<\/code> \u0432\u0441\u0435\u0433\u0434\u0430 \u043e\u0434\u0438\u043d \u0438 \u0442\u043e\u0442 \u0436\u0435 \u0434\u043b\u044f \u0432\u0441\u0435\u0433\u043e \u0446\u0438\u043a\u043b\u0430 \u0432 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0435 <code>CRHM<\/code>, \u0442\u043e \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 <code>1 &lt;&lt; calculateShift(initialCapacity, MAXIMUM_SEGMENT_SIZE)<\/code> \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u044c \u043e\u0434\u0438\u043d \u0440\u0430\u0437. \u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u0440\u043e\u0441\u0442\u0430 \u044d\u0442\u043e \u043d\u0435 \u0434\u0430\u0441\u0442.<\/p>\n<p>\u0418\u0442\u0430\u043a, \u043c\u044b \u0432 \u0442\u0443\u043f\u0438\u043a\u0435: \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u0433\u043e\u0440\u044f\u0447\u0438\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439, \u0438 &#171;\u043d\u0430 \u0433\u043b\u0430\u0437&#187; \u043a\u043b\u044e\u0447 \u043a \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u043d\u0435 \u043d\u0430\u0439\u0442\u0438. JFR \u0438 async-profiler \u0443\u043a\u0430\u0437\u0430\u043b\u0438 \u043b\u0438\u0448\u044c \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e\u0435 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u043e\u0438\u0441\u043a\u0430, \u0430 \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u0447\u043a\u0438 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0431\u043e\u043b\u0435\u0435 \u0442\u043e\u0447\u043d\u044b\u0439 \u0438 \u043d\u0438\u0437\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442.<\/p>\n<h3>\u0412\u0441\u043a\u0440\u044b\u0432\u0430\u0435\u043c<\/h3>\n<p>\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c <code>o.o.j.p.LinuxPerfAsmProfiler<\/code>, \u0434\u043b\u044f \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u043e\u0441\u0442\u0438 \u044f \u0432\u043d\u043e\u0432\u044c \u0434\u0435\u043b\u0430\u044e \u044d\u0442\u043e \u0432 \u043a\u043e\u0434\u0435 (\u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0441 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 <code>-prof perfasm<\/code>):<\/p>\n<pre><code class=\"java\">public class BenchmarkRunner {    public static void main(String[] args) throws Exception {     Options opt = new OptionsBuilder()       .include(CRHMBenchmark.class.getSimpleName())       .warmupIterations(10)       .warmupTime(TimeValue.seconds(1))       .measurementIterations(1) \/\/ \u043e\u0434\u043d\u043e\u0433\u043e \u0434\u043b\u0438\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0433\u043e\u043d\u0430 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e       .measurementTime(TimeValue.seconds(10))   .addProfiler(LinuxPerfAsmProfiler.class)       .forks(1) \/\/ \u0432\u0430\u0436\u043d\u043e!       .shouldFailOnError(true)       .jvmArgsAppend( \"-XX:+UnlockDiagnosticVMOptions\",         \"-XX:+PrintAssembly\"       )       .build();      new Runner(opt).run();   } }<\/code><\/pre>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435: \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u043e\u0444\u0438\u043b\u0438\u0440\u043e\u0432\u0449\u0438\u043a\u0430 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u044f \u043e\u043f\u0438\u0441\u0430\u043b \u0432 \u043e\u0434\u043d\u043e\u0439 \u0438\u0437 <a href=\"https:\/\/habr.com\/ru\/post\/542148\/\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0445 \u0441\u0442\u0430\u0442\u0435\u0439<\/a>.<\/p>\n<p>\u0422\u0430\u043a\u0436\u0435 \u043d\u0430\u043b\u0438\u0447\u0438\u0435 1 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u0437\u0434\u0435\u0441\u044c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0440\u0435\u0448\u0430\u044e\u0449\u0438\u043c, \u0432\u0435\u0434\u044c \u0443 \u0440\u0430\u0437\u043d\u044b\u0445 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432 \u0430\u0434\u0440\u0435\u0441\u0430 \u043a\u043e\u043c\u0430\u043d\u0434 \u0441 \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c\u044e \u0431\u0443\u0434\u0443\u0442 \u0440\u0430\u0437\u043d\u044b\u043c\u0438, \u044d\u0442\u043e <a href=\"https:\/\/github.com\/openjdk\/jmh\/blob\/85dfd3bf334159b0bc1acf1059cb6c505d0c95e4\/jmh-samples\/src\/main\/java\/org\/openjdk\/jmh\/samples\/JMHSample_35_Profilers.java#L596\" rel=\"noopener noreferrer nofollow\">\u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043e\u0433\u043e\u0432\u043e\u0440\u0435\u043d\u043e \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/a>. <\/p>\n<h3>\u0418\u0437\u0443\u0447\u0430\u0435\u043c \u0441\u043e\u0431\u0440\u0430\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435<\/h3>\n<p>\u041d\u0430 \u043f\u0435\u0440\u0432\u044b\u0439 \u0432\u0437\u0433\u043b\u044f\u0434, <a href=\"https:\/\/github.com\/stsypanov\/assembly-profiling-and-all-all-all\/blob\/master\/local_8\/1.txt\" rel=\"noopener noreferrer nofollow\">\u0442\u0430\u043c \u0447\u0451\u0440\u0442 \u043d\u043e\u0433\u0443 \u0441\u043b\u043e\u043c\u0438\u0442<\/a>: \u043d\u0435\u043f\u043e\u043d\u044f\u0442\u043d\u043e \u0433\u0434\u0435 \u0438 \u0447\u0442\u043e \u0438\u0441\u043a\u0430\u0442\u044c. \u041d\u043e \u0435\u0441\u043b\u0438 \u043f\u0440\u0438\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c\u0441\u044f, \u0442\u043e \u0441\u043b\u0435\u0432\u0430 \u043c\u044b \u0432\u0438\u0434\u0438\u043c \u0434\u043e\u043b\u044e \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 \u0442\u0430 \u0438\u043b\u0438 \u0438\u043d\u0430\u044f \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f, \u043f\u0440\u0430\u0432\u0435\u0435 \u2014 \u0435\u0451 \u0430\u0434\u0440\u0435\u0441, \u0438\u043c\u044f \u0438 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u0435\u0439 \u0431\u0430\u0439\u0442-\u043a\u043e\u0434, \u0430 \u0435\u0449\u0451 \u043f\u0440\u0430\u0432\u0435\u0435 \u2014 <strong>\u0442\u043e\u0447\u043d\u043e\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u0435 \u043d\u0430 \u043c\u0435\u0442\u043e\u0434 \u0438 \u0441\u0442\u0440\u043e\u043a\u0443 \u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u043c Java-\u043a\u043e\u0434\u0435<\/strong>! \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435: \u043e\u0434\u043d\u043e\u043c\u0443 \u0431\u0430\u0439\u0442-\u043a\u043e\u0434\u0443 \u043c\u043e\u0436\u0435\u0442 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439. \u0414\u0430\u043b\u044c\u0448\u0435 \u0434\u0435\u043b\u043e \u0442\u0435\u0445\u043d\u0438\u043a\u0438: \u043b\u0438\u0441\u0442\u0430\u0435\u043c \u043a\u043e\u0434 \u0438 \u0438\u0449\u0435\u043c \u0433\u043e\u0440\u044f\u0447\u0435\u0435 \u043c\u0435\u0441\u0442\u043e, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0432\u043e\u0442 \u044d\u0442\u043e:<\/p>\n<pre><code>\/\/ \u0441\u0442\u0440\u043e\u043a\u0430 78  4.82%     0x00007f137d227722: mov     0x8(%rsp),%r14<\/code><\/pre>\n<p>\u0427\u0438\u0442\u0430\u0442\u0435\u043b\u044c \u0441\u0435\u0439\u0447\u0430\u0441 \u0447\u0435\u0448\u0435\u0442 \u0437\u0430\u0442\u044b\u043b\u043e\u043a \u0438 \u0434\u0443\u043c\u0430\u0435\u0442 &#171;\u041c-\u043c-\u043c, \u0438 \u0447\u0442\u043e \u044f \u0434\u043e\u043b\u0436\u0435\u043d \u0442\u0443\u0442 \u0443\u0432\u0438\u0434\u0435\u0442\u044c?&#187; \u041f\u0440\u0438\u0437\u043d\u0430\u044e\u0441\u044c, \u044f \u0441\u0430\u043c \u0434\u043e\u043b\u0433\u043e \u0441\u043c\u043e\u0442\u0440\u0435\u043b \u043d\u0430 \u044d\u0442\u043e \u0431\u0435\u0437 \u0435\u0434\u0438\u043d\u043e\u0439 \u0432\u043d\u044f\u0442\u043d\u043e\u0439 \u043c\u044b\u0441\u043b\u0438, \u043f\u043e\u043a\u0430 @apangin \u043d\u0435 \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u0430\u043b, \u0447\u0442\u043e \u043f\u0435\u0440\u0444 \u0447\u0430\u0441\u0442\u043e \u0441\u043c\u0435\u0449\u0430\u0435\u0442 \u0433\u043e\u0440\u044f\u0447\u0438\u0435 \u043c\u0435\u0441\u0442\u0430 \u0432 \u0432\u044b\u0432\u043e\u0434\u0435, \u044d\u0442\u043e \u043d\u0435\u043f\u0440\u0438\u044f\u0442\u043d\u043e\u0435 \u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f <em>performance event skid<\/em> \u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043e \u0442\u0430\u043a:<\/p>\n<blockquote>\n<p>The skid is defined as the distance between the IP(s) that caused the issue to the IP(s) where the event is tagged<\/p>\n<\/blockquote>\n<p>\u041f\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u043e\u0431 \u044d\u0442\u043e\u043c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043c\u043e\u0436\u043d\u043e \u0432 <a href=\"https:\/\/easyperf.net\/blog\/2018\/08\/29\/Understanding-performance-events-skid\" rel=\"noopener noreferrer nofollow\">\u0441\u0442\u0430\u0442\u044c\u0435<\/a> \u0414\u0435\u043d\u0438\u0441\u0430 \u0411\u0430\u0445\u0432\u0430\u043b\u043e\u0432\u0430.<\/p>\n<p>\u0414\u043b\u044f \u043d\u0430\u0441 \u044d\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u043f\u043e\u0438\u0441\u043a\u0430\u0442\u044c \u0433\u0434\u0435-\u0442\u043e \u0432\u043e\u043a\u0440\u0443\u0433 \u0433\u043e\u0440\u044f\u0447\u0438\u0445 \u0441\u0442\u0440\u043e\u043a:<\/p>\n<pre><code>0.44%   0x00007f137d22771b: mov   %r10,%r13       ;*getfield segments                                                      ; - o.s.u.CRHM::&lt;init&gt;@121 (line 183)         0x00007f137d22771e: mov   (%rsp),%r9d 4.82%   0x00007f137d227722: mov   0x8(%rsp),%r14 0.11%   0x00007f137d227727: mov   0x10(%rsp),%rsi         0x00007f137d22772c: mov   0x18(%rsp),%r11         0x00007f137d227731: mov   0x20(%rsp),%r8 0.66%   0x00007f137d227736: mov   0x30(%rsp),%rdi  ;*aload_0                                                      ; - o.s.u.CRHM::&lt;init&gt;@128 (line 184)<\/code><\/pre>\n<p>\u0411\u0430\u0439\u0442-\u043a\u043e\u0434 <code>getfield<\/code> \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u0447\u0442\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u044f, \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 <code>segments<\/code>, \u0432 \u0441\u0442\u0440\u043e\u043a\u0435 183:<\/p>\n<pre><code class=\"java\">for (int i = 0; i &lt; this.segments.length; i++) {   this.segments[i] = new Segment(roundedUpSegmentCapacity); }<\/code><\/pre>\n<p>\u041f\u043e\u0447\u0435\u043c\u0443 \u0442\u0430\u043a \u043c\u043d\u043e\u0433\u043e \u0438 \u043f\u043e\u0447\u0435\u043c\u0443 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043d\u0435 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043b\u043e \u0434\u043e\u0441\u0442\u0443\u043f \u0432 \u0442\u0430\u043a\u043e\u043c \u043f\u0440\u043e\u0441\u0442\u043e\u043c \u043a\u043e\u0434\u0435? \u0427\u0442\u043e\u0431\u044b \u043e\u0442\u0432\u0435\u0442\u0438\u0442\u044c \u043d\u0430 \u044d\u0442\u043e\u0442 \u0432\u043e\u043f\u0440\u043e\u0441 \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u0438\u0441\u043a\u0430\u0442\u044c \u0434\u0440\u0443\u0433\u0438\u0435 \u0433\u043e\u0440\u044f\u0447\u0438\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438:<\/p>\n<pre><code>\/\/ \u0441\u0442\u0440\u043e\u043a\u0430 124  18.29%     0x00007f137d2277e4: mov     0x60(%r15),%rdx<\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u043f\u043e\u043d\u044f\u0442\u043d\u043e \u043d\u0435 \u0431\u043e\u043b\u044c\u0448\u0435, \u0447\u0435\u043c \u0432 \u043f\u0435\u0440\u0432\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435, \u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0432\u043e\u043a\u0440\u0443\u0433:<\/p>\n<pre><code> 0.99%  0x00007f137d2277d7: mov     %r12l,(%r10,%rcx)         0x00007f137d2277db: mov     %r12d,0x14(%rbx)         0x00007f137d2277df: lock addl $0x0,(%rsp)    ;*putfield count                                                        ; - o.s.u.CRHM$Segment::&lt;init&gt;@11 (line 476)                                                        ; - o.s.u.CRHM::&lt;init&gt;@141 (line 184) 18.29%  0x00007f137d2277e4: mov     0x60(%r15),%rdx         0x00007f137d2277e8: mov     %rdx,%r10         0x00007f137d2277eb: add     $0x18,%r10  0.55%  0x00007f137d2277ef: cmp     0x70(%r15),%r10<\/code><\/pre>\n<p>\u041b\u044e\u0431\u043e\u043f\u044b\u0442\u043d\u043e, \u0446\u0435\u043b\u044b\u0445 18,29% \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 \u0437\u0430\u043f\u0438\u0441\u044c \u0432 \u043f\u043e\u043b\u0435 <code>count<\/code> \u0432 \u0441\u0442\u0440\u043e\u043a\u0435 476:<\/p>\n<pre><code class=\"java\">protected final class Segment extends ReentrantLock {    private volatile int count = 0;  }<\/code><\/pre>\n<p>\u041f\u043e\u0445\u043e\u0436\u0435, \u044d\u0442\u043e \u0432\u044b\u0441\u0442\u0440\u0435\u043b \u0432 \u0434\u0435\u0441\u044f\u0442\u043a\u0443! \u041c\u044b \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c 0 \u0432 \u043f\u043e\u043b\u0435 \u0446\u0435\u043b\u043e\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e <a href=\"https:\/\/docs.oracle.com\/javase\/specs\/jls\/se14\/html\/jls-4.html#jls-4.12.5\" rel=\"noopener noreferrer nofollow\">\u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438<\/a> \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0432\u043d\u043e 0 (\u0438 \u0432\u0441\u0451 \u044d\u0442\u043e \u0432 \u0446\u0438\u043a\u043b\u0435). \u0410 \u0442\u0435 \u0441\u0430\u043c\u044b\u0435 18,29% \u043d\u0430\u043a\u0440\u0443\u0447\u0438\u0432\u0430\u0435\u0442 \u0433\u0430\u0434\u043a\u0438\u0439 <code>volatile<\/code>:<\/p>\n<pre><code class=\"java\">@OutputTimeUnit(TimeUnit.NANOSECONDS) @BenchmarkMode(value = Mode.AverageTime) public class VolatileFieldZeroingBenchmark {    @Benchmark   public Object explicitInit() {     return new Class1();   }    @Benchmark   public Object defaultInit() {     return new Class2();   }    private static class Class1 {     private volatile boolean field = false;   }    private static class Class2 {     private volatile boolean field;   } }<\/code><\/pre>\n<p>\u0412 \u043e\u0431\u043e\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u043f\u043e\u0441\u043b\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u0435\u0439 \u0431\u0443\u0434\u0435\u0442 <code>false<\/code>, \u043e\u0434\u043d\u0430\u043a\u043e \u043f\u0440\u0438 \u044f\u0432\u043d\u043e\u043c \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u043d\u0438\u0438 \u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u044c \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0432\u044b\u0448\u0435:<\/p>\n<pre><code>Benchmark                                     Score   Error  Units VolatileFieldZeroingBenchmark.explicitInit   11.200 \u00b1 0.270  ns\/op VolatileFieldZeroingBenchmark.defultInit      3.447 \u00b1 0.208  ns\/op<\/code><\/pre>\n<p>\u0417\u0430\u043f\u0438\u0441\u044c \u0432 \u0432\u043e\u043b\u0430\u0442\u0438\u043b\u044c\u043d\u043e\u0435 \u043f\u043e\u043b\u0435 \u0437\u0430\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 \u0434\u043b\u044f \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0441\u043e\u0433\u043b\u0430\u0441\u043e\u0432\u0430\u043d\u043d\u043e\u0441\u0442\u0438 \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 \u043c\u043e\u0434\u0435\u043b\u044c\u044e \u043f\u0430\u043c\u044f\u0442\u0438. \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f <code>lock addl $0x0,(%rsp)<\/code>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u0431\u0430\u0440\u044c\u0435\u0440\u0430 <code>StoreLoad<\/code>. \u0417\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u0442\u044c \u044d\u0442\u0438 \u043d\u0438\u0437\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u044b\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043d\u0435\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e (\u043e\u043d\u0438 \u043c\u043e\u0433\u0443\u0442 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c\u0441\u044f \u0441\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0435\u043c), \u0432\u0430\u0436\u043d\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c \u0432\u044b\u0441\u043e\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u044b\u0435 \u0437\u0430\u043a\u043e\u043d\u043e\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u0438.<\/p>\n<p>\u0412\u044b\u0445\u043e\u0434\u0438\u0442, \u043d\u0438\u0447\u0442\u043e \u043d\u0435 \u043c\u0435\u0448\u0430\u0435\u0442 \u043d\u0430\u043c \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435<\/p>\n<pre><code class=\"java\">private volatile int count = 0;<\/code><\/pre>\n<p>\u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435\u043c<\/p>\n<pre><code class=\"java\">private volatile int count;<\/code><\/pre>\n<p>\u0418\u043b\u0438 \u0432\u0441\u0451 \u0436\u0435 \u043c\u0435\u0448\u0430\u0435\u0442? \u042d\u0442\u0438\u043c \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u043c \u0437\u0430\u0434\u0430\u043b\u0441\u044f \u0410\u043b\u0435\u043a\u0441\u0435\u0439 \u0428\u0438\u043f\u0438\u043b\u0451\u0432 \u0432 <a href=\"http:\/\/cs.oswego.edu\/pipermail\/concurrency-interest\/2015-December\/014767.html\" rel=\"noopener noreferrer nofollow\">\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e\u0439 \u0440\u0430\u0441\u0441\u044b\u043b\u043a\u0435 \u043e \u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438<\/a>. \u041a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0447\u0435\u0441\u043a\u0438 \u0441\u043e\u0432\u0435\u0442\u0443\u044e \u043a \u0432\u0434\u0443\u043c\u0447\u0438\u0432\u043e\u043c\u0443 \u043f\u0440\u043e\u0447\u0442\u0435\u043d\u0438\u044e \u043a\u0430\u043a \u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u043f\u043e\u0432\u0435\u0434\u0451\u0442 \u0441\u0435\u0431\u044f \u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u044b\u0439 \u043a\u043e\u0434 \u0438 \u043c\u043e\u0434\u0435\u043b\u044c \u043f\u0430\u043c\u044f\u0442\u0438.<\/p>\n<p>\u0422\u043e\u0447\u043a\u0443 <a href=\"http:\/\/cs.oswego.edu\/pipermail\/concurrency-interest\/2015-December\/014770.html\" rel=\"noopener noreferrer nofollow\">\u043f\u043e\u0441\u0442\u0430\u0432\u0438\u043b<\/a> \u0414\u0430\u0433 \u041b\u0438:<\/p>\n<blockquote>\n<p>But your account is a more careful version of reasoning we&#8217;ve done before to conclude that there is never any reason to explicitly initialize fields to 0\/0.0\/false\/null.<\/p>\n<\/blockquote>\n<p>\u0421\u0430\u043c\u0430 \u0438\u0441\u0442\u043e\u0440\u0438\u044f \u0442\u044f\u043d\u0435\u0442\u0441\u044f \u0441 2008 (!) \u0433\u043e\u0434\u0430: <a href=\"https:\/\/bugs.openjdk.java.net\/browse\/JDK-6736490\" rel=\"noopener noreferrer nofollow\">Remove unnecessary explicit initialization of volatile variables<\/a>. \u041a \u044d\u0442\u043e\u0439 \u0436\u0435 \u0437\u0430\u0434\u0430\u0447\u0435 \u043e\u0442\u043d\u043e\u0441\u044f\u0442\u0441\u044f<\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/bugs.openjdk.java.net\/browse\/JDK-8035284\" rel=\"noopener noreferrer nofollow\">AbstractMap unnecessarily initializes two volatiles to null<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/bugs.openjdk.java.net\/browse\/JDK-8145680\" rel=\"noopener noreferrer nofollow\">Remove unnecessary explicit initialization of volatile variables in java.base<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/bugs.openjdk.java.net\/browse\/JDK-8145948\" rel=\"noopener noreferrer nofollow\">Initializing volatile fields to default values should be optimized<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/bugs.openjdk.java.net\/browse\/JDK-8251548\" rel=\"noopener noreferrer nofollow\">Remove unnecessary explicit initialization of volatile variables in security-libs code<\/a><\/p>\n<\/li>\n<\/ul>\n<p>\u0421\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0435\u043c \u043d\u0435\u043d\u0443\u0436\u043d\u043e\u0441\u0442\u0438 \u044f\u0432\u043d\u043e\u0433\u043e \u0437\u0430\u043d\u0443\u043b\u0435\u043d\u0438\u044f \u0432\u043e\u043b\u0430\u0442\u0438\u043b\u044c\u043d\u044b\u0445 \u043f\u043e\u043b\u0435\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0435\u043d\u0443\u0436\u043d\u043e\u0441\u0442\u044c \u0437\u0430\u043d\u0443\u043b\u0435\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0430\u0442\u043e\u043c\u0430\u0440\u043d\u044b\u0445 \u043a\u043b\u0430\u0441\u0441\u043e\u0432:<\/p>\n<pre><code class=\"java\">@OutputTimeUnit(TimeUnit.NANOSECONDS) @BenchmarkMode(value = Mode.AverageTime) public class AtomicZeroingBenchmark {    @Benchmark   public Object defaultValue() {     return new AtomicInteger();   }    @Benchmark   public Object explicitValue() {     return new AtomicInteger(0);   } }<\/code><\/pre>\n<p>\u041f\u0435\u0440\u0432\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0431\u044b\u0441\u0442\u0440\u0435\u0435:<\/p>\n<pre><code>Benchmark                             Mode  Cnt   Score   Error  Units AtomicZeroingBenchmark.defaultValue   avgt   20   3,037 \u00b1 0,100  ns\/op AtomicZeroingBenchmark.explicitValue  avgt   20  13,976 \u00b1 0,220  ns\/op<\/code><\/pre>\n<p>\u0412\u043e\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u0438\u0437 \u0436\u0438\u0437\u043d\u0438: <a href=\"https:\/\/github.com\/spring-projects\/spring-framework\/pull\/25261\" rel=\"noopener noreferrer nofollow\">\u0440\u0430\u0437<\/a>, <a href=\"https:\/\/github.com\/spring-projects\/spring-framework\/pull\/25846\" rel=\"noopener noreferrer nofollow\">\u0434\u0432\u0430<\/a>, <a href=\"https:\/\/github.com\/openjdk\/jdk\/pull\/510\" rel=\"noopener noreferrer nofollow\">\u0442\u0440\u0438<\/a>.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0432\u0435\u0440\u043d\u0451\u043c\u0441\u044f \u043a \u0430\u0441\u0441\u0435\u043c\u0431\u043b\u0435\u0440\u0443. \u041f\u043e\u0445\u043e\u0436\u0438\u0439 \u043a\u043e\u0434 \u043d\u0430\u0445\u043e\u0434\u0438\u043c \u043d\u0438\u0436\u0435:<\/p>\n<pre><code>\/\/ \u0441\u0442\u0440\u043e\u043a\u0430 192          0x00007f137d2278c9: lock addl $0x0,(%rsp)   ;*putfield head                                                        ; - java.lang.ref.ReferenceQueue::&lt;init&gt;@18 (line 56)                                                        ; - o.s.u.CRHM$ReferenceManager::&lt;init&gt;@14 (line 984)                                                        ; - o.s.u.CRHM::createReferenceManager@5 (line 207)                                                        ; - o.s.u.CRHM$Segment::&lt;init&gt;@16 (line 485)                                                        ; - o.s.u.CRHM::&lt;init&gt;@141 (line 184) 17.31%  0x00007f137d2278ce: mov     %r10d,0xc(%rdx) ;*putfield queue                                                        ; - o.s.u.CRHM$ReferenceManager::&lt;init&gt;@17 (line 984)                                                        ; - o.s.u.CRHM::createReferenceManager@5 (line 207)                                                        ; - o.s.u.CRHM$Segment::&lt;init&gt;@16 (line 485)                                                        ; - o.s.u.CRHM::&lt;init&gt;@141 (line 184)         0x00007f137d2278d2: mov     %r12,0x10(%rbp) ;*putfield queueLength <\/code><\/pre>\n<p>\u041f\u0440\u0438\u0437\u043d\u0430\u043a\u0438 \u0442\u0435 \u0436\u0435, \u0430 \u0432\u0438\u043d\u043e\u0432\u043d\u0438\u043a\u043e\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f <code>java.lang.ref.ReferenceQueue<\/code>:<\/p>\n<pre><code class=\"java\">public class ReferenceQueue&lt;T&gt; {    private volatile Reference&lt;? extends T&gt; head = null;    }<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u044d\u0442\u043e \u043a\u043b\u0430\u0441\u0441 \u0438\u0437 JDK, \u043c\u044b \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u043c\u043e\u0436\u0435\u043c \u0441 \u043d\u0438\u043c \u043f\u043e\u0434\u0435\u043b\u0430\u0442\u044c (\u0432 Java 9+ \u044d\u0442\u043e <a href=\"http:\/\/hg.openjdk.java.net\/jdk9\/jdk9\/jdk\/rev\/70ae19973321\" rel=\"noopener noreferrer nofollow\">\u0438\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043e<\/a>).<\/p>\n<p>\u0415\u0434\u0435\u043c \u0434\u0430\u043b\u044c\u0448\u0435. \u0412 \u0441\u0430\u043c\u043e\u043c \u043a\u043e\u043d\u0446\u0435 \u0430\u0441\u0441\u0435\u043c\u0431\u043b\u0435\u0440\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u043d\u0430\u0445\u043e\u0434\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0443\u0447\u0430\u0441\u0442\u043e\u043a:<\/p>\n<pre><code> 8.00%  0x00007f137d22766a: mov     %rbp,%r8  0.22%  0x00007f137d22766d: mov     %r10d,0x20(%rbp)         0x00007f137d227671: mov     %rbp,%r10  0.66%  0x00007f137d227674: shr     $0x9,%r10         0x00007f137d227678: movabs  $0x7f138fec8000,%r11         0x00007f137d227682: mov     %r12l,(%r11,%r10)         0x00007f137d227686: lock addl $0x0,(%rsp)     ;*putfield references                                                       ; - o.s.u.CRHM$Segment::&lt;init&gt;@43 (line 487)                                                       ; - o.s.u.CRHM::&lt;init&gt;@141 (line 184) 10.51%  0x00007f137d22768b: mov     0x20(%rbp),%r11d  ;*getfield references                                                       ; - o.s.u.CRHM$Segment::&lt;init&gt;@48 (line 488)                                                       ; - o.s.u.CRHM::&lt;init&gt;@141 (line 184)  0.11%  0x00007f137d22768f: mov     0xc(%r11),%r10d   ;*arraylength                                                       ; - o.s.u.CRHM$Segment::&lt;init&gt;@51 (line 488)                                                       ; - o.s.u.CRHM::&lt;init&gt;@141 (line 184)                                                       ; implicit exception: dispatches to 0x00007f137d227e91<\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c 8% \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 \u0432\u0441\u0451 \u0442\u043e\u0442 \u0436\u0435 <code>lock addl $0x0,(%rsp)<\/code>, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0432\u0443\u044e\u0449\u0438\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 \u0432\u043e\u043b\u0430\u0442\u0438\u043b\u044c\u043d\u043e\u0435 \u043f\u043e\u043b\u0435 \u0432 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0435 <code>Segment<\/code>:<\/p>\n<pre><code class=\"java\">protected final class Segment extends ReentrantLock {   private volatile Reference&lt;K, V&gt;[] references;    public Segment(int initialCapacity) {     this.references = createReferenceArray(this.initialSize);   } }<\/code><\/pre>\n<p><code>volatile<\/code> \u0437\u0434\u0435\u0441\u044c \u043d\u0443\u0436\u0435\u043d \u0434\u043b\u044f \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u044b \u0432 \u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u0439 \u0441\u0440\u0435\u0434\u0435, \u0442\u0430\u043a \u0447\u0442\u043e \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u0430\u0435\u043c, \u0430 \u0432\u043e\u0442 \u043a 10,51%, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c \u0431\u0430\u0439\u0442-\u043a\u043e\u0434\u0443 <code>arraylength<\/code> \u0432 \u0441\u0442\u0440\u043e\u043a\u0435 488:<\/p>\n<pre><code class=\"java\">protected final class Segment extends ReentrantLock {   private volatile Reference&lt;K, V&gt;[] references;      public Segment(int initialCapacity) { this.references = createReferenceArray(this.initialSize);     this.resizeThreshold = (int) (this.references.length * getLoadFactor());   } }<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043c\u044b \u0447\u0438\u0442\u0430\u0435\u043c \u0438\u0437 \u0432\u043e\u043b\u0430\u0442\u0438\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u044f, \u0442\u043e \u0447\u0442\u0435\u043d\u0438\u0435 \u0441\u0442\u043e\u0438\u0442 \u0434\u043e\u0440\u043e\u0436\u0435 \u043e\u0431\u044b\u0447\u043d\u043e\u0433\u043e. \u0420\u0435\u0448\u0435\u043d\u0438\u0435\u043c \u0437\u0434\u0435\u0441\u044c \u043c\u043e\u0436\u0435\u0442 \u0441\u0442\u0430\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439, \u0432 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043f\u0438\u0441\u0430\u043d \u043c\u0430\u0441\u0441\u0438\u0432, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u0439 \u0438\u0437 <code>createReferenceArray<\/code>, \u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u043d\u0438\u0435 \u0438 \u0447\u0442\u0435\u043d\u0438\u0435 \u0438\u0437 \u043d\u0435\u0451.<\/p>\n<details class=\"spoiler\">\n<summary>\u0417\u0430\u043c\u0435\u0447\u0430\u043d\u0438\u0435<\/summary>\n<div class=\"spoiler__content\">\n<p>\u041c\u043d\u0435 \u043a\u0430\u0436\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0437\u0434\u0435\u0441\u044c \u043c\u044b \u0438\u043c\u0435\u0435\u043c \u0434\u0435\u043b\u043e \u0441 \u043e\u0448\u0438\u0431\u043a\u043e\u0439 \u043f\u0440\u043e\u0444\u0430\u0439\u043b\u0435\u0440\u0430, \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043d\u0430\u0432\u0435\u0440\u043d\u044f\u043a\u0430 \u0441\u043c\u043e\u0433\u043b\u043e \u0431\u044b \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u044c \u0438 \u0447\u0442\u0435\u043d\u0438\u0435 \u0438\u0437 \u043e\u0434\u043d\u043e\u0433\u043e \u0438 \u0442\u043e\u0433\u043e \u0436\u0435 \u0432\u043e\u043b\u0430\u0442\u0438\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u044f, \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0435 10,51% \u043e\u0442\u043d\u043e\u0441\u044f\u0442\u0441\u044f \u043a \u0447\u0442\u0435\u043d\u0438\u044e\/\u0437\u0430\u043f\u0438\u0441\u0438 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0432 \u0446\u0438\u043a\u043b\u0435 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0430 <code>CRHM<\/code>. \u041a \u0442\u043e\u043c\u0443 \u0436\u0435 \u044f \u0437\u0430\u043c\u0435\u0442\u0438\u043b, \u0447\u0442\u043e \u0430\u0441\u0441\u0435\u043c\u0431\u043b\u0435\u0440\u043d\u044b\u0439 \u043f\u0440\u043e\u0444\u0438\u043b\u044c \u043c\u043e\u0436\u0435\u0442 \u043e\u0442\u043b\u0438\u0447\u0430\u0442\u044c\u0441\u044f \u043e\u0442 \u044f\u0434\u0440\u0430 \u043a \u044f\u0434\u0440\u0443.<\/p>\n<\/div>\n<\/details>\n<p>\u041d\u0430\u043b\u0438\u0447\u0438\u0435 \u0432\u043e\u043b\u0430\u0442\u0438\u043b\u044c\u043d\u044b\u0445 \u0434\u043e\u0441\u0442\u0443\u043f\u043e\u0432 \u0432\u043d\u0443\u0442\u0440\u0438 \u0446\u0438\u043a\u043b\u0430, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043c\u0430\u0441\u0441\u0438\u0432\u0443 \u0447\u0435\u0440\u0435\u0437 \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u043a \u043f\u043e\u043b\u044e \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u0435\u0433\u043e (\u0434\u043e\u0441\u0442\u0443\u043f) \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0434\u043e\u0440\u043e\u0433\u0438\u043c. \u0418\u043c\u0435\u043d\u043d\u043e \u043a \u0434\u043e\u0441\u0442\u0443\u043f\u0443 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0441\u044f \u0441\u0430\u043c\u044b\u0439 \u043f\u0435\u0440\u0432\u044b\u0439 \u0433\u043e\u0440\u044f\u0447\u0438\u0439 \u0443\u0447\u0430\u0441\u0442\u043e\u043a \u0430\u0441\u0441\u0435\u043c\u0431\u043b\u0435\u0440\u0430:<\/p>\n<pre><code class=\"java\">for (int i = 0; i &lt; this.segments.length; i++) {            \/\/ \u0447\u0438\u0442\u0430\u0435\u043c \u0438\u0437 \u043f\u043e\u043b\u044f   this.segments[i] = new Segment(roundedUpSegmentCapacity); \/\/ \u043f\u0438\u0448\u0435\u043c \u0432 \u043f\u043e\u043b\u0435 }<\/code><\/pre>\n<p>\u0427\u0442\u043e \u0441 \u044d\u0442\u0438\u043c \u0434\u0435\u043b\u0430\u0442\u044c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u043e \u0432 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0439 \u0432 \u0441\u0430\u043c\u043e\u043c \u043d\u0430\u0447\u0430\u043b\u0435 <a href=\"https:\/\/habr.com\/ru\/post\/432824\/\" rel=\"noopener noreferrer nofollow\">\u0441\u0442\u0430\u0442\u044c\u0435<\/a>, \u0442\u0430\u043a \u0447\u0442\u043e \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u044d\u0442\u043e\u043c \u044f \u043d\u0435 \u0431\u0443\u0434\u0443.<\/p>\n<h3>\u0410 \u0447\u0442\u043e \u0441 \u0431\u043e\u043b\u0435\u0435 \u0441\u0432\u0435\u0436\u0438\u043c\u0438 \u0432\u0435\u0440\u0441\u0438\u044f\u043c\u0438?<\/h3>\n<p>\u041d\u0438\u0447\u0442\u043e \u043d\u0435 \u043c\u0435\u0448\u0430\u0435\u0442 \u043d\u0430\u043c \u043f\u0440\u043e\u0433\u043d\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u0436\u0435 \u0431\u0435\u043d\u0447\u043c\u0430\u0440\u043a \u043d\u0430 \u043d\u043e\u0432\u044b\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445 Java, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043d\u0430 11\/17. \u0418 \u0442\u0443\u0442 \u043d\u0430\u0441 \u0436\u0434\u0451\u0442 \u043d\u0435\u0436\u0434\u0430\u043d\u0447\u0438\u043a: \u0432\u0441\u0451 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043a\u0430\u043a \u043f\u0440\u0435\u0436\u0434\u0435, \u043d\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043e\u0442\u043b\u0438\u0447\u0430\u044e\u0442\u0441\u044f.<\/p>\n<p>\u041f\u043e\u043b\u043d\u044b\u0439 \u0432\u044b\u0432\u043e\u0434 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f <a href=\"https:\/\/github.com\/stsypanov\/assembly-profiling-and-all-all-all\/blob\/master\/local_11\/1.txt\" rel=\"noopener noreferrer nofollow\">\u0442\u0443\u0442<\/a>, \u0438 \u043f\u0440\u043e\u0431\u0435\u0436\u0430\u0432\u0448\u0438\u0441\u044c \u043f\u043e \u043d\u0435\u043c\u0443 \u043d\u0435\u043e\u0436\u0438\u0434\u0430\u043d\u043d\u043e \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0432\u0430\u0435\u043c, \u0447\u0442\u043e \u0438\u0437 \u043d\u0435\u0433\u043e \u0438\u0441\u0447\u0435\u0437\u043b\u043e \u0432\u0441\u044f\u043a\u043e\u0435 \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u043d\u0438\u0435 <code>putfield count<\/code>.<\/p>\n<p>\u0412\u043f\u0435\u0440\u0432\u044b\u0435 \u043e\u0441\u043e\u0437\u043d\u0430\u0432 \u044d\u0442\u043e \u044f \u043f\u043e\u0434\u0443\u043c\u0430\u043b, \u0447\u0442\u043e \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u0432 \u0441\u0442\u0430\u0440\u0448\u0438\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445 \u0441\u0442\u0430\u043b \u043d\u0430\u0441\u0442\u043e\u043b\u044c\u043a\u043e \u043a\u0440\u0443\u0442\u044b\u043c, \u0447\u0442\u043e \u0441\u043c\u043e\u0433 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0442\u044c \u0438 \u0432\u044b\u0431\u0440\u043e\u0441\u0438\u0442\u044c \u043b\u0438\u0448\u043d\u0435\u0435 \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u043d\u0438\u0435 \u0432\u043e\u043b\u0430\u0442\u0438\u043b\u044c\u043d\u043e\u043c\u0443 \u043f\u043e\u043b\u044e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e. \u041d\u043e \u0432\u0441\u0451 \u0436\u0435 \u0440\u0435\u0448\u0438\u043b \u043f\u0435\u0440\u0435\u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0438 \u043f\u043e\u0438\u0441\u043a\u0430\u0442\u044c <code>lock addl $0x0<\/code>. \u0418 \u044d\u0442\u0430 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u043d\u0438\u043a\u0443\u0434\u0430 \u043d\u0435 \u0434\u0435\u043b\u0430\u0441\u044c:<\/p>\n<pre><code>       \u256d 0x00007f5408368ff5: jmp     0x7f5408369004        \u2502 0x00007f5408368ff7: mov     %rdi,0xfffffffffffffff8(%r10,%r9)        \u2502                               ;*putfield sync {reexecute=0 rethrow=0 return_oop=0}        \u2502                               ; - j.u.c.l.ReentrantLock::&lt;init&gt;@12 (line 239)        \u2502                               ; - o.s.u.CRHM$Segment::&lt;init&gt;@6 (line 484)        \u2502                               ; - o.s.u.CRHM::&lt;init&gt;@141 (line 184)        \u2502 0x00007f5408368ffc: add     $0xfffffffffffffff8,%r9        \u2502 0x00007f5408369000: mov     %r9,0x70(%r15)  0.87% \u2198 0x00007f5408369004: movl    $0x0,0x14(%rbx)  0.05%   0x00007f540836900b: lock addl $0x0,0xffffffffffffffc0(%rsp) 24.08%   0x00007f5408369011: mov     0x118(%r15),%r13          0x00007f5408369018: mov     %r13,%r10<\/code><\/pre>\n<p>\u041e\u043d\u0430 \u043a\u0430\u043a \u0438 \u043f\u0440\u0435\u0436\u0434\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u0441\u043b\u0435 \u0432\u044b\u0437\u043e\u0432\u0430 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0430 <code>ReentrantLock<\/code>, \u0434\u043e\u0447\u0435\u0440\u043d\u0438\u043c \u043a\u043b\u0430\u0441\u0441\u043e\u043c \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f <code>ConcurrentReferenceHashMap$Segment<\/code>. \u0413\u043b\u0430\u0432\u043d\u0430\u044f \u0442\u0440\u0443\u0434\u043d\u043e\u0441\u0442\u044c \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043d\u0430\u0447\u043d\u0451\u0442 \u043f\u0440\u043e\u0444\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0430 Java 11 \u0438 \u0432\u044b\u0448\u0435, \u043e\u043d \u043f\u0440\u043e\u0441\u0442\u043e-\u043d\u0430\u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0435 \u0443\u0432\u0438\u0434\u0438\u0442 \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u044f \u043d\u0430 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u043c Java-\u043a\u043e\u0434\u0435!<\/p>\n<p>\u0418\u0441\u0447\u0435\u0440\u043f\u044b\u0432\u0430\u044e\u0449\u0435\u0433\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0435\u0433\u043e \u0443 \u043c\u0435\u043d\u044f \u043d\u0435 \u0431\u044b\u043b\u043e, \u0442\u0430\u043a \u0447\u0442\u043e \u044f \u0437\u0430\u0434\u0430\u043b <a href=\"https:\/\/stackoverflow.com\/questions\/63397711\/linuxperfasmprofiler-shows-java-code-corresponding-assembly-hot-spot-for-java-8\" rel=\"noopener noreferrer nofollow\">\u0432\u043e\u043f\u0440\u043e\u0441<\/a>.<\/p>\n<p>\u0412\u044b\u044f\u0441\u043d\u0438\u043b\u043e\u0441\u044c, \u0447\u0442\u043e \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0438 \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0432 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 JIT-\u0430 \u0441\u043b\u043e\u043c\u0430\u043b\u0438 \u0441\u043e\u043e\u0442\u043d\u0435\u0441\u0435\u043d\u0438\u0435 \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u0438 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u043e\u0432, \u0432\u043f\u0440\u043e\u0447\u0435\u043c, \u0432\u044b\u0445\u043e\u0434 \u0435\u0441\u0442\u044c: \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0432 \u043f\u0440\u043e\u0433\u043e\u043d \u0441 \u0444\u043b\u0430\u0433\u043e\u043c <code>-XX:MaxInlineLevel=0<\/code> (\u043e\u0442\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0432\u043a\u043b\u0435\u0438\u0432\u0430\u043d\u0438\u0435) \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043d\u0443\u0436\u043d\u043e\u0435:<\/p>\n<pre><code> 0.99%  0x00007fc53836b418: movl      $0x0,0x14(%rbp)         0x00007fc53836b41f: lock addl $0x0,0xffffffffffffffc0(%rsp)                                         ;*putfield count {reexecute=0 rethrow=0 return_oop=0}                                         ; - o.s.u.CRHM$Segment::&lt;init&gt;@11 (line 476)                                         ; - o.s.u.CRHM::&lt;init&gt;@141 (line 184) 18.78%  0x00007fc53836b425: mov       (%rsp),%rsi  0.10%  0x00007fc53836b429: nop<\/code><\/pre>\n<p>\u041e\u0447\u0435\u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u044d\u0442\u043e \u0442\u0430\u043a \u0441\u0435\u0431\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435, \u0432\u0435\u0434\u044c \u0432 \u0431\u043e\u0435\u0432\u043e\u043c \u043a\u043e\u0434\u0435 \u0433\u043b\u0443\u0431\u0438\u043d\u0430 \u0432\u043a\u043b\u0435\u0438\u0432\u0430\u043d\u0438\u044f \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043b\u0438\u0447\u0430\u0442\u044c\u0441\u044f \u043e\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u043e\u0439 \u0432 \u043e\u043f\u044b\u0442\u0430\u0445. \u041a\u0430\u0436\u0435\u0442\u0441\u044f, \u043d\u0443\u0436\u043d\u043e \u043f\u0438\u0441\u0430\u0442\u044c \u0432 \u0440\u0430\u0441\u0441\u044b\u043b\u043a\u0443 <a href=\"https:\/\/mail.openjdk.java.net\/pipermail\/hotspot-compiler-dev\/2020-August\/039512.html\" rel=\"noopener noreferrer nofollow\">hotspot-compiler-dev<\/a>. <a href=\"https:\/\/mail.openjdk.java.net\/pipermail\/hotspot-compiler-dev\/2020-August\/039513.html\" rel=\"noopener noreferrer nofollow\">\u041e\u0442\u0432\u0435\u0442<\/a> \u043d\u0435 \u0437\u0430\u0441\u0442\u0430\u0432\u0438\u043b \u0441\u0435\u0431\u044f \u0434\u043e\u043b\u0433\u043e \u0436\u0434\u0430\u0442\u044c:<\/p>\n<blockquote>\n<p>There&#8217;s never been any guarantee that debuginfo will be complete after transformations. Optimization rewrites things to such an extent that it&#8217;s not really possible anyway: operations are reorganized and combined in such a way that the relationship between incoming bytecode and generated code is not 1:1.<\/p>\n<\/blockquote>\n<p>\u041a\u0440\u0430\u0442\u043a\u0438\u0439 \u043f\u0435\u0440\u0435\u0432\u043e\u0434: \u0432\u0430\u043c \u043d\u0438\u043a\u0442\u043e \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u043e\u0431\u0435\u0449\u0430\u043b, \u043d\u043e \u0432\u044b \u0434\u0435\u0440\u0436\u0438\u0442\u0435\u0441\u044c \u0442\u0430\u043c! \u0412\u0441\u0435\u0433\u043e \u0434\u043e\u0431\u0440\u043e\u0433\u043e \u0438 \u043e\u0442\u043b\u0438\u0447\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0444\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f :).<\/p>\n<details class=\"spoiler\">\n<summary>\u0417\u0430\u043c\u0435\u0447\u0430\u043d\u0438\u0435<\/summary>\n<div class=\"spoiler__content\">\n<p>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0433\u0434\u0435-\u0442\u043e \u0432 \u043c\u0435\u0442\u043e\u0434\u043e\u043b\u043e\u0433\u0438\u0438 \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f \u0431\u044b\u043b\u0430 \u0434\u043e\u043f\u0443\u0449\u0435\u043d\u0430 \u043e\u0448\u0438\u0431\u043a\u0430, \u0438 \u044f \u043f\u043e\u0434\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u043b \u0441\u043e\u0431\u0440\u0430\u043d\u043d\u044b\u0439 \u0438\u0437 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u043e\u0432 Java 8 hsdis \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441, \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u043d\u044b\u0439 \u043d\u0430 Java 11. \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u044d\u0442\u043e \u043a\u0430\u0436\u0435\u0442\u0441\u044f \u043c\u043d\u0435 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u044b\u043c, \u0438\u0431\u043e <a href=\"https:\/\/habr.com\/ru\/post\/598433\/\" rel=\"noopener noreferrer nofollow\">\u043a\u043e\u0433\u0434\u0430<\/a> \u044f \u0441\u043e\u0431\u0438\u0440\u0430\u043b hsdis \u0438\u0437 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u043e\u0432 JDK 17 \u0441 \u0441\u0430\u043c\u044b\u043c \u0441\u0432\u0435\u0436\u0438\u043c binutils \u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f <u>\u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439<\/u> \u0441\u0431\u043e\u0440\u043a\u043e\u0439 \u0434\u043b\u044f \u043f\u0440\u043e\u0444\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043c\u0430\u043f\u043f\u0438\u043d\u0433 \u0440\u0430\u0431\u043e\u0442\u0430\u043b \u0438\u0434\u0435\u0430\u043b\u044c\u043d\u043e. \u0415\u0441\u043b\u0438 \u0432\u044b \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0438\u0441\u044c \u0441 \u043f\u043e\u0445\u043e\u0436\u0435\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439 \u2014 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u0432\u0437\u044f\u0442\u044c <a href=\"https:\/\/github.com\/orgs\/openjdk\/repositories\" rel=\"noopener noreferrer nofollow\">\u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438<\/a> \u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u0432\u0430\u0448\u0435\u0433\u043e JDK (\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0430 \u043d\u0451\u043c), \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u043d\u0430 \u043d\u0451\u043c hsdis \u0434\u043b\u044f \u0432\u0430\u0448\u0435\u0439 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c.<\/p>\n<\/div>\n<\/details>\n<p>\u0423\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043e\u0431\u0445\u043e\u0434\u0430 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f (<code>-XX:MaxInlineLevel=0<\/code>) \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0435 \u0441\u043e\u0432\u0435\u0442\u0443\u044e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430 \u0434\u0438\u0430\u0433\u043d\u043e\u0441\u0442\u0438\u043a\u0438, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0432\u043a\u043b\u0435\u0438\u0432\u0430\u043d\u0438\u044f \u043c\u043e\u0436\u0435\u0442 \u0441\u0438\u043b\u044c\u043d\u043e \u0438\u0441\u043a\u0430\u0437\u0438\u0442\u044c \u043f\u0440\u043e\u0444\u0438\u043b\u044c. \u0414\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043d\u0430 \u043f\u0440\u043e\u0441\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435:<\/p>\n<pre><code class=\"java\">@BenchmarkMode(Mode.AverageTime) @OutputTimeUnit(TimeUnit.NANOSECONDS) public class TurnOffInliningBenchmark {    @Benchmark   public int calculate() {     return calculate(200);   }    @Benchmark   @Fork(jvmArgsAppend = {\"-XX:MaxInlineLevel=0\"})   public int calculateNoInlining() {     return calculate(200);   }    private Integer calculate(int length) {     Integer sum = 0;     for (int i = 0; i &lt; length; i++) {       sum += i;     }     return sum;   } }<\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u0431\u0435\u043d\u0447\u043c\u0430\u0440\u043a \u043d\u0430 \u0441\u0442\u0430\u0440\u0448\u0438\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, 17), \u0442\u043e \u043c\u0435\u0442\u043e\u0434 <code>calculateNoInlining()<\/code> \u043f\u0440\u043e\u0438\u0433\u0440\u0430\u0435\u0442 \u0441 \u0447\u0443\u0434\u043e\u0432\u0438\u0449\u043d\u044b\u043c \u043e\u0442\u0440\u044b\u0432\u043e\u043c \u043a\u0430\u043a \u043f\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u0442\u0430\u043a \u0438 \u043f\u043e \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u0435\u043d\u0438\u044e \u043f\u0430\u043c\u044f\u0442\u0438:<\/p>\n<pre><code>Benchmark                                                                          Score    Error   Units  TurnOffInliningBenchmark.calculate                                                51,099 \u00b1  0,842   ns\/op TurnOffInliningBenchmark.calculate:\u00b7gc.alloc.rate                                  0,001 \u00b1  0,001  MB\/sec TurnOffInliningBenchmark.calculate:\u00b7gc.alloc.rate.norm                            \u2248 10\u207b\u2074             B\/op TurnOffInliningBenchmark.calculate:\u00b7gc.count                                         \u2248 0           counts  TurnOffInliningBenchmark.calculateNoInlining                                     766,289 \u00b1 17,697   ns\/op TurnOffInliningBenchmark.calculateNoInlining:\u00b7gc.alloc.rate                     2443,419 \u00b1 54,399  MB\/sec TurnOffInliningBenchmark.calculateNoInlining:\u00b7gc.alloc.rate.norm                2944,301 \u00b1  0,014    B\/op TurnOffInliningBenchmark.calculateNoInlining:\u00b7gc.churn.G1_Eden_Space            2437,723 \u00b1 70,539  MB\/sec TurnOffInliningBenchmark.calculateNoInlining:\u00b7gc.churn.G1_Eden_Space.norm       2937,362 \u00b1 52,498    B\/op TurnOffInliningBenchmark.calculateNoInlining:\u00b7gc.churn.G1_Survivor_Space           0,015 \u00b1  0,002  MB\/sec TurnOffInliningBenchmark.calculateNoInlining:\u00b7gc.churn.G1_Survivor_Space.norm      0,018 \u00b1  0,003    B\/op TurnOffInliningBenchmark.calculateNoInlining:\u00b7gc.count                           596,000           counts TurnOffInliningBenchmark.calculateNoInlining:\u00b7gc.time                            469,000               ms<\/code><\/pre>\n<p>\u041f\u0440\u043e\u0444\u0438\u043b\u044c, \u0440\u0430\u0437\u0443\u043c\u0435\u0435\u0442\u0441\u044f, \u0431\u0443\u0434\u0435\u0442 \u0441\u0438\u043b\u044c\u043d\u043e \u0438\u0441\u043a\u0430\u0436\u0451\u043d.<\/p>\n<h3>\u041d\u043e \u0438 \u044d\u0442\u043e \u0435\u0449\u0451 \u043d\u0435 \u0432\u0441\u0451!<\/h3>\n<p>\u041a \u0441\u0447\u0430\u0441\u0442\u044c\u044e \u0434\u043b\u044f \u043c\u0435\u043d\u044f, \u044f \u043d\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u043b\u0441\u044f \u043e\u0434\u043d\u0438\u043c-\u0434\u0432\u0443\u043c\u044f \u043f\u0440\u043e\u0433\u043e\u043d\u0430\u043c\u0438, \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0432 \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u043d\u043e\u0439 \u0440\u0430\u0437 \u0431\u0435\u043d\u0447\u043c\u0430\u0440\u043a c Java 11 \u0432\u043d\u0435\u0437\u0430\u043f\u043d\u043e \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b \u0432 \u0432\u044b\u0432\u043e\u0434\u0435 \u0438\u0441\u043a\u043e\u043c\u044b\u0439 <code>putfield count<\/code>!<\/p>\n<pre><code> 0.97% \u2198 0x00007f6ff436a099: mov     0x10(%rsp),%r10  0.05%   0x00007f6ff436a09e: movl    $0x0,0x14(%r10)          0x00007f6ff436a0a6: lock addl $0x0,0xffffffffffffffc0(%rsp)                                                        ;*putfield count {reexecute=0 rethrow=0 return_oop=0}                                                        ; - o.s.u.CRHM$Segment::&lt;init&gt;@11 (line 476) 25.36%   0x00007f6ff436a0ac: mov     0x8(%rsp),%r10<\/code><\/pre>\n<p>\u0422\u0443\u0442 \u044f \u043e\u043a\u043e\u043d\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0440\u0430\u0441\u0442\u0435\u0440\u044f\u043b\u0441\u044f. \u041f\u043e\u0441\u043b\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u043e\u0433\u043e\u043d\u043e\u0432 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0430 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u044f\u0441\u043d\u0438\u043b\u0430\u0441\u044c: \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u0435 \u043d\u0430 <code>putfield count<\/code> \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u0432 \u043e\u0431\u044b\u0447\u043d\u043e\u043c \u0440\u0435\u0436\u0438\u043c\u0435 (\u0438\u043d\u044b\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438 \u0431\u0435\u0437 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a \u0412\u041c) \u043f\u043e\u044f\u0432\u043b\u044f\u043b\u043e\u0441\u044c \u0432 \u0432\u044b\u0432\u043e\u0434\u0435 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c. \u0422\u043e\u0433\u0434\u0430 \u0431\u044b\u043b\u043e \u043f\u0440\u0438\u043d\u044f\u0442\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0443:<\/p>\n<pre><code class=\"bash\">#!\/bin\/bash for i in {1..100} do   touch \"$i\".txt   \/usr\/lib\/jvm\/java-11-openjdk-amd64\/bin\/java \\   -jar ..\/target\/benchmarks.jar CRHMBenchmark \\   -f 1 -wi 5 -i 1 -w 1s -r 1s -prof perfasm \\   -jvmArgsAppend \"-XX:+UnlockDiagnosticVMOptions -XX:+PrintAssembly\" &gt; \"$i\".txt done<\/code><\/pre>\n<p>\u0412 \u044d\u0442\u043e\u043c \u0441\u043a\u0440\u0438\u043f\u0442\u0435 \u043c\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c 100 \u043f\u0440\u043e\u0433\u043e\u043d\u043e\u0432 \u0438 \u0432\u044b\u0432\u043e\u0434 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043f\u0438\u0448\u0435\u043c \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u0444\u0430\u0439\u043b. \u041f\u043e\u0441\u043b\u0435 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u0432 \u043f\u0430\u043f\u043a\u0443 \u0441 \u0444\u0430\u0439\u043b\u0430\u043c\u0438 \u0438 \u0441\u0447\u0438\u0442\u0430\u0435\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0432\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u0439 \u0438\u0441\u043a\u043e\u043c\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438:<\/p>\n<pre><code class=\"bash\">#!\/bin\/bash declare -i count=0; declare -i count_in_file=0; for i in *.txt; do   count_in_file=$((`grep -o -i 'putfield count' $i | wc -l`));   count=$((count + count_in_file)); done echo $count<\/code><\/pre>\n<p>\u0423 \u043c\u0435\u043d\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u0442\u0430\u043a:<\/p>\n<pre><code>  0.90%     0x00007f2513331eae: lock addl $0x0,-0x40(%rsp)  ;*putfield count {reexecute=0 rethrow=0 return_oop=0}   0.03%     0x00007fc1bbb924ab: lock addl $0x0,-0x40(%rsp)  ;*putfield count {reexecute=0 rethrow=0 return_oop=0}   0.07%     0x00007f9972d021ae: lock addl $0x0,-0x40(%rsp)  ;*putfield count {reexecute=0 rethrow=0 ...   0.42%     0x00007f99b03999ae: lock addl $0x0,-0x40(%rsp)  ;*putfield count {reexecute=0 rethrow=0 return_oop=0} 24<\/code><\/pre>\n<p>\u041f\u0440\u043e\u0449\u0435 \u0433\u043e\u0432\u043e\u0440\u044f \u0432 24 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u0438\u0437 100 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u043b \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u0435 \u043d\u0430 <code>putfield count<\/code>. \u041d\u0435 \u043e\u0447\u0435\u043d\u044c-\u0442\u043e \u043e\u0431\u043d\u0430\u0434\u0451\u0436\u0438\u0432\u0430\u0435\u0442, \u043f\u0440\u0430\u0432\u0434\u0430? \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f, \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435\u043b\u044c\u0437\u044f \u043f\u043e\u043b\u0430\u0433\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u043e\u0434\u0438\u043d \u043f\u0440\u043e\u0433\u043e\u043d! \u0412\u0435\u0434\u044c \u0442\u0430\u043c \u0447\u0430\u0441\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0442\u0435\u0440\u044f\u0442\u044c\u0441\u044f \u0438 \u0432\u044b \u0442\u0443\u043f\u043e \u043d\u0435 \u0443\u0432\u0438\u0434\u0438\u0442\u0435 \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u0433\u043e\u0440\u044f\u0447\u0435\u0435 \u043c\u0435\u0441\u0442\u043e \u0432 <em>\u0438\u0441\u0445\u043e\u0434\u043d\u043e\u043c<\/em> Java-\u043a\u043e\u0434\u0435. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u043e\u0432\u0435\u0442\u0443\u044e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c 10-20 \u043f\u0440\u043e\u0433\u043e\u043d\u043e\u0432 \u0441 \u0432\u044b\u0432\u043e\u0434\u043e\u043c \u0432 \u0444\u0430\u0439\u043b \u0438 \u043f\u0440\u043e\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u043a\u0430\u0436\u0434\u044b\u0439 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e.<\/p>\n<h3>\u0412 \u0441\u0443\u0445\u043e\u043c \u043e\u0441\u0442\u0430\u0442\u043a\u0435<\/h3>\n<p>\u0418\u0442\u0430\u043a, \u0447\u0435\u0433\u043e \u0436\u0435 \u043c\u044b \u0434\u043e\u0431\u0438\u043b\u0438\u0441\u044c \u043d\u0430\u0448\u0438\u043c\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u043d\u0438\u044f\u043c (<a href=\"https:\/\/github.com\/spring-projects\/spring-framework\/commit\/112cc70231172176aef70d855890aeee3762563e#diff-940855529e1b2ed1123dbbab9d311a4cca5e923c0c4d494b733589efaae7e06f\" rel=\"noopener noreferrer nofollow\">\u0440\u0430\u0437<\/a>, <a href=\"https:\/\/github.com\/spring-projects\/spring-framework\/pull\/25846\/files#diff-940855529e1b2ed1123dbbab9d311a4cca5e923c0c4d494b733589efaae7e06f\" rel=\"noopener noreferrer nofollow\">\u0434\u0432\u0430<\/a>):<\/p>\n<pre><code>                 J8 SB 2.1.1     J8 SB 2.3.11   J11 SB 2.3.11        count                                                    Units dto       1     14.0 \u00b1   0.1      5.8 \u00b1   0.3      6.2 \u00b1  0.1  us\/op proj      1     17.2 \u00b1   0.2     10.3 \u00b1   0.2     10.1 \u00b1  0.0  us\/op  dto     100     45.6 \u00b1   0.7     35.0 \u00b1   0.2     31.0 \u00b1  0.5  us\/op proj    100    216.9 \u00b1   0.4    199.6 \u00b1   0.5    180.8 \u00b1  0.8  us\/op<\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c J8 \u0438 J11 \u2014 \u044d\u0442\u043e Java 8\/11, \u0430 SB \u2014 Spring Boot \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0439 \u0432\u0435\u0440\u0441\u0438\u0438.<\/p>\n<h3>\u041e\u0431\u0449\u0438\u0435 \u0432\u044b\u0432\u043e\u0434\u044b \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430<\/h3>\n<ul>\n<li>\n<p>\u0432 \u0441\u043b\u043e\u0436\u043d\u044b\u0439 \u0441\u043b\u0443\u0447\u0430\u044f\u0445, \u043a\u043e\u0433\u0434\u0430 \u043d\u0435\u044f\u0441\u043d\u043e, \u043a\u0443\u0434\u0430 \u0438\u043c\u0435\u043d\u043d\u043e \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u043d\u0435 \u0431\u043e\u0439\u0442\u0435\u0441\u044c \u043d\u044b\u0440\u043d\u0443\u0442\u044c \u0433\u043b\u0443\u0431\u0436\u0435 \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0430\u0441\u0441\u0435\u043c\u0431\u043b\u0435\u0440<\/p>\n<\/li>\n<li>\n<p>\u043f\u043e\u043c\u043d\u0438\u0442\u0435, \u0447\u0442\u043e \u0432\u0441\u0435 \u043f\u0440\u043e\u0444\u0438\u043b\u0438\u0440\u043e\u0432\u0449\u0438\u043a\u0438 \u0434\u043e\u043f\u0443\u0441\u043a\u0430\u044e\u0442 \u043f\u043e\u0433\u0440\u0435\u0448\u043d\u043e\u0441\u0442\u044c, \u0441\u043c. \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u044b\u0435 \u0434\u043e\u043a\u043b\u0430\u0434\u044b <a href=\"https:\/\/www.youtube.com\/watch?v=7IkHIqPeFjY\" rel=\"noopener noreferrer nofollow\">Nitsan Wakart &#8212; Profilers are lying hobbitses<\/a> \u0438 <a href=\"https:\/\/www.youtube.com\/watch?v=QiGrTvsCZmA\" rel=\"noopener noreferrer nofollow\">\u0410\u043d\u0434\u0440\u0435\u0439 \u041f\u0430\u043d\u044c\u0433\u0438\u043d &#8212; \u0418\u0441\u043a\u0443\u0441\u0441\u0442\u0432\u043e Java \u043f\u0440\u043e\u0444\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f<\/a><\/p>\n<\/li>\n<li>\n<p>\u043d\u0435 \u0441\u0442\u0435\u0441\u043d\u044f\u0439\u0442\u0435\u0441\u044c \u0437\u0430\u0434\u0430\u0432\u0430\u0442\u044c \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u2014 \u043e\u0431\u044a\u044f\u0441\u043d\u044f\u044f \u0435\u0433\u043e \u0434\u0440\u0443\u0433\u0438\u043c \u0432\u044b \u0441\u0430\u043c\u0438 \u043b\u0443\u0447\u0448\u0435 \u043f\u043e\u043d\u0438\u043c\u0430\u0435\u0442\u0435 \u0441\u0442\u043e\u044f\u0449\u0443\u044e \u043f\u0435\u0440\u0435\u0434 \u0432\u0430\u043c\u0438 \u0437\u0430\u0434\u0430\u0447\u0443<\/p>\n<\/li>\n<\/ul>\n<h3>\u041f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0432\u044b\u0432\u043e\u0434\u044b \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430<\/h3>\n<ul>\n<li>\n<p><a href=\"https:\/\/github.com\/spring-projects\/spring-framework\/pull\/25261\/files\" rel=\"noopener noreferrer nofollow\">\u0432\u044b\u043f\u0438\u043b\u0438\u0432\u0430\u0439\u0442\u0435<\/a> \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u043d\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u043f\u043e-\u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0432\u043e\u043b\u0430\u0442\u0438\u043b\u044c\u043d\u044b\u043c \u043f\u043e\u043b\u044f\u043c \u0432 \u0432\u0430\u0448\u0438\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u0445, \u044d\u0442\u043e \u0434\u0430\u0441\u0442 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0438\u0440\u043e\u0441\u0442 \u0438 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0441\u043b\u043e\u043c\u0430\u0435\u0442 (\u0430 \u0435\u0441\u043b\u0438 \u0432\u0441\u0451 \u0436\u0435 \u0441\u043b\u043e\u043c\u0430\u0435\u0442, \u0442\u043e \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0430\u043f\u0438\u0448\u0438\u0442\u0435 \u043e\u0431 \u044d\u0442\u043e\u043c \u0432 <a href=\"http:\/\/cs.oswego.edu\/pipermail\/concurrency-interest\" rel=\"noopener noreferrer nofollow\">http:\/\/cs.oswego.edu\/pipermail\/concurrency-interest<\/a>, \u044d\u0442\u043e \u0441\u0442\u0430\u043d\u0435\u0442 \u0441\u0435\u043d\u0441\u0430\u0446\u0438\u0435\u0439). \u0422\u0430\u043a\u0436\u0435 \u0441\u0442\u0430\u0432\u044c\u0442\u0435 \u043f\u0430\u043b\u0435\u0446 \u0432\u0432\u0435\u0440\u0445 \u044d\u0442\u0438\u043c \u0437\u0430\u0434\u0430\u0447\u0430\u043c:<br \/><a href=\"https:\/\/youtrack.jetbrains.com\/issue\/IDEA-243752\" rel=\"noopener noreferrer nofollow\">https:\/\/youtrack.jetbrains.com\/issue\/IDEA-243752<\/a><br \/><a href=\"https:\/\/youtrack.jetbrains.com\/issue\/IDEA-251885\" rel=\"noopener noreferrer nofollow\">https:\/\/youtrack.jetbrains.com\/issue\/IDEA-251885<\/a><br \/>\u0422\u0430\u043a \u043d\u0430 \u043d\u0438\u0445 \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u043e\u0431\u0440\u0430\u0442\u044f\u0442 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \ud83d\ude09<\/p>\n<\/li>\n<li>\n<p>\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435\u0441\u044c \u0444\u043b\u0430\u0433\u0430\u043c\u0438 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u044b \u043f\u0440\u0438 \u043f\u0440\u043e\u0433\u043e\u043d\u0430\u0445, \u043e\u043d\u0438 \u043f\u043e\u043c\u043e\u0433\u0443\u0442 \u0432\u0430\u043c \u0441\u0443\u0437\u0438\u0442\u044c \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u043f\u043e\u0438\u0441\u043a\u0430. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u043b\u0438 \u0432\u044b \u0433\u0440\u0435\u0448\u0438\u0442\u0435 \u043d\u0430 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u2014 \u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u0437\u0430\u043f\u0443\u0441\u043a \u0441 <code>-Xint<\/code> \/ <code>-XX:TieredStopAtLevel=1<\/code> \u0438\u043b\u0438 \u0443\u0436\u0435 \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u044b\u0439 <code>-XX:MaxInlineLevel=0<\/code>, \u043e\u0434\u043d\u0430\u043a\u043e \u043f\u043e\u043c\u043d\u0438\u0442\u0435, \u0447\u0442\u043e \u043e\u043d\u0438 \u043c\u043e\u0433\u0443\u0442 \u043a\u0430\u043a \u043f\u043e\u043c\u043e\u0447\u044c, \u0442\u0430\u043a \u0438 \u0437\u0430\u043f\u0443\u0442\u0430\u0442\u044c. \u041f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u0440\u0430\u0437\u043d\u044b\u0435 \u0441\u043e\u0447\u0435\u0442\u0430\u043d\u0438\u044f \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u043e\u0441\u0442\u043e\u0432\u0435\u0440\u043d\u044b\u0445 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432.<\/p>\n<\/li>\n<li>\n<p>\u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0439\u0442\u0435 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043f\u0440\u043e\u0433\u043e\u043d\u043e\u0432 \u0438 \u0441\u043e\u0431\u0438\u0440\u0430\u0439\u0442\u0435 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0443<\/p>\n<\/li>\n<\/ul>\n<h3>\u0413\u043b\u0430\u0432\u043d\u044b\u0439 \u0432\u044b\u0432\u043e\u0434 \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 (\u043f\u0440\u044f\u043c\u0438\u043a\u043e\u043c \u0438\u0437 JMH)<\/h3>\n<blockquote>\n<p>REMEMBER: <strong>The numbers below are just data.<\/strong> To gain reusable insights, you need to follow up on why the numbers are the way they are. Use profilers (see -prof, -lprof), design factorial experiments, perform baseline and negative tests that provide experimental control, make sure the benchmarking environment is safe on JVM\/OS\/HW level, ask for reviews from the domain experts. <strong>Do not assume the numbers tell you what you want them to tell.<\/strong><\/p>\n<\/blockquote>\n<p>\u041d\u0430 \u044d\u0442\u043e\u043c \u0432\u0441\u0451, \u043d\u0430\u0434\u0435\u044e\u0441\u044c, \u0437\u0430\u043c\u0435\u0442\u043a\u0430 \u0431\u044b\u043b\u0430 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0439 \u0438 \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0439 \u0432\u0430\u043c. \u0414\u043e \u043d\u043e\u0432\u044b\u0445 \u0432\u0441\u0442\u0440\u0435\u0447 \ud83d\ude42<\/p>\n<\/p>\n<\/div>\n<\/div>\n<p> <!----> <!----><\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/542156\/\"> https:\/\/habr.com\/ru\/articles\/542156\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<p>\u041f\u0440\u0438\u0432\u0435\u0442, \u0441\u0435\u0433\u043e\u0434\u043d\u044f \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u044a\u0451\u043c\u043d\u0430\u044f \u0438 \u043e\u0431\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f \u043e \u043d\u0438\u0437\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u043e\u043c \u043f\u0440\u043e\u0444\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0438 \u0434\u0438\u0430\u0433\u043d\u043e\u0441\u0442\u0438\u043a\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438. \u041c\u043d\u043e\u0433\u043e\u043a\u0440\u0430\u0442\u043d\u043e \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445 \u043a \u0434\u043e\u043a\u043b\u0430\u0434\u0430\u043c \u0438 \u0441\u0442\u0430\u0442\u044c\u044f\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u0432\u044b\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u043b\u0438 \u043f\u043e\u0436\u0435\u043b\u0430\u043d\u0438\u0435 \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432 &#171;\u043a\u0430\u043a \u043d\u0443\u0436\u043d\u043e&#187; \u0438 &#171;\u043a\u0430\u043a \u043d\u0435 \u043d\u0443\u0436\u043d\u043e&#187;, \u0430 \u0446\u0435\u043b\u043e\u0441\u0442\u043d\u0443\u044e \u0438\u0441\u0442\u043e\u0440\u0438\u044e. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u043e\u0442 \u0432\u0430\u043c \u0441\u0442\u0430\u0442\u044c\u044f \u043f\u0440\u043e \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0439 \u043a\u0435\u0439\u0441 \u0438 \u0435\u0433\u043e \u0438\u0441\u0442\u043e\u0440\u0438\u044e :). \u041d\u0435 \u0443\u0434\u0438\u0432\u043b\u044f\u0439\u0442\u0435\u0441\u044c, \u0447\u0442\u043e \u043d\u0430\u0447\u043d\u0451\u043c \u043c\u044b \u0441 JPA, \u0445\u043e\u0442\u044f \u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0431\u044b \u0433\u0434\u0435 \u043e\u043d\u043e \u0438 \u0433\u0434\u0435 \u0430\u0441\u0441\u0435\u043c\u0431\u043b\u0435\u0440. \u041f\u043e \u0445\u043e\u0434\u0443 \u0434\u0435\u043b\u0430 \u0432\u044b \u0432\u0441\u0451 \u043f\u043e\u0439\u043c\u0451\u0442\u0435.<\/p>\n<p>\u0427\u0430\u0441\u0442\u044c \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0430, \u043b\u0451\u0433\u0448\u0435\u0433\u043e \u0432 \u043e\u0441\u043d\u043e\u0432\u0443 \u044d\u0442\u043e\u0433\u043e \u0434\u043e\u043a\u043b\u0430\u0434\u0430 \u0440\u0430\u043d\u0435\u0435 \u0440\u0430\u0437\u043c\u0435\u0449\u0430\u043b\u0430\u0441\u044c \u043c\u043d\u043e\u0439 <a href=\"https:\/\/habr.com\/ru\/post\/432824\/\" rel=\"noopener noreferrer nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a>, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0435\u0441\u043b\u0438 \u0432\u0434\u0440\u0443\u0433 \u0432\u0430\u043c \u043f\u043e\u043a\u0430\u0436\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0433\u0434\u0435-\u0442\u043e \u0432\u044b \u0443\u0436\u0435 \u0447\u0438\u0442\u0430\u043b\u0438 \u044d\u0442\u043e, \u0442\u043e \u0447\u0443\u0442\u044c\u0451 \u0432\u0430\u0441 \u043d\u0435 \u043f\u043e\u0434\u0432\u0435\u043b\u043e :). \u0418 \u0432\u0441\u0451 \u0436\u0435 \u044d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043b\u0430\u0433\u0438\u0430\u0442\u043e\u043c, \u0430 \u0441\u043a\u043e\u0440\u0435\u0435 \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u043b\u043d\u043e\u0439 \u0438 \u0440\u0430\u0437\u0432\u0451\u0440\u043d\u0443\u0442\u043e\u0439 \u0438\u0441\u0442\u043e\u0440\u0438\u0435\u0439, \u043e\u0431\u044a\u044f\u0441\u043d\u044f\u044e\u0449\u0435\u0439 \u0447\u0442\u043e, \u043a\u0430\u043a, \u043f\u043e\u0447\u0435\u043c\u0443 \u0438 \u0437\u0430\u0447\u0435\u043c. \u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d <a href=\"https:\/\/github.com\/stsypanov\/assembly-profiling-and-all-all-all\" rel=\"noopener noreferrer nofollow\">\u0442\u0443\u0442<\/a>.<\/p>\n<h3>\u0418\u0441\u0442\u043e\u0440\u0438\u044f<\/h3>\n<p>\u041e\u0434\u043d\u0430\u0436\u0434\u044b \u043d\u0430\u043c \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u043b\u0438 \u0437\u0430\u0434\u0430\u0447\u0443 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u0438 <s>\u0434\u0440\u0435\u0432\u043d\u0435\u0433\u043e \u043a\u0430\u043a \u043f\u043e\u043c\u0451\u0442 \u043c\u0430\u043c\u043e\u043d\u0442\u0430<\/s> \u0434\u043e\u043b\u0433\u043e\u0436\u0438\u0432\u0443\u0449\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0432\u0448\u0435\u0433\u043e \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u043e\u0431\u044b\u0447\u043d\u044b\u0439 \u044d\u043d\u0442\u0435\u0440\u043f\u0440\u0430\u0439\u0437-\u043d\u0430\u0431\u043e\u0440: \u0421\u0423\u0411\u0414 Oracle, Hibernate, Spring Data JPA. \u041e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044c\u044e \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0431\u044b\u043b\u043e \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0436\u0438\u0440\u043d\u0435\u043d\u044c\u043a\u0438\u0445 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439 (\u0441 \u0434\u0435\u0441\u044f\u0442\u043a\u0430\u043c\u0438 \u043f\u043e\u043b\u0435\u0439), \u043f\u0440\u0438 \u0447\u0451\u043c \u0447\u0430\u0441\u0442\u043e \u043d\u0430\u043c \u0431\u044b\u043b\u0438 \u043d\u0443\u0436\u043d\u044b \u0431\u0443\u043a\u0432\u0430\u043b\u044c\u043d\u043e \u0441\u0447\u0438\u0442\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u043d\u0438\u0445. \u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u0438\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043f\u043e\u043b\u0435\u0439 \u0438\u0437 \u043c\u043d\u043e\u0433\u0438\u0445 (\u043c\u0438\u043d\u0443\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u0432\u0441\u0435\u0439 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438 \u0438 \u0443\u043c\u0435\u043d\u044c\u0448\u0430\u044f \u0442\u0440\u0430\u0444\u0438\u043a) \u043c\u044b \u0440\u0435\u0448\u0430\u043b\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e DTO:<\/p>\n<pre><code class=\"java\">\/\/ \u0436\u0438\u0440\u043d\u0430\u044f \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044c @Entity public class ManyFieldsEntity {    @Id   private Long id;    @Column   private String extId;    @Column   private String name;    @Column   private BigDecimal amount1;    @Column   private BigDecimal amount2;    @Column   private BigDecimal amount3;    @Column   private BigDecimal amount4;    @Column   private BigDecimal amount5;    @Column   private BigDecimal amount6;    @Column   private BigDecimal amount7;    @Column   private BigDecimal amount8; }  \/\/ DTO @Getter @RequiredArgsConstructor public class HasIdAndNameDto {   private final Long id;   private final String name; }  \/\/ \u043c\u0435\u0442\u043e\u0434 \u0434\u043b\u044f \u0438\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 public interface ManyFieldsRepository extends JpaRepository&lt;ManyFieldsEntity, Long&gt; {    @Query(\"select new com.tsypanov.domain.HasIdAndNameDto(e.id, e.name)\" +          \"  from ManyFieldsEntity e \" +          \" where e.name = :name\")   Collection&lt;HasIdAndNameDto&gt; findAllByNameUsingDto(String name); }<\/code><\/pre>\n<p>\u0423\u0432\u0435\u0440\u0435\u043d, \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u0438\u0437 \u0432\u0430\u0441 \u0445\u043e\u0442\u044c \u0440\u0430\u0437 \u043f\u0438\u0441\u0430\u043b\u043e \u0447\u0442\u043e-\u0442\u043e \u043f\u043e\u0434\u043e\u0431\u043d\u043e\u0435. \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u0434\u0438\u043d \u0438\u0437 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0438\u043b \u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u0443 \u2014 \u043f\u0440\u043e\u0435\u043a\u0446\u0438\u0438.<\/p>\n<h3>\u0427\u0442\u043e \u044d\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u0438 \u0441 \u0447\u0435\u043c \u0438\u0445 \u0435\u0434\u044f\u0442?<\/h3>\n<p>\u041f\u0440\u043e\u0435\u043a\u0446\u0438\u044f \u2014 \u044d\u0442\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0447\u0430\u0441\u0442\u0438 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u0441 \u0433\u0435\u0442\u0442\u0435\u0440\u0430\u043c\u0438, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c\u0438 \u0438\u043c\u0435\u043d\u0430\u043c \u043f\u043e\u043b\u0435\u0439:<\/p>\n<pre><code class=\"java\">public interface HasIdAndName {   Long getId();    String getName(); }<\/code><\/pre>\n<p>\u042d\u0442\u043e\u0442 \u043f\u043e\u0434\u0445\u043e\u0434 \u0438\u043c\u0435\u0435\u0442 \u0440\u044f\u0434 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432 \u043f\u0435\u0440\u0435\u0434 \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u044b\u043c\u0438 DTO:<\/p>\n<ul>\n<li>\n<p>\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u044b \u0441\u0430\u043c\u0438 \u043f\u043e \u0441\u0435\u0431\u0435 \u0431\u043e\u043b\u0435\u0435 \u0433\u0438\u0431\u043a\u0438\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442, \u0447\u0435\u043c \u043a\u043b\u0430\u0441\u0441. \u0420\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0432 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0432 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0439 \u0432\u044b\u0448\u0435 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438 \u0438 DTO \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0435\u0440\u0432\u0438\u0441\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434, \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u0439 \u0438 \u0441 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044c\u044e, \u0438 \u0441 \u043f\u0440\u043e\u0435\u043a\u0446\u0438\u0435\u0439, \u0438 \u0441 DTO<\/p>\n<\/li>\n<li>\n<p>\u0434\u043b\u044f \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u044f \u043c\u0435\u0442\u043e\u0434\u0430 \u0432\u043d\u0443\u0442\u0440\u0438 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f \u0431\u043e\u043b\u0435\u0435 \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u044f\u0432\u043d\u043e\u0435 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0430, \u0447\u0442\u043e \u0441\u0438\u043b\u044c\u043d\u043e \u0432\u0441\u0451 \u0443\u043f\u0440\u043e\u0449\u0430\u0435\u0442 (\u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u043a\u043e\u0433\u0434\u0430 \u0432 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0435 DTO \u043d\u0435 1-2 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430, \u0430 10), \u0430 \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432\u043e\u043e\u0431\u0449\u0435 \u043e\u0442\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u043e\u0442 <code>@Query<\/code> \u0432 \u043f\u043e\u043b\u044c\u0437\u0443 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430 (\u0421\u043f\u0440\u0438\u043d\u0433 \u0441\u043e\u0437\u0434\u0430\u0441\u0442 \u0437\u0430\u043f\u0440\u043e\u0441 \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e). \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043a\u043e\u0434 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043b\u0430\u043a\u043e\u043d\u0438\u0447\u043d\u0435\u0435:<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"java\">public interface ManyFieldsRepository extends JpaRepository&lt;ManyFieldsEntity, Long&gt; {   Collection&lt;HasIdAndName&gt; findAllByName(String name); }<\/code><\/pre>\n<ul>\n<li>\n<p>&#171;\u0418\u0434\u0435\u044f&#187; \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u043f\u0440\u043e\u0435\u043a\u0446\u0438\u0438 \u0438 \u0434\u0430\u0451\u0442 \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u043a\u0438 \u043f\u0440\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u043d\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u0441\u043d\u0438\u0436\u0430\u044f \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043a\u0440\u0438\u0432\u043e\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443\u043f\u0430\u0434\u0451\u0442 \u0442\u043e\u043b\u044c\u043a\u043e  \u043f\u0440\u0438 \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0438 \u043a \u043d\u0435\u043c\u0443. \u041a \u0442\u043e\u043c\u0443 \u0436\u0435 \u043f\u0440\u0438 \u0440\u0435\u0444\u0430\u043a\u0442\u043e\u0440\u0438\u043d\u0433\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u0441\u0430\u043c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u0442\u0440\u043e\u043d\u0443\u0442 (\u0432 \u0441\u0442\u0430\u0440\u044b\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445 &#171;\u0418\u0434\u0435\u0438&#187; \u043f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435\/\u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435\/\u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u0435\u0439 \u0432 DTO <a href=\"https:\/\/youtrack.jetbrains.com\/issue\/IDEA-177272\/Result-of-rename-is-ignored-in-Spring-Data-JPA-query\" rel=\"noopener noreferrer nofollow\">\u043d\u0435 \u0437\u0430\u0442\u0440\u0430\u0433\u0438\u0432\u0430\u043b\u043e \u0438\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0432 JPQL-\u0437\u0430\u043f\u0440\u043e\u0441\u0430\u0445<\/a>, \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u0430 \u043f\u043e\u0434\u0441\u0432\u0435\u0442\u043a\u0430 \u043f\u0440\u0438 \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0432 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0435 \u0438 \u0442. \u043f.)<\/p>\n<figure class=\"\"><\/figure>\n<figure class=\"\"><\/figure>\n<\/li>\n<\/ul>\n<p>\u0418 \u043c\u044b \u0440\u0435\u0448\u0438\u043b\u0438 \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u0440\u043e\u0435\u043a\u0446\u0438\u0439.<\/p>\n<h3>\u041b\u043e\u0436\u043a\u0430 \u0434\u0451\u0433\u0442\u044f<\/h3>\n<p>\u0412\u0435\u0440\u043e\u044f\u0442\u043d\u043e, \u0432\u044b \u0443\u0436\u0435 \u0434\u043e\u0433\u0430\u0434\u0430\u043b\u0438\u0441\u044c, \u0447\u0442\u043e \u0432 \u043e\u0433\u0440\u043e\u043c\u043d\u043e\u0439 \u0431\u043e\u0447\u043a\u0435 \u043c\u0451\u0434\u0430 \u043e\u043a\u0430\u0437\u0430\u043b\u0430\u0441\u044c \u043b\u043e\u0436\u043a\u0430 \u0434\u0451\u0433\u0442\u044f \u043f\u043b\u043e\u0445\u043e\u0439 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438. \u0421\u0440\u0430\u0432\u043d\u0438\u043c \u0432\u0440\u0435\u043c\u044f \u043e\u0442\u043a\u043b\u0438\u043a\u0430 \u043f\u0440\u0438 \u0432\u044b\u0433\u0440\u0443\u0437\u043a\u0435 1 \u0438 100 DTO\/\u043f\u0440\u043e\u0435\u043a\u0446\u0438\u0439 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u0431\u0435\u043d\u0447\u043c\u0430\u0440\u043a\u0430:<\/p>\n<pre><code class=\"java\">@State(Scope.Thread) @OutputTimeUnit(TimeUnit.MICROSECONDS) @BenchmarkMode(value = Mode.AverageTime) public class ProjectionVsDtoBenchmark {    private ManyFieldsRepository repository;    @Param({\"1\", \"100\"})   private int count;    @Setup   public void init() {     ConfigurableApplicationContext context = SpringApplication.run(Application.class);     context.registerShutdownHook();      repository = context.getBean(ManyFieldsRepository.class);     List&lt;ManyFieldsEntity&gt; entities = ThreadLocalRandom.current()         .longs(count)         .boxed()         .map(randomLong -&gt; new ManyFieldsEntity(randomLong, String.valueOf(randomLong), \"ivan\"))         .collect(Collectors.toList());      repository.saveAll(entities);   }    \/\/DTO \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 HasIdAndName, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u0439 \u0442\u0438\u043f \u0442\u043e\u0442 \u0436\u0435    @Benchmark   public Collection&lt;HasIdAndName&gt; dto() {     return repository.findAllByNameUsingDto(\"ivan\");   }    @Benchmark   public Collection&lt;HasIdAndName&gt; projection() {     return repository.findAllByName(\"ivan\");   } }<\/code><\/pre>\n<p>\u041c\u043e\u0436\u0435\u0442 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u0440\u0430\u0437 \u043c\u044b \u043e\u0431\u0440\u0430\u0449\u0430\u0435\u043c\u0441\u044f \u043a \u0431\u0430\u0437\u0435 (\u043f\u0443\u0441\u0442\u044c \u0434\u0430\u0436\u0435 \u044d\u0442\u043e \u0438 H2 \u043d\u0430 \u043d\u0430\u0448\u0435\u043c \u0445\u043e\u0441\u0442\u0435), \u0442\u043e \u043b\u044c\u0432\u0438\u043d\u0430\u044f \u0434\u043e\u043b\u044f \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0442\u0440\u0430\u0442\u0438\u0442\u0441\u044f \u0438\u043c\u0435\u043d\u043d\u043e \u043d\u0430 \u0437\u0430\u043f\u0440\u043e\u0441 \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0443 \u0434\u0430\u043d\u043d\u044b\u0445, \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0446\u0438\u0444\u0440\u044b \u0431\u0443\u0434\u0443\u0442 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u043c\u0438.<\/p>\n<p>\u041e\u0434\u043d\u0430\u043a\u043e:<\/p>\n<pre><code>Benchmark                        (count)       Score       Error   Units  dto                                    1      11,409 \u00b1     0,741   us\/op projection                             1      12,886 \u00b1     0,194   us\/op  dto                                  100      40,326 \u00b1     0,738   us\/op projection                           100     220,189 \u00b1     5,668   us\/op  dto:\u00b7gc.alloc.rate.norm                1   13994,528 \u00b1    22,042    B\/op projection:\u00b7gc.alloc.rate.norm         1   21224,235 \u00b1    19,369    B\/op  dto:\u00b7gc.alloc.rate.norm              100   33313,019 \u00b1    22,609    B\/op projection:\u00b7gc.alloc.rate.norm       100  517354,738 \u00b1    34,719    B\/op<\/code><\/pre>\n<p>\u0418\u0442\u043e\u0433 \u043f\u0440\u043e\u0433\u043e\u043d\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043e\u0431\u0435\u0441\u043a\u0443\u0440\u0430\u0436\u0438\u0432\u0430\u0435\u0442: \u0435\u0441\u043b\u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u043e\u0434\u043d\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0441\u0442\u043e\u0438\u0442 \u0431\u043e\u043b\u0435\u0435-\u043c\u0435\u043d\u0435\u0435 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e, \u0442\u043e \u043f\u0440\u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0438 100 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0449\u0438\u0439 \u043f\u0440\u043e\u0435\u043a\u0446\u0438\u044e \u043c\u0435\u0442\u043e\u0434 <code>ManyFieldsRepository.findAllByNameUsingDto()<\/code> \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442 \u0441\u0438\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0438\u0433\u0440\u044b\u0432\u0430\u0442\u044c. \u042d\u0442\u043e \u043a\u043e\u043d\u0442\u0440\u0438\u043d\u0442\u0443\u0438\u0442\u0438\u0432\u043d\u043e, \u0432\u0435\u0434\u044c \u0447\u0430\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u043d\u0430 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u043e\u0442\u043a\u043b\u0438\u043a\u0430 \u0432\u043b\u0438\u044f\u0435\u0442 \u0438\u043c\u0435\u043d\u043d\u043e \u0437\u0430\u043f\u0440\u043e\u0441. \u0427\u0442\u043e \u0436, \u043d\u0443\u0436\u043d\u043e \u0440\u0430\u0441\u0447\u0435\u0445\u043b\u044f\u0442\u044c \u043f\u0440\u043e\u0444\u0438\u043b\u0438\u0440\u043e\u0432\u0449\u0438\u043a \u0438 \u0438\u0441\u043a\u0430\u0442\u044c \u0443\u0437\u043a\u0438\u0435 \u043c\u0435\u0441\u0442\u0430. <\/p>\n<p><a href=\"https:\/\/visualvm.github.io\/\" rel=\"noopener noreferrer nofollow\">VisualVM<\/a> \u0432\u0432\u0438\u0434\u0443 \u0435\u0433\u043e &#171;\u043f\u043e\u043f\u0441\u043e\u0432\u043e\u0441\u0442\u0438&#187; \u0438 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 <a href=\"https:\/\/www.youtube.com\/watch?v=QiGrTvsCZmA&amp;t=595\" rel=\"noopener noreferrer nofollow\">\u0432\u0440\u043e\u0436\u0434\u0451\u043d\u043d\u044b\u0445 \u043f\u043e\u0440\u043e\u043a\u043e\u0432<\/a> \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u043d\u0435 \u0431\u0443\u0434\u0435\u043c, \u043d\u0430\u0447\u043d\u0451\u043c \u0441 JFR, \u0431\u043b\u0430\u0433\u043e \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u0438\u0437 \u0431\u0435\u043d\u0447\u043c\u0430\u0440\u043a\u0430 (\u0432\u043e\u043e\u0431\u0449\u0435 \u0437\u0430\u043f\u0443\u0441\u043a \u0438\u0437 \u0433\u043b\u0430\u0432\u043d\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430 &#8212; \u044d\u0442\u043e \u043d\u0435 \u043e\u0447\u0435\u043d\u044c &#171;\u043f\u0440\u0430\u0432\u043e\u0441\u043b\u0430\u0432\u043d\u044b\u0439&#187; \u043f\u043e\u0434\u0445\u043e\u0434, \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u0435\u0435 \u0432\u0441\u0451-\u0442\u0430\u043a\u0438 \u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0431\u0435\u043d\u0447\u043c\u0430\u0440\u043a \u0438\u0437 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438, \u043d\u043e \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e \u043d\u0435 \u0441\u0442\u043e\u043b\u044c \u0432\u0430\u0436\u043d\u043e):<\/p>\n<pre><code class=\"java\">public class BenchmarkRunner {    public static void main(String[] args) throws Exception {     Options opt = new OptionsBuilder()       .include(ProjectionProfilingBenchmark.class.getSimpleName())       .warmupIterations(10)       .warmupTime(TimeValue.seconds(1))       .measurementIterations(2) \/\/ \u0434\u0432\u0430 \u0434\u043b\u0438\u043d\u043d\u044b\u0445 \u043f\u0440\u043e\u0433\u043e\u043d\u0430       .measurementTime(TimeValue.seconds(15))       .addProfiler(JavaFlightRecorderProfiler.class)       .forks(1) \/\/ 1 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0434\u043b\u044f \u0441\u0442\u0430\u0431\u0438\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430       .shouldFailOnError(true)       .jvmArgsAppend( \/\/ \u0434\u043e\u043f\u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0434\u043b\u044f \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b         \"-XX:+UnlockDiagnosticVMOptions\",         \"-XX:+DebugNonSafepoints\"       )       .build();      new Runner(opt).run();   } }<\/code><\/pre>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u043e\u043f\u044b\u0442 \u0441\u0442\u0430\u0432\u0438\u0442\u0441\u044f \u043d\u0430 &#171;\u0432\u043e\u0441\u044c\u043c\u0451\u0440\u043a\u0435&#187; (\u044d\u0442\u043e \u0432\u0430\u0436\u043d\u043e, \u0434\u0430\u043b\u0435\u0435 \u0432\u044b \u043f\u043e\u0439\u043c\u0451\u0442\u0435 \u043f\u043e\u0447\u0435\u043c\u0443). \u041f\u0440\u043e\u0433\u043e\u043d \u0437\u0430\u0432\u0435\u0440\u0448\u0451\u043d, \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u0447\u0438\u0441\u043b\u0430 (\u043d\u0430\u0436\u043c\u0438\u0442\u0435 \u043d\u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u043f\u043e\u043b\u043d\u043e\u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0430):<\/p>\n<figure class=\"\"><\/figure>\n<p>\u0417\u0434\u0435\u0441\u044c \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u043e, \u0447\u0442\u043e \u043b\u0438\u0448\u044c \u043e\u043a\u043e\u043b\u043e 6% \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u0430, \u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 &#8212; \u0431\u0435\u0437 \u043c\u0430\u043b\u043e\u0433\u043e 80%. \u0420\u0430\u0437\u0443\u043c\u0435\u0435\u0442\u0441\u044f, \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 &#171;\u0431\u043e\u0435\u0432\u043e\u0439&#187; \u0411\u0414 \u043d\u0430 \u0443\u0434\u0430\u043b\u0451\u043d\u043d\u043e\u043c \u0445\u043e\u0441\u0442\u0435 \u0441\u043e\u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0435 \u0441\u043c\u0435\u0441\u0442\u0438\u0442\u0441\u044f \u0432 \u0441\u0442\u043e\u0440\u043e\u043d\u0443 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430.<br \/>\u0420\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0432 \u043c\u0435\u0442\u043e\u0434 <code>ResultProcessor.processResult()<\/code> \u0432\u0438\u0434\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<ul>\n<li>\n<p>77% \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0435\u043a\u0446\u0438\u0438<\/p>\n<\/li>\n<li>\n<p>35% \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 <code>ConcurrentReferenceHashMap<\/code><\/p>\n<\/li>\n<li>\n<p>25% \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 <code>ProxyFactory.getProxy()<\/code><\/p>\n<\/li>\n<\/ul>\n<figure class=\"\">\n<div><figcaption> <\/figcaption><\/div>\n<\/figure>\n<p>\u041f\u0440\u043e\u043a\u0430\u0447\u0438\u0432\u0430\u043d\u0438\u0435 <code>ProxyFactory.getProxy()<\/code> \u043e\u043f\u0438\u0441\u0430\u043d\u043e <a href=\"https:\/\/github.com\/spring-projects\/spring-framework\/pull\/25660\" rel=\"noopener noreferrer nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a>, \u0442\u0430\u043c \u0432\u0441\u0451 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043f\u0440\u043e\u0441\u0442\u043e \u0438 \u043d\u0435\u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e. \u041b\u0443\u0447\u0448\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 <code>ConcurrentReferenceHashMap<\/code>:  \u0433\u043e\u0440\u044f\u0447\u0438\u043c\u0438 \u043c\u0435\u0442\u043e\u0434\u0430\u043c\u0438 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440, \u043c\u0435\u0442\u043e\u0434 <code>calculateShift()<\/code> \u0438 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 <code>CRHM$Segment<\/code> (\u0437\u0434\u0435\u0441\u044c \u0438 \u0434\u0430\u043b\u0435\u0435 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 <code>CRHM<\/code> \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0441\u044f \u043a \u0432\u0435\u0440\u0441\u0438\u0438 \u0421\u043f\u0440\u0438\u043d\u0433\u0430 5.1.3). \u0412\u043e\u0442 \u043e\u043d\u0438:<\/p>\n<pre><code class=\"java\">public ConcurrentReferenceHashMap( int initialCapacity, float loadFactor, int concurrencyLevel, ReferenceType referenceType) {    Assert.isTrue(initialCapacity &gt;= 0, \"Initial capacity must not be negative\");   Assert.isTrue(loadFactor &gt; 0f, \"Load factor must be positive\");   Assert.isTrue(concurrencyLevel &gt; 0, \"Concurrency level must be positive\");   Assert.notNull(referenceType, \"Reference type must not be null\");   this.loadFactor = loadFactor;   this.shift = calculateShift(concurrencyLevel, MAXIMUM_CONCURRENCY_LEVEL);   int size = 1 &lt;&lt; this.shift;   this.referenceType = referenceType;   int roundedUpSegmentCapacity = (int) ((initialCapacity + size - 1L) \/ size);   this.segments = (Segment[]) Array.newInstance(Segment.class, size);   for (int i = 0; i &lt; this.segments.length; i++) {     this.segments[i] = new Segment(roundedUpSegmentCapacity);   } }  public Segment(int initialCapacity) {   this.referenceManager = createReferenceManager();   this.initialSize = 1 &lt;&lt; calculateShift(initialCapacity, MAXIMUM_SEGMENT_SIZE);   this.references = createReferenceArray(this.initialSize);   this.resizeThreshold = (int) (this.references.length * getLoadFactor()); }  protected static int calculateShift(int minimumValue, int maximumValue) {   int shift = 0;   int value = 1;   while (value &lt; minimumValue &amp;&amp; value &lt; maximumValue) {     value &lt;&lt;= 1;     shift++;   }   return shift; }<\/code><\/pre>\n<p>\u041f\u0435\u0440\u0432\u043e\u0435, \u0447\u0442\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0441\u043e\u043c\u043d\u0435\u043d\u0438\u044f \u0432 \u0434\u043e\u0441\u0442\u043e\u0432\u0435\u0440\u043d\u043e\u0441\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0446\u0438\u0444\u0440 &#8212; \u044d\u0442\u043e \u0434\u043e\u043b\u044f  <code>calculateShift()<\/code>. \u0421\u043e\u043c\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e, \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u044e\u0449\u0438\u0439 \u043c\u0435\u0442\u043e\u0434 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 \u043f\u043e\u0447\u0442\u0438 17%.<\/p>\n<p>\u041d\u0443\u0436\u043d\u0430 \u043f\u043e\u0432\u044b\u0448\u0435\u043d\u043d\u0430\u044f \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c, \u0430 \u0437\u043d\u0430\u0447\u0438\u0442 \u043d\u0430 \u043f\u043e\u043c\u043e\u0449\u044c \u0438\u0434\u0451\u0442 <a href=\"https:\/\/github.com\/jvm-profiling-tools\/async-profiler\" rel=\"noopener noreferrer nofollow\">async-profiler<\/a>. \u0423\u043f\u0440\u043e\u0441\u0442\u0438\u043c \u0431\u0435\u043d\u0447\u043c\u0430\u0440\u043a, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0444\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 <code>CRHM<\/code>:<\/p>\n<pre><code class=\"java\">@OutputTimeUnit(TimeUnit.NANOSECO<\/code><\/pre>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\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-348513","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/348513","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=348513"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/348513\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=348513"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=348513"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=348513"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}