History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: DROOLS-487
Type: Improvement Improvement
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Unassigned
Reporter: Greg Barton
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
drools-legacy

Remove some inefficient exception handling

Created: 15/Mar/06 04:00 PM   Updated: 21/Apr/06 04:59 PM
Component/s: io
Affects Version/s: 2.5
Fix Version/s: 2.5

Time Tracking:
Not Specified

File Attachments: 1. Text File patch.txt (4 kb)



 Description  « Hide
Using exceptions for flow control can be very inefficient on most modern VMs. This is because exception handling is rarely optimized. Thus it is highly preferable to use conditionals to test for exceptional conditions and avoid them instead of using a try/catch to knowingly trigger them.

I saw some code in org.drools.io.RuleSetReader.resolveSchema() that tested various locations for the xsd file using exceptions for flow control. Attached is a patch that eliminates that with identical functionality.



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Michael Neale - 20/Mar/06 01:03 AM
yes that could be better, checking for null streams. The impact on this would be minimal, as most of the time it will work with the first try, also its a one off loading cost.

Finally, this piece of code has been retired from Drools 3, and has been sent out the pasture (or perhaps the shed, and then shot in the head). No you can't visit it.


Greg Barton - 20/Mar/06 10:32 AM
Cool. Mind if I spelunk the code for other similar issues?

Michael Neale - 20/Mar/06 05:52 PM
yeah in Drools 3, go for it.

Mark Proctor - 21/Apr/06 04:59 PM
We have an XML Reader in Drools 3.0 now - so I'm applying this code