You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by lb <lb...@gmail.com> on 2015/12/09 14:52:50 UTC
Camel ApiName Enumeration : object creation optimization
Hi,
I've noticed that the code generated by camel-api-component-maven-plugin
for ApiName can potentially generate excessive garbage if fromValue is
invoked often, this is because:
- enum::values() is not cached so it generates a new array for each call
- new for style generates an iterator each time
So I've create a very simple patch (
https://github.com/lburgazzoli/apache-camel/commit/c973f5f97ba286c3fa89c0db77f4aad685e05a02)
that fixes it.
If ok I'll open a JIRA and submit a PR.
Regards,
Luca
Re: Camel ApiName Enumeration : object creation optimization
Posted by lb <lb...@gmail.com>.
Done.
https://issues.apache.org/jira/browse/CAMEL-9408
https://github.com/apache/camel/pull/720
On Wed, Dec 9, 2015 at 5:27 PM, Claus Ibsen <cl...@gmail.com> wrote:
> Hi Luca
>
> Yay thanks for reporting this. Yeah a JIRA and patch / PR is much welcome
> http://camel.apache.org/contributing
>
> On Wed, Dec 9, 2015 at 2:52 PM, lb <lb...@gmail.com> wrote:
> > Hi,
> >
> > I've noticed that the code generated by camel-api-component-maven-plugin
> > for ApiName can potentially generate excessive garbage if fromValue is
> > invoked often, this is because:
> >
> > - enum::values() is not cached so it generates a new array for each call
> > - new for style generates an iterator each time
> >
> > So I've create a very simple patch (
> >
> https://github.com/lburgazzoli/apache-camel/commit/c973f5f97ba286c3fa89c0db77f4aad685e05a02
> )
> > that fixes it.
> >
> > If ok I'll open a JIRA and submit a PR.
> >
> >
> > Regards,
> > Luca
>
>
>
> --
> Claus Ibsen
> -----------------
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2
>
Re: Camel ApiName Enumeration : object creation optimization
Posted by Claus Ibsen <cl...@gmail.com>.
Hi Luca
Yay thanks for reporting this. Yeah a JIRA and patch / PR is much welcome
http://camel.apache.org/contributing
On Wed, Dec 9, 2015 at 2:52 PM, lb <lb...@gmail.com> wrote:
> Hi,
>
> I've noticed that the code generated by camel-api-component-maven-plugin
> for ApiName can potentially generate excessive garbage if fromValue is
> invoked often, this is because:
>
> - enum::values() is not cached so it generates a new array for each call
> - new for style generates an iterator each time
>
> So I've create a very simple patch (
> https://github.com/lburgazzoli/apache-camel/commit/c973f5f97ba286c3fa89c0db77f4aad685e05a02)
> that fixes it.
>
> If ok I'll open a JIRA and submit a PR.
>
>
> Regards,
> Luca
--
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2