You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Jeremy Bauer (Created) (JIRA)" <ji...@apache.org> on 2012/02/06 21:54:59 UTC

[jira] [Created] (OPENJPA-2120) Add new option to eliminate reflection calls from enhancer generated IdClass PC copy operations

Add new option to eliminate reflection calls from enhancer generated IdClass PC copy operations
-----------------------------------------------------------------------------------------------

                 Key: OPENJPA-2120
                 URL: https://issues.apache.org/jira/browse/OPENJPA-2120
             Project: OpenJPA
          Issue Type: Improvement
          Components: Enhance, kernel, performance
    Affects Versions: 2.2.0
            Reporter: Jeremy Bauer
            Assignee: Jeremy Bauer


Profiling has shown the code in the enhancer generated pcCopyKeyFields(To/From)ObjectId to be costly when using id classes with an entity that uses field access and has non-public fields.  Without public fields, reflection is used to move the values from the parent entity to the id class.  This also involves a costly temporary access switch.

I have a fix that interrogates the id class for a public constructor and uses that constructor (instead of costly reflection) during the copy operation.  It only works for certain IdClass and entity combinations.  IdClasses must have a trivial public constructor with parameters that match those of the id fields.  Trivial =  the constructor can only do direct field assignments from the parameter values to the id class values.  No conversion can take place.  The constructor can have other logic, but the assignments must be direct.  The entity ids cannot be derived from other identities.  If these conditions are not met, the enhancer falls back to using reflection.

Since this change could result in an application behavior change (the provider calling a new constructor) it is gated by the openjpa.OptimizeIdCopy property, with the default being false.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Resolved] (OPENJPA-2120) Add new option to eliminate reflection calls from enhancer generated IdClass PC copy operations

Posted by "Jeremy Bauer (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-2120?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jeremy Bauer resolved OPENJPA-2120.
-----------------------------------

       Resolution: Fixed
    Fix Version/s: 2.3.0
    
> Add new option to eliminate reflection calls from enhancer generated IdClass PC copy operations
> -----------------------------------------------------------------------------------------------
>
>                 Key: OPENJPA-2120
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2120
>             Project: OpenJPA
>          Issue Type: Improvement
>          Components: Enhance, kernel, performance
>    Affects Versions: 2.2.0
>            Reporter: Jeremy Bauer
>            Assignee: Jeremy Bauer
>             Fix For: 2.3.0, 2.2.0
>
>
> Profiling has shown the code in the enhancer generated pcCopyKeyFields(To/From)ObjectId to be costly when using id classes with an entity that uses field access and has non-public fields.  Without public fields, reflection is used to move the values from the parent entity to the id class.  This also involves a costly temporary access switch.
> I have a fix that interrogates the id class for a public constructor and uses that constructor (instead of costly reflection) during the copy operation.  It only works for certain IdClass and entity combinations.  IdClasses must have a trivial public constructor with parameters that match those of the id fields.  Trivial =  the constructor can only do direct field assignments from the parameter values to the id class values.  No conversion can take place.  The constructor can have other logic, but the assignments must be direct.  The entity ids cannot be derived from other identities.  If these conditions are not met, the enhancer falls back to using reflection.
> Since this change could result in an application behavior change (the provider calling a new constructor) it is gated by the openjpa.OptimizeIdCopy property, with the default being false.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Closed] (OPENJPA-2120) Add new option to eliminate reflection calls from enhancer generated IdClass PC copy operations

Posted by "Albert Lee (Closed) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-2120?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Albert Lee closed OPENJPA-2120.
-------------------------------

    
> Add new option to eliminate reflection calls from enhancer generated IdClass PC copy operations
> -----------------------------------------------------------------------------------------------
>
>                 Key: OPENJPA-2120
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2120
>             Project: OpenJPA
>          Issue Type: Improvement
>          Components: Enhance, kernel, performance
>    Affects Versions: 2.2.0
>            Reporter: Jeremy Bauer
>            Assignee: Jeremy Bauer
>             Fix For: 2.2.0
>
>
> Profiling has shown the code in the enhancer generated pcCopyKeyFields(To/From)ObjectId to be costly when using id classes with an entity that uses field access and has non-public fields.  Without public fields, reflection is used to move the values from the parent entity to the id class.  This also involves a costly temporary access switch.
> I have a fix that interrogates the id class for a public constructor and uses that constructor (instead of costly reflection) during the copy operation.  It only works for certain IdClass and entity combinations.  IdClasses must have a trivial public constructor with parameters that match those of the id fields.  Trivial =  the constructor can only do direct field assignments from the parameter values to the id class values.  No conversion can take place.  The constructor can have other logic, but the assignments must be direct.  The entity ids cannot be derived from other identities.  If these conditions are not met, the enhancer falls back to using reflection.
> Since this change could result in an application behavior change (the provider calling a new constructor) it is gated by the openjpa.OptimizeIdCopy property, with the default being false.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Resolved] (OPENJPA-2120) Add new option to eliminate reflection calls from enhancer generated IdClass PC copy operations

Posted by "Jeremy Bauer (Resolved) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-2120?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jeremy Bauer resolved OPENJPA-2120.
-----------------------------------

       Resolution: Fixed
    Fix Version/s: 2.2.0
    
> Add new option to eliminate reflection calls from enhancer generated IdClass PC copy operations
> -----------------------------------------------------------------------------------------------
>
>                 Key: OPENJPA-2120
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2120
>             Project: OpenJPA
>          Issue Type: Improvement
>          Components: Enhance, kernel, performance
>    Affects Versions: 2.2.0
>            Reporter: Jeremy Bauer
>            Assignee: Jeremy Bauer
>             Fix For: 2.2.0
>
>
> Profiling has shown the code in the enhancer generated pcCopyKeyFields(To/From)ObjectId to be costly when using id classes with an entity that uses field access and has non-public fields.  Without public fields, reflection is used to move the values from the parent entity to the id class.  This also involves a costly temporary access switch.
> I have a fix that interrogates the id class for a public constructor and uses that constructor (instead of costly reflection) during the copy operation.  It only works for certain IdClass and entity combinations.  IdClasses must have a trivial public constructor with parameters that match those of the id fields.  Trivial =  the constructor can only do direct field assignments from the parameter values to the id class values.  No conversion can take place.  The constructor can have other logic, but the assignments must be direct.  The entity ids cannot be derived from other identities.  If these conditions are not met, the enhancer falls back to using reflection.
> Since this change could result in an application behavior change (the provider calling a new constructor) it is gated by the openjpa.OptimizeIdCopy property, with the default being false.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Reopened] (OPENJPA-2120) Add new option to eliminate reflection calls from enhancer generated IdClass PC copy operations

Posted by "Jeremy Bauer (Reopened) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-2120?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jeremy Bauer reopened OPENJPA-2120:
-----------------------------------


Adding optimization support for methods that use a field manager
                
> Add new option to eliminate reflection calls from enhancer generated IdClass PC copy operations
> -----------------------------------------------------------------------------------------------
>
>                 Key: OPENJPA-2120
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2120
>             Project: OpenJPA
>          Issue Type: Improvement
>          Components: Enhance, kernel, performance
>    Affects Versions: 2.2.0
>            Reporter: Jeremy Bauer
>            Assignee: Jeremy Bauer
>             Fix For: 2.2.0
>
>
> Profiling has shown the code in the enhancer generated pcCopyKeyFields(To/From)ObjectId to be costly when using id classes with an entity that uses field access and has non-public fields.  Without public fields, reflection is used to move the values from the parent entity to the id class.  This also involves a costly temporary access switch.
> I have a fix that interrogates the id class for a public constructor and uses that constructor (instead of costly reflection) during the copy operation.  It only works for certain IdClass and entity combinations.  IdClasses must have a trivial public constructor with parameters that match those of the id fields.  Trivial =  the constructor can only do direct field assignments from the parameter values to the id class values.  No conversion can take place.  The constructor can have other logic, but the assignments must be direct.  The entity ids cannot be derived from other identities.  If these conditions are not met, the enhancer falls back to using reflection.
> Since this change could result in an application behavior change (the provider calling a new constructor) it is gated by the openjpa.OptimizeIdCopy property, with the default being false.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira