Hi Huang-Ming,
No, you are correct in that I was decoding a singular message (but not in a loop, more like five to ten times just to see the 'cold cache' versus 'hot cache' performance). However, I don't think QuickFAST allocates memory at runtime if you use ValueMessageBuilder, even the first time you use it (unless you are hitting a string that is > 32 characters or etc.) And like I said, I did see mFAST as faster, but more like 100% faster (or "half the decode time").
If you want to check out my test case, here is the data and template that I used. I decoded it with code like:
::mfast::fast_decoder fd;
fd.include(templates_description);
uint64_t rdtsc1 = __rdtsc();
fd.decode(beg, end);
uint64_t rdtsc2 = __rdtsc();
Template:
<template name="template142" id="142" dictionary="142" xmlns="
http://www.fixprotocol.org/ns/fast/td/1.1">
<string name="ApplVerID" id="1128">
<constant value="6" />
</string>
<string name="MessageType" id="35">
<constant value="X" />
</string>
<string name="SenderCompID" id="49">
<constant value="PCT" />
</string>
<uInt32 name="MsgSeqNum" id="34"></uInt32>
<uInt64 name="SendingTime" id="52"></uInt64>
<string name="PosDupFlag" id="43" presence="optional">
</string>
<uInt32 name="TradeDate" id="75"></uInt32>
<sequence name="MDEntries">
<length name="NoMDEntries" id="268"></length>
<uInt32 name="MDUpdateAction" id="279">
</uInt32>
<string name="MDEntryType" id="269">
</string>
<uInt32 name="SecurityIDSource" id="22">
<constant value="8" />
</uInt32>
<uInt32 name="SecurityID" id="48">
</uInt32>
<uInt32 name="RptSeq" id="83">
</uInt32>
<decimal name="MDEntryPx" id="270">
<exponent></exponent>
<mantissa></mantissa>
</decimal>
<uInt32 name="MDEntryTime" id="273">
</uInt32>
<int32 name="MDEntrySize" id="271" presence="optional">
</int32>
<decimal name="NetChgPrevDay" id="451" presence="optional">
<exponent></exponent>
<mantissa></mantissa>
</decimal>
<uInt32 name="TradeVolume" id="1020" presence="optional">
</uInt32>
<string name="TradeCondition" id="277" presence="optional">
</string>
<string name="TickDirection" id="274" presence="optional">
</string>
<uInt32 name="AggressorSide" id="5797" presence="optional">
</uInt32>
<string name="MatchEventIndicator" id="5799" presence="optional">
</string>
<uInt32 name="TradeID" id="1003" presence="optional" />
<uInt32 name="NumberOfOrders" id="346" presence="optional" />
</sequence>
</template>
Data:
unsigned char packet[] =
{
0xc0, 0x01, 0x8e, 0x4c,
0x39, 0xe7, 0x23, 0x61, 0x27, 0x4b, 0x43, 0x5d, 0x0b,
0xfb, 0x80, 0x09, 0x4c, 0x5b, 0x93, 0x92, 0x80, 0xb2,
0x28, 0x53, 0xa6, 0x02, 0xa7, 0x80, 0x00, 0x42, 0xb4,
0x58, 0x4d, 0x08, 0xa0, 0x82, 0x81, 0xf5, 0xb4, 0x80,
0x80, 0x83, 0xb1, 0xb4, 0x80, 0x80, 0xb2, 0x28, 0x53,
0xa6, 0x02, 0xa8, 0x80, 0x00, 0x42, 0xb4, 0x58, 0x4d,
0x08, 0xa0, 0x82, 0x81, 0xf5, 0xb5, 0x80, 0x80, 0x83,
0x80, 0xb5, 0x80, 0x80, 0xb2, 0x28, 0x53, 0xa6, 0x02,
0xa9, 0x80, 0x00, 0x42, 0xb4, 0x58, 0x4d, 0x08, 0xa0,
0x82, 0x81, 0xf5, 0xb6, 0x80, 0x80, 0x83, 0x80, 0xb6,
0x80, 0x80, 0xb2, 0x28, 0x53, 0xa6, 0x02, 0xaa, 0x80,
0x00, 0x42, 0xb4, 0x58, 0x4d, 0x08, 0xa0, 0x82, 0x81,
0xf5, 0xb7, 0x80, 0x80, 0x83, 0x80, 0xb7, 0x80, 0x80,
0xb2, 0x28, 0x53, 0xa6, 0x02, 0xab, 0x80, 0x00, 0x42,
0xb4, 0x58, 0x4d, 0x08, 0xa0, 0x82, 0x81, 0xf5, 0xb8,
0x80, 0x80, 0x83, 0x80, 0xb8, 0x80, 0x80, 0xb2, 0x28,
0x53, 0xa6, 0x02, 0xac, 0x80, 0x00, 0x42, 0xb4, 0x58,
0x4d, 0x08, 0xa0, 0x82, 0x81, 0xf5, 0xb9, 0x80, 0x80,
0x83, 0x80, 0xb9, 0x80, 0x80, 0xb2, 0x28, 0x53, 0xa6,
0x02, 0xad, 0x80, 0x00, 0x42, 0xb4, 0x58, 0x4d, 0x08,
0xa0, 0x82, 0x81, 0xf5, 0xba, 0x80, 0x80, 0x83, 0x80,
0xba, 0x80, 0x80, 0xb2, 0x28, 0x53, 0xa6, 0x02, 0xae,
0x80, 0x00, 0x42, 0xb4, 0x58, 0x4d, 0x08, 0xa0, 0x82,
0x81, 0xf5, 0xbb, 0x80, 0x80, 0x83, 0x80, 0xbb, 0x80,
0x80, 0xb2, 0x28, 0x53, 0xa6, 0x02, 0xaf, 0x80, 0x00,
0x42, 0xb4, 0x58, 0x4d, 0x08, 0xa0, 0x82, 0x81, 0xf5,
0xbc, 0x80, 0x80, 0x83, 0x80, 0xbc, 0x80, 0x80, 0xb2,
0x28, 0x53, 0xa6, 0x02, 0xb0, 0x80, 0x00, 0x42, 0xb4,
0x58, 0x4d, 0x08, 0xa0, 0x82, 0x81, 0xf5, 0xbd, 0x80,
0x80, 0x83, 0x80, 0xbd, 0x80, 0x80, 0xb2, 0x28, 0x53,
0xa6, 0x02, 0xb1, 0x80, 0x00, 0x42, 0xb4, 0x58, 0x4d,
0x08, 0xa0, 0x82, 0x81, 0xf5, 0xbe, 0x80, 0x80, 0x83,
0x80, 0xbe, 0x80, 0x80, 0xb2, 0x28, 0x53, 0xa6, 0x02,
0xb2, 0x80, 0x00, 0x42, 0xb4, 0x58, 0x4d, 0x08, 0xa0,
0x82, 0x81, 0xf5, 0xbf, 0x80, 0x80, 0x83, 0x80, 0xbf,
0x80, 0x80, 0xb2, 0x28, 0x53, 0xa6, 0x02, 0xb3, 0x80,
0x00, 0x42, 0xb4, 0x58, 0x4d, 0x08, 0xa0, 0x82, 0x81,
0xf5, 0xc0, 0x80, 0x80, 0x83, 0x80, 0xc0, 0x80, 0x80,
0xb2, 0x28, 0x53, 0xa6, 0x02, 0xb4, 0x80, 0x00, 0x42,
0xb4, 0x58, 0x4d, 0x08, 0xa0, 0x82, 0x81, 0xf5, 0xc1,
0x80, 0x80, 0x83, 0x80, 0xc1, 0x80, 0x80, 0xb2, 0x28,
0x53, 0xa6, 0x02, 0xb5, 0x80, 0x00, 0x42, 0xb4, 0x58,
0x4d, 0x08, 0xa0, 0x82, 0x81, 0xf5, 0xc2, 0x80, 0x80,
0x83, 0x80, 0xc2, 0x80, 0x80, 0xb2, 0x28, 0x53, 0xa6,
0x02, 0xb6, 0x80, 0x00, 0x42, 0xb4, 0x58, 0x4d, 0x08,
0xa0, 0x82, 0x81, 0xf5, 0xc3, 0x80, 0x80, 0x83, 0x80,
0xc3, 0x80, 0x80, 0xb2, 0x28, 0x53, 0xa6, 0x02, 0xb7,
0x80, 0x00, 0x42, 0xb4, 0x58, 0x4d, 0x08, 0xa0, 0x82,
0x81, 0xf5, 0xc4, 0x80, 0x80, 0x83, 0x80, 0xc4, 0x80,
0x80, 0xb2, 0x28, 0x53, 0xa6, 0x02, 0xb8, 0x80, 0x00,
0x42, 0xb4, 0x58, 0x4d, 0x08, 0xa0, 0x82, 0x81, 0xf5,
0xc5, 0x80, 0x80, 0x83, 0x80, 0xc5, 0x80
};
-Chris