db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Knut Anders Hatlen (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (DERBY-5947) Factor out common code from generated classes
Date Tue, 16 Oct 2012 10:47:04 GMT

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

Knut Anders Hatlen updated DERBY-5947:

    Attachment: values1-after-1a.txt

Attached is a patch (d5947-1a-remove-common-methods.diff) that reduces
the number of fields and methods in the generated classes. I'm also
attaching values1-after-1a.txt which shows the decompiled class file
for a VALUES 1 statement, for comparison with the already attached

As can be seen from the decompiled class file, the patch removes the
three fields getExecutionCount, getRowCountCheckVector and
getStalePlanCheckInterval, and replaces them with a single constant
field of type RowCountStats.

The six accessor methods have been replaced with a single getter
method which returns the RowCountStats instance.

For those who care about bits and bytes, the size of each generated
class was reduced by 139 bytes.

All the regression tests passed with the patch.

Patch details:


- Added an inner class RowCountStats with three fields that could hold
  the same information as the three fields that previously were added
  to each generated class.

- Added an abstract method for getting the RowCountStats instance. To
  be implemented by the generated classes.

- Removed six abstract methods that are no longer implemented by the
  generated classes.


- Removed the six accessor methods (the same ones that are removed
  from the generated classes).

- Added overrides of two methods that tell the execution code that row
  counts are of no relevance to constant actions.


- Removed code that would add the three fields and their accessor
  methods to the generated classes.

- Added code to create the new static field, a static initializer for
  it, and a getter method.


- Added a constant for the name of the new RowCountStats class.


- Removed the old helper methods used for generating fields and their
  corresponding accessor methods, as they are no longer used.

- Added new helper methods to generate static initializers and code to
  get or set static fields.
> 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: d5947-1a-remove-common-methods.diff, natural-join-decompiled.txt,
values1-after-1a.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

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

View raw message