You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Ka-Lok Fung (JIRA)" <ji...@apache.org> on 2011/01/21 03:47:46 UTC
[jira] Created: (CXF-3262) JAX-RS: Performance Improvement: Don't
use IllegalArgumentException to determine if a URI chunk is a variable or
literal
JAX-RS: Performance Improvement: Don't use IllegalArgumentException to determine if a URI chunk is a variable or literal
------------------------------------------------------------------------------------------------------------------------
Key: CXF-3262
URL: https://issues.apache.org/jira/browse/CXF-3262
Project: CXF
Issue Type: Improvement
Affects Versions: 2.3.1
Environment: JDK 1.6
Reporter: Ka-Lok Fung
Priority: Minor
Fix For: 2.3.3
Profiling the Apache CXF JAX-RS code shows that more time than necessary is being spent in UriChunk.createUriChunk because it uses an IllegalArgumentException to determine whether a URI chunk should be a literal or a variable. Creating exceptions is expensive :(
Instead of using IllegalArgumentException, perhaps you can have a method that is like the following:
public static Variable.create(String uriChunk)
where null will be returned if uriChunk is not a variable. This way you can avoid the overhead of creating the unnecessary stack trace.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Resolved: (CXF-3262) JAX-RS: Performance Improvement: Don't
use IllegalArgumentException to determine if a URI chunk is a variable or
literal
Posted by "Sergey Beryozkin (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CXF-3262?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Sergey Beryozkin resolved CXF-3262.
-----------------------------------
Resolution: Fixed
Fix Version/s: 2.4
Assignee: Sergey Beryozkin
Jason - patch has been applied, thanks
> JAX-RS: Performance Improvement: Don't use IllegalArgumentException to determine if a URI chunk is a variable or literal
> ------------------------------------------------------------------------------------------------------------------------
>
> Key: CXF-3262
> URL: https://issues.apache.org/jira/browse/CXF-3262
> Project: CXF
> Issue Type: Improvement
> Components: JAX-RS
> Affects Versions: 2.3.1
> Environment: JDK 1.6
> Reporter: Ka-Lok Fung
> Assignee: Sergey Beryozkin
> Priority: Minor
> Fix For: 2.4, 2.3.3
>
> Attachments: patch.diff
>
> Original Estimate: 3h
> Remaining Estimate: 3h
>
> Profiling the Apache CXF JAX-RS code shows that more time than necessary is being spent in UriChunk.createUriChunk because it uses an IllegalArgumentException to determine whether a URI chunk should be a literal or a variable. Creating exceptions is expensive :(
> Instead of using IllegalArgumentException, perhaps you can have a method that is like the following:
> public static Variable.create(String uriChunk)
> where null will be returned if uriChunk is not a variable. This way you can avoid the overhead of creating the unnecessary stack trace.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (CXF-3262) JAX-RS: Performance Improvement: Don't
use IllegalArgumentException to determine if a URI chunk is a variable or
literal
Posted by "Sergey Beryozkin (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CXF-3262?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Sergey Beryozkin updated CXF-3262:
----------------------------------
Component/s: JAX-RS
> JAX-RS: Performance Improvement: Don't use IllegalArgumentException to determine if a URI chunk is a variable or literal
> ------------------------------------------------------------------------------------------------------------------------
>
> Key: CXF-3262
> URL: https://issues.apache.org/jira/browse/CXF-3262
> Project: CXF
> Issue Type: Improvement
> Components: JAX-RS
> Affects Versions: 2.3.1
> Environment: JDK 1.6
> Reporter: Ka-Lok Fung
> Priority: Minor
> Fix For: 2.3.3
>
> Original Estimate: 3h
> Remaining Estimate: 3h
>
> Profiling the Apache CXF JAX-RS code shows that more time than necessary is being spent in UriChunk.createUriChunk because it uses an IllegalArgumentException to determine whether a URI chunk should be a literal or a variable. Creating exceptions is expensive :(
> Instead of using IllegalArgumentException, perhaps you can have a method that is like the following:
> public static Variable.create(String uriChunk)
> where null will be returned if uriChunk is not a variable. This way you can avoid the overhead of creating the unnecessary stack trace.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (CXF-3262) JAX-RS: Performance Improvement: Don't
use IllegalArgumentException to determine if a URI chunk is a variable or
literal
Posted by "Sergey Beryozkin (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CXF-3262?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12986050#action_12986050 ]
Sergey Beryozkin commented on CXF-3262:
---------------------------------------
The patch looks perfect to me, thanks
> JAX-RS: Performance Improvement: Don't use IllegalArgumentException to determine if a URI chunk is a variable or literal
> ------------------------------------------------------------------------------------------------------------------------
>
> Key: CXF-3262
> URL: https://issues.apache.org/jira/browse/CXF-3262
> Project: CXF
> Issue Type: Improvement
> Components: JAX-RS
> Affects Versions: 2.3.1
> Environment: JDK 1.6
> Reporter: Ka-Lok Fung
> Priority: Minor
> Fix For: 2.3.3
>
> Attachments: patch.diff
>
> Original Estimate: 3h
> Remaining Estimate: 3h
>
> Profiling the Apache CXF JAX-RS code shows that more time than necessary is being spent in UriChunk.createUriChunk because it uses an IllegalArgumentException to determine whether a URI chunk should be a literal or a variable. Creating exceptions is expensive :(
> Instead of using IllegalArgumentException, perhaps you can have a method that is like the following:
> public static Variable.create(String uriChunk)
> where null will be returned if uriChunk is not a variable. This way you can avoid the overhead of creating the unnecessary stack trace.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (CXF-3262) JAX-RS: Performance Improvement: Don't
use IllegalArgumentException to determine if a URI chunk is a variable or
literal
Posted by "Jason Downey (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CXF-3262?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jason Downey updated CXF-3262:
------------------------------
Attachment: patch.diff
Here's a potential patch for this issue. Now Literal and Variable have a create function which return a UriChunk. Variable creation avoids the throwing of IllegalArgumentException but Literal keeps it for null and blank strings.
In this tightly nested loop,
public void testURITemplatePerformance() {
long startTime = System.currentTimeMillis();
for (long i = 1; i < 900000; i++)
new URITemplate("/customers/name/{name}/dep/{department}");
long endTime = System.currentTimeMillis();
System.out.println(endTime - startTime);
}
the original implementation ran in 26 seconds; the patched version ran in 13 seconds. The savings would have been a lot more if there had been more literals in the URI.
> JAX-RS: Performance Improvement: Don't use IllegalArgumentException to determine if a URI chunk is a variable or literal
> ------------------------------------------------------------------------------------------------------------------------
>
> Key: CXF-3262
> URL: https://issues.apache.org/jira/browse/CXF-3262
> Project: CXF
> Issue Type: Improvement
> Components: JAX-RS
> Affects Versions: 2.3.1
> Environment: JDK 1.6
> Reporter: Ka-Lok Fung
> Priority: Minor
> Fix For: 2.3.3
>
> Attachments: patch.diff
>
> Original Estimate: 3h
> Remaining Estimate: 3h
>
> Profiling the Apache CXF JAX-RS code shows that more time than necessary is being spent in UriChunk.createUriChunk because it uses an IllegalArgumentException to determine whether a URI chunk should be a literal or a variable. Creating exceptions is expensive :(
> Instead of using IllegalArgumentException, perhaps you can have a method that is like the following:
> public static Variable.create(String uriChunk)
> where null will be returned if uriChunk is not a variable. This way you can avoid the overhead of creating the unnecessary stack trace.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.