I felt xstream loading speed doesn't up to my requirement when I try to perform loading from the XML file. For an "database" with 10k ++ entries, it will take several minutes.
The following is the entire data structure I use to serialize. Size of List (symbols and codes) will be roughly 10k ++ entries.
Is there any approach I can try out, to see whether it will speed up my loading time? Able to still load back previous saved file is important as well.
The following are the code used to de-serialization. Thanks.
@SuppressWarnings("unchecked")
public static <A> A fromXML(Class c, File file) {
XStream xStream = new XStream(new DomDriver("UTF-8"));
InputStream inputStream = null;
try {
inputStream = new java.io.FileInputStream(file);
Object object = xStream.fromXML(inputStream);
if (c.isInstance(object)) {
return (A)object;
}
}
catch (Exception exp) {
log.error(null, exp);
}
finally {
if (false == close(inputStream)) {
return null;
}
inputStream = null;
}
return null;
}