On another machine we tried the same tests and found the code took 1680ms to run 1000 iterations. Interestingly enough we rewrote Sean's code in Java and retried the tests. From Java we could do 1000 iterations in 1265ms. The Java code is below.
import java.util.*; import java.io.*; import org.xml.sax.*; import com.allaire.wddx.*; public class STest { String xmlContent = null; WddxDeserializer deserializer = null; public STest(String filePath) throws Exception { deserializer = new WddxDeserializer("org.apache.xerces.parsers.SAXParser"); readInXML(filePath); } public static void main(String args[]) { try { if (args.length < 2) { System.out.println("Usage: alchemy.STest filepath deserializations [iterations]"); return; } int iterations = 1; if (args.length == 3) iterations = Integer.parseInt(args[2]); STest test = new STest(args[0]); for (int i=0; i<iterations; i++) { test.run(Integer.parseInt(args[1])); } } catch (Exception ex) { ex.printStackTrace(); } } private void readInXML(String filePath) throws Exception { FileReader reader = null; try { reader = new FileReader(filePath); xmlContent = ""; char[] buf = new char[512]; int read = -1; while ((read = reader.read(buf)) != -1) { xmlContent += new String(buf, 0, read); } xmlContent = xmlContent.trim(); } finally { if (reader != null) reader.close(); } } public void run(int nTimes) throws Exception { Map map = null; InputSource source = null; long start = System.currentTimeMillis(); for (int i=0; inTimes; i++) { source = new InputSource(new StringReader(xmlContent)); map = (Map)deserializer.deserialize(source); } long end = System.currentTimeMillis(); System.out.println("It took: " + (end - start) + " ms to deserialize " + nTimes + " times."); } } Matt Liotta President & CEO Montara Software, Inc. http://www.montarasoftware.com/ V: 415-577-8070 F: 415-341-8906 P: [EMAIL PROTECTED] > -----Original Message----- > From: Matt Liotta [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, July 31, 2002 10:22 AM > To: CF-Talk > Subject: RE: CFMX Taking all CPU Resources? (CODE) > > P3 866 384 RAM CFMX (2543ms) > > Using the below code on the same machine (5908ms) > > <cfparam name="URL.loop" type="numeric" default="1"/> > <cfset request.File = "c:\cfusionmx\wwwroot\test\joe.wddx"/> > <cffile action="READ" file="#request.file#" variable="temp"/> > <cfset loop = URL.loop/> <cfset request.StartTime = GetTickCount()/> > <cfloop index="i" from="1" to="#loop#"> > <cfscript> > tempDoc = XmlParse(temp); > ctemp = StructNew(); > > for(itr = 1; itr lte > ArrayLen(tempDoc.wddxpacket.data.struct.XmlChildren); itr = itr + 1) > StructInsert(ctemp, > tempDoc.wddxpacket.data.struct.var[itr].XmlAttributes.name, > tempDoc.wddxpacket.data.struct.var[itr].XmlChildren[1].XmlText); > </cfscript> > </cfloop> > <cfoutput> > #GetTickCount() - request.StartTime# ms > <cfdump label="deserialized packet" var="#ctemp#"/> > </cfoutput> > > Matt Liotta > President & CEO > Montara Software, Inc. > http://www.montarasoftware.com/ > V: 415-577-8070 > F: 415-341-8906 > P: [EMAIL PROTECTED] > > > -----Original Message----- > > From: Sean A Corfield [mailto:[EMAIL PROTECTED]] > > Sent: Wednesday, July 31, 2002 9:11 AM > > To: CF-Talk > > Subject: Re: CFMX Taking all CPU Resources? (CODE) > > > > On Tuesday, July 30, 2002, at 10:27 , Joe Eugene wrote: > > > Below are the details of the code that is running slow on CFMX. > > > > I've put together a very simple test to time wddx2cfml on various > systems. > > I don't have CF5 to run it on but hopefully some folks here will be > able > > to confirm / deny the speed differences. > > > > Two files: > > - xfile.cfm reads the WDDX packet and then times cfwddx repeatedly > > deserializing it > > - joe.wddx is Joe's WDDX (with a correction: there's a missing > </string> > > on line 34!) > > > > I tested this on a PowerMac G4 800MHz with > > http://127.0.0.1/xfile.cfm?loop= > > 1000 and it consistently executed in 4000ms. > > > > xfile.cfm: > > <!--- xfile.cfm ---> > > <cfparam name="URL.loop" type="numeric" default="1"/> > > <cfset request.File = "/home/coldfusionmx/wwwroot/bacfug/joe.wddx"/> > > <cffile action="READ" file="#request.file#" variable="temp"/> > > <cfset loop = URL.loop/> > > <cfset request.StartTime = GetTickCount()/> > > <cfloop index="i" from="1" to="#loop#"> > > <cfwddx action="wddx2cfml" input="#temp#" output="ctemp"> > > </cfloop> > > <cfoutput> > > #GetTickCount() - request.StartTime# ms > > <cfdump label="deserialized packet" var="#ctemp#"/> > > </cfoutput> > > <!--- end ---> > > > > joe.wddx: > > <wddxPacket version='1.0'><header></header><data><struct><var > > name='ALTTAG'><string>MS Commercial</string></var><var > > name='BODY'><string><P>All MS&reg; models are made in the > USA to > > the highest quality standards.</P><char code='0A'/><P>The > > MS&reg; Series grew out of our decades of experience with > > Highline<SUP>TM</SUP>, Trimline, and units combined with > the > > time-proven technologies of The Asian&reg; series. All MS&reg; > > models are made in the USA to the highest quality standards. > > </P><char > > code='0A'/><H2>Key Distinguishing Feature</H2><char > > code='0A'/><P>North America</P><char code='0A'/><TABLE > > cellSpacing=0 cellPadding=3 width="100%" border=0><char > > code='0A'/><TBODY><char code='0A'/><TR><char > code='0A'/><TD > > class=headerWhite bgColor=#ff6633>Related Links and > > Brochures:</TD></TR></TBODY></TABLE><char > > code='0A'/><P><A target=_new > > href="http://@url@/pdfs/P1903.pdf">The MS Series - Commercial > > (PDF)</A></P></string></var><var > > name='CONTENTITEMID'><string>11</string></var><var > > name='CONTENTTYPEID'><string>PMP</string></var><var > > name='DESCRIPTION'><string>MS Commercial have mechanical non-computing > > specifically designed for industrial, and fleet > > applications.</string></var><var > name='ERRORS'><string></string></var><var > > name='FILES'><string>com.jpg,P103.pdf</string></var><var > > name='KEYWORDS'><string>, industrial, fleet, north > > america</string></var><var > > name='NAVTEXT'><string>MS-Commercial</string></var><var > > name='PUBLISHDATE'><dateTime>2002-3-7T0:0:0-5:0</dateTime></var><var > > name='PUBLISHDAY'><string>07</string></var><var > > name='PUBLISHMONTH'><string>3</string></var><var > > name='PUBLISHYEAR'><string>2002</string></var><var > > name='TITLE'><string>The > > MS Series - Commercial</string></var><var > > name='UPLOADIMAGE'><string>2A2.8_MS_com.jpg</string></var><var > > name='UPLOADPDF'><string>P1903.pdf</string></var><var > > name='USERNAME'><string>abc</string></var><var > > name='VERSIONNUMBER'><number>42</number></var><var > > name='VERSIONSTATUSID'><string>PUB</string></var > > ></struct></data></wddxPacket> > > > > Sean A Corfield -- http://www.corfield.org/blog/ > > > > "If you're not annoying somebody, you're not really alive." > > -- Margaret Atwood > > > > > ______________________________________________________________________ This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists