Applying patch from https://issues.apache.org/jira/browse/IVY-1486
Fix IVY-1465 (performance issue from trunk)