Re: [Quickfix-developers] Performance issue: FIX::message_sorter
Brought to you by:
orenmnero
|
From: Djalma R. d. S. F. <drs...@gm...> - 2007-07-10 19:55:44
|
Hi Yuriy, Very interesting! I think that I got your idea. I guess that if you use extern instead of static you can initialize all shared pointers in a single CPP file. I would appreciate to take a look in your code. Regards, Djalma On 7/9/07, Yuriy Baranovskyy <Yur...@tr...> wrote: > QuickFIX Documentation: http://www.quickfixengine.org/quickfix/doc/html/i= ndex.html > QuickFIX Support: http://www.quickfixengine.org/services.html > > Hi, > > I'm having a performance problem with my application, which uses QuickFix= 1.12.4. After profiling I discovered that FIX::message_order constructor a= nd copy operator both are very slow due to excessive heap allocation. > > FIX::message_order class has rather na=EFve implementation, which uses ar= ray of ints for reverse lookup of the field ranks. This array is created/co= pied each time the field is created/copied, which happens a lot during the = message construction. The array size is typically few K each (max field num= ber * sizeof(int)), so all these copies cost you dear. > > It's easy to implement light-weight copying just by using shared pointer = to that array. (In my implementation I use either vector<int> or hash_map<i= nt,int>, which are chosen in run-time depending on the predicted size). > The copy constructor and assignment operator then only copy shared pointe= r, not the array. > > To make construction light-weight is more tricky. Currently, FIX::message= _order is created on the stack and passed to FIX::Group constructor, as def= ined in message header files (src/C++/FIX44/*.h). > > Ideally, you'd need one instance of FIX::message_order class per field ty= pe. The simplest way to do it is to initialise each FIX::Group with static = instances of FIX::message_order. But this would require making .cpp file pe= r each message header file, and adding them to the project/makefile. > > I can post solution for FIX::message_order here, but it is not clear how = to solve the problem with cpp files. I played a bit with ruby code which ge= nerated CPP sources, but adding 159 cpp files to the project seems to be qu= ite a big change. > > Regards, > > Yuriy Baranovskyy > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Quickfix-developers mailing list > Qui...@li... > https://lists.sourceforge.net/lists/listinfo/quickfix-developers > |