Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Limit.numberOfRowsOrMax should be initalised from static value #6635

Closed
lukaseder opened this issue Oct 5, 2017 · 0 comments

Comments

@lukaseder
Copy link
Member

commented Oct 5, 2017

In the existing Limit implementation, there's a member:

private Field<Integer>              numberOfRowsOrMax = DSL.inline(Integer.MAX_VALUE);

It gets initialised every time a Limit is initialised, which turns out to be quite costly compared to an overall benchmark (1% in a simple query that doesn't even use limit):

image

The query in the benchmark is this one:

    private Select<?> createSelect(DSLContext create) {
        return create.select()
                     .from(TBook())
                     .where(TBook_ID().equal(1))
                     .and(TBook_TITLE().isNull().or(TBook_TITLE().notEqual(RANDOM)));
    }

This is a really easy fix and totally worth doing, even if in this particular benchmark, the issue accounts for 1% only (in a profiling session)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.