Hi, while implementing castor as our xml marshaller, i did some performance measurements. The marshalling and unmarshalling performance is orders of magnitude lower than with JAXB. This strikes me as odd, i expected a little increase but not as much as this. With Jaxb I get 1800 transactions per second, with Castor just about 10-12. I' am using castor 1.2 with java 1.6. Could you help me out finding where it goes wrong?
Side and Currency are simple enum's ------------ mapping.xml ------------------------------ <mapping> <description>Castor Mapping</description> <class name="de.hdm.marshal.dto.Header"> <map-to xml="header"/> </class> <class name="de.hdm.marshal.dto.MultiPayloadMessage"> <map-to xml="message"/> <field name="header" type="de.hdm.marshal.dto.Header"> <bind-xml name="header" node="element"/> </field> <field name="payload" type="de.hdm.marshal.dto.Position" collection="arraylist"> <bind-xml name="payload" node="element"/> </field> </class> <class name="de.hdm.marshal.dto.Position"> <map-to xml="position"/> <field name="id" type="integer"> <bind-xml name="id" node="element"/> </field> <field name="baseCurrency" type="de.hdm.marshal.dto.Currency"> <bind-xml name="baseCurrency" /> </field> <field name="termsCurrency" type="de.hdm.marshal.dto.Currency"> <bind-xml name="termsCurrency" /> </field> <field name="valueDate" type="date"> <bind-xml name="valueDate" node="element"/> </field> <field name="amount" type="big-decimal"> <bind-xml name="amount" node="element"/> </field> <field name="price" type="big-decimal"> <bind-xml name="price" node="element"/> </field> <field name="side" type="de.hdm.marshal.dto.Side"> <bind-xml name="side"/> </field> </class> </mapping> -------------------- object MultiPayloadMessage -------------- package de.hdm.marshal.dto; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlElement; import java.util.ArrayList; import java.lang.reflect.Array; /** * User: Johannes * Date: 22.09.2008 * Time: 18:55:51 */ @XmlRootElement( namespace = "http://www.my-objects.com/" ) public class MultiPayloadMessage { private ArrayList<Position> payload = new ArrayList<Position>(); private Header header; public MultiPayloadMessage() { } public void addPayload(Position psoition) { payload.add(psoition); } public ArrayList<Position> getPayload() { return payload; } public void setPayload(ArrayList<Position> payload) { this.payload = payload; } public Header getHeader() { return header; } public void setHeader(Header header) { this.header = header; } } ---------------------------- object Header ------------------------- package de.hdm.marshal.dto; /** * User: Johannes * Date: 22.09.2008 * Time: 19:00:06 */ public class Header { public Header() { } } ---------------------- object Position ----------------------------------- package de.hdm.marshal.dto; import java.util.Date; import java.math.BigDecimal; /** * User: Johannes * Date: 22.09.2008 * Time: 18:53:23 */ public class Position { private Currency baseCurrency; private Currency termsCurrency; private Date valueDate; private BigDecimal amount; private BigDecimal price; private Side side; private int id; public Position() { } public int getId() { return id; } public void setId(int id) { this.id = id; } public Currency getBaseCurrency() { return baseCurrency; } public void setBaseCurrency(Currency baseCurrency) { this.baseCurrency = baseCurrency; } public Currency getTermsCurrency() { return termsCurrency; } public void setTermsCurrency(Currency termsCurrency) { this.termsCurrency = termsCurrency; } public Date getValueDate() { return valueDate; } public void setValueDate(Date valueDate) { this.valueDate = valueDate; } public BigDecimal getAmount() { return amount; } public void setAmount(BigDecimal amount) { this.amount = amount; } public BigDecimal getPrice() { return price; } public void setPrice(BigDecimal price) { this.price = price; } public Side getSide() { return side; } public void setSide(Side side) { this.side = side; } } ----------------------------------- Unmarshaling Code ---------------------------------------------------------- Mapping mapping = new Mapping(); try { mapping.loadMapping("castorMapping.xml"); } catch (IOException e) { System.out.println(e.toString()); } catch (MappingException e) { System.out.println(e.toString()); } um = new Unmarshaller(MultiPayloadMessage.class); try { um.setMapping(mapping); um.setValidation(false); } catch (MappingException e) { System.out.println(e.toString()); } int rounds = 100000; start = System.nanoTime(); MultiPayloadMessage message; for (int i = 0; i < rounds; i++) { StringReader reader = new StringReader(testData.get(r.nextInt(100))); try { message = (MultiPayloadMessage) um.unmarshal(reader); } catch (MarshalException e) { System.out.println(e.toString()); } catch (ValidationException e) { System.out.println(e.toString()); } } end = System.nanoTime(); --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email

