History | Log In     View a printable version of the current page. Get help!  
Issue Details [XML]

Key: SES-339
Type: Improvement Improvement
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Arjohn Kampman
Reporter: James Leigh
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Sesame

MemValueFactory should not need a StringBuffer in createURI(String,String)

Created: 25/Feb/07 03:11 PM   Updated: 20/Mar/08 09:41 PM
Component/s: Memory Sail
Affects Version/s: 2.0-beta1
Fix Version/s: 2.0-beta2


 Description   
If the correct namespace and localName are passed to a MemValueFactory these exact String Object should be used in the MemURI. Currently the process creates a StringBuffer->String->2xsubstring. In an example of two intern Strings passed in there is extra garbage memory and twice the permanent memory.

The method createURI(String,String) could be changed to the following:

char c = namespace.charAt(namespace.length() - 1);
if (c != '#' && c != '/' && c != ':')
    return createURI(namespace + localName);
if (localName.indexOf('#') + localName.indexOf('/') + localName.indexOf(':') != -3)
    return createURI(namespace + localName);

URI tempURI = new MemURI(namespace, localName);
MemURI memURI = _uriRegistry.get(tempURI);
if (memURI == null)
memURI = createMemURI(tempURI);
return memURI;


 All   Comments   Change History      Sort Order:
Comment by Arjohn Kampman [26/Feb/07 07:40 PM]
Issue fixed in revision 2435. Note that the suggested algorithm does not match the URI-splitting algorithm as specified for org.openrdf.model.URI. A correct implementation of the algorithm can be found in org.openrdf.model.ModelUtil.isCorrectURISplit(...).