Alberto, Thank you for your answer. Ori.
-----Original Message----- From: Alberto Massari [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 04, 2006 4:38 PM To: [email protected] Subject: RE: XMLFormatter performance Hi Ori, At 15.08 04/10/2006 +0200, Ori Doolman wrote: >The problem with your solution is that my application is mutli-threaded. >By the way, is XMLFormatter is thread safe? No, only a few parts of the Xerces API are thread-safe, all the rest is up to the calling code to ensure thread safety. >If not, then I should protect the XMLFormatter and my XMLFormatTarget >using a critical section in any case. >That is, > >In h file: >class... >{ > CMyXmlFormatTarget m_formatTarget; >} > >In constructor: > >m_formatter(IP_MC_DEFAULT_ENCODING_STR, > &m_formatTarget, > XMLFormatter::StdEscapes, > XMLFormatter::UnRep_Fail); > >In format function: > >EnterCriticalSection() >m_formatTarget.reset() >m_formatter.formatBuf(U_ParamValue, U_ParamValueLen); >LeaveCriticalSection() > > >Does it look good to you? Yes. Alberto >-----Original Message----- >From: Alberto Massari [mailto:[EMAIL PROTECTED] >Sent: Wednesday, October 04, 2006 1:46 PM >To: [email protected] >Subject: RE: XMLFormatter performance > >Hi Ori, >if you are concerned about performance, you can directly reuse your >CMyXmlFormatTarget and associated XMLFormatter; just add to your >CMyXMLFormatTarget a reset() method to clean up its state before (or >after) invoking formatBuf... > >Alberto > >At 12.21 04/10/2006 +0200, Ori Doolman wrote: > >hi, > >Anyone? > > > > > >-----Original Message----- > >From: Ori Doolman > >Sent: Tuesday, October 03, 2006 2:08 PM > >To: [email protected] > >Subject: XMLFormatter performance > > > >Hello, > > > >I wanted to know if the following code can affect my application > >performance. > > > > > > > > CMyXmlFormatTarget formatTarget(); > > > > XMLFormatter > >formatter(IP_MC_DEFAULT_ENCODING_STR, > > > > > >&formatTarget, > > > > > >XMLFormatter::StdEscapes, > > > > > >XMLFormatter::UnRep_Fail); > > > > formatter.formatBuf(U_ParamValue, > >U_ParamValueLen); > > > > > > > > > > > > > > > >My fear is that creating a new transcoder per call may take relatively >a > >long time. > > > >The problem is that XMLFormatter do not accept a pre-created transcoder > >(but always allocate a new one internally) and cannot set its > >XMLFormatTarget. > > > >Therefore, the above code is called a lot of times in my application: > > > > > > > >Regards, > > > >Ori Doolman, > > > >Sigvalue Technologies. > > > >Tel: 972-9-7615119 > > > >Fax: 972-9-7602373 > > > >
