[ 
https://issues.apache.org/jira/browse/DERBY-5947?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Knut Anders Hatlen updated DERBY-5947:
--------------------------------------

    Attachment: natural-join-decompiled.txt
                values1-decompiled.txt

Attaching files that show the generated code for a VALUES 1 statement and for 
SELECT SCHEMANAME, TABLENAME FROM SYS.SYSSCHEMAS NATURAL JOIN SYS.SYSTABLES.

They are decompiled to Java code for readability. The decompiler got the base 
class wrong, it should be BaseActivation instead of CursorActivation, but other 
than that it did a good job.

As can be seen from those files, the following fields are in both classes:

    private static int getExecutionCount;
    private static Vector getRowCountCheckVector;
    private static int getStalePlanCheckInterval;

And so are their six accessor methods.

Additionally, we could probably factor out

        this.throwIfClosed("execute");
        this.startExecution();

from their execute() methods (code which is also duplicated in 
ConstantActionActivation.execute()).
                
> Factor out common code from generated classes
> ---------------------------------------------
>
>                 Key: DERBY-5947
>                 URL: https://issues.apache.org/jira/browse/DERBY-5947
>             Project: Derby
>          Issue Type: Improvement
>          Components: SQL
>            Reporter: Knut Anders Hatlen
>            Assignee: Knut Anders Hatlen
>            Priority: Minor
>         Attachments: natural-join-decompiled.txt, values1-decompiled.txt
>
>
> There's some code that's added to all classes generated by Derby's query 
> compiler. For example, there are three static fields that contain statistics 
> used to check if the plan is stale, and there are getter and setter methods 
> for each of the three fields. The fields and their accessor methods take up 
> 468 bytes in every generated class.
> We should see if we can factor out some of this code so that there is a 
> single shared copy in BaseActivation. Advantages would be: less complicated 
> byte-code generation, less memory occupied by generated classes in the 
> statement cache, smaller disk footprint for stored prepared statements.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to