{"action":"closed","issue":{"url":"https://api.github.com/repos/jOOQ/jOOQ/issues/4651","labels_url":"https://api.github.com/repos/jOOQ/jOOQ/issues/4651/labels{/name}","comments_url":"https://api.github.com/repos/jOOQ/jOOQ/issues/4651/comments","events_url":"https://api.github.com/repos/jOOQ/jOOQ/issues/4651/events","html_url":"https://github.com/jOOQ/jOOQ/issues/4651","id":111970329,"number":4651,"title":"Significant overhead caused by AbstractContext's internal ArrayDeque stacks that created even if there are no VisitListeners","user":{"login":"lukaseder","id":734593,"avatar_url":"https://avatars.githubusercontent.com/u/734593?v=3","gravatar_id":"","url":"https://api.github.com/users/lukaseder","html_url":"https://github.com/lukaseder","followers_url":"https://api.github.com/users/lukaseder/followers","following_url":"https://api.github.com/users/lukaseder/following{/other_user}","gists_url":"https://api.github.com/users/lukaseder/gists{/gist_id}","starred_url":"https://api.github.com/users/lukaseder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lukaseder/subscriptions","organizations_url":"https://api.github.com/users/lukaseder/orgs","repos_url":"https://api.github.com/users/lukaseder/repos","events_url":"https://api.github.com/users/lukaseder/events{/privacy}","received_events_url":"https://api.github.com/users/lukaseder/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/jOOQ/jOOQ/labels/C:%20Functionality","name":"C: Functionality","color":"0000aa"},{"url":"https://api.github.com/repos/jOOQ/jOOQ/labels/P:%20High","name":"P: High","color":"ff6666"},{"url":"https://api.github.com/repos/jOOQ/jOOQ/labels/R:%20Fixed","name":"R: Fixed","color":"55ff55"},{"url":"https://api.github.com/repos/jOOQ/jOOQ/labels/T:%20Defect","name":"T: Defect","color":"cccccc"}],"state":"closed","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/jOOQ/jOOQ/milestones/119","html_url":"https://github.com/jOOQ/jOOQ/milestones/Version%203.8.0","labels_url":"https://api.github.com/repos/jOOQ/jOOQ/milestones/119/labels","id":1094772,"number":119,"title":"Version 3.8.0","description":"","creator":{"login":"lukaseder","id":734593,"avatar_url":"https://avatars.githubusercontent.com/u/734593?v=3","gravatar_id":"","url":"https://api.github.com/users/lukaseder","html_url":"https://github.com/lukaseder","followers_url":"https://api.github.com/users/lukaseder/followers","following_url":"https://api.github.com/users/lukaseder/following{/other_user}","gists_url":"https://api.github.com/users/lukaseder/gists{/gist_id}","starred_url":"https://api.github.com/users/lukaseder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lukaseder/subscriptions","organizations_url":"https://api.github.com/users/lukaseder/orgs","repos_url":"https://api.github.com/users/lukaseder/repos","events_url":"https://api.github.com/users/lukaseder/events{/privacy}","received_events_url":"https://api.github.com/users/lukaseder/received_events","type":"User","site_admin":false},"open_issues":316,"closed_issues":15,"state":"open","created_at":"2015-05-04T10:29:41Z","updated_at":"2015-10-17T16:09:55Z","due_on":null,"closed_at":null},"comments":0,"created_at":"2015-10-17T16:07:24Z","updated_at":"2015-10-17T16:09:55Z","closed_at":"2015-10-17T16:09:55Z","body":"Once #3935 is resolved, we might end up with no `VisitListeners` in the `AbstractContext` type, if clients aren't using any visit listeners. This means that we don't need to create any related instances of `ArrayDeque` in the `AbstractContext`:\r\n\r\n```java\r\n    // [#2665] VisitListener API\r\n    final VisitListener[]             visitListeners;\r\n    private final Deque<Clause>       visitClauses; // Unneeded, if visitListeners.length == 0\r\n    private final DefaultVisitContext visitContext; // Unneeded, if visitListeners.length == 0\r\n    private final Deque<QueryPart>    visitParts; // Unneeded, if visitListeners.length == 0\r\n```\r\n\r\nNeither do we need to push and pop `QueryParts` onto these stacks. Avoiding to do so will decrease the pressure on GC, as well as speed up AST traversal in general. In a benchmark run against H2, this accounts for an improvement of 20%!\r\n\r\n> This is a finding from analyses made after a third-party benchmark comparing jOOQ with JDBC, Hibernate, Spring Data:\r\nhttps://github.com/nithril/sandbox-query-benchmark-jooq-hibernate-jdbc"}}