Groups | Blog | Home
all groups > macromedia flash flash remoting > may 2004 >

macromedia flash flash remoting : AMF vs XML file size


itdotcom
5/12/2004 8:27:17 PM
I have been led to believe that use of the AMF format would result in smaller
file sizes being transferred from server to client than XML.

However, in my 'real world' testing, I have found quite the opposite to be
true. XML=95k, AMF=302k!

What am I missing? Have I done something wrong? Or, is this a bogus claim made
by some...

In both examples I used the same CF query, but one returning XML, the other a
RS. (See the below code)

RS:
<cfcomponent>

<cffunction name="get_branch_list" returnType="query"
access="remote">

<cfquery name="rsLocations"
datasource="apex_production">

SELECT tbl_master.master_id,
concat(tbl_master.locationID,tbl_master.year,'-',tbl_master.increment) AS
project_number, tbl_master.projectName, tbl_billing.report_id FROM
tbl_master,tbl_service_order,tbl_billing WHERE tbl_master.locationID=2 AND
tbl_service_order.master_id=tbl_master.master_id AND
UNIX_TIMESTAMP(tbl_service_order.dispatchDate) BETWEEN 0 AND
UNIX_TIMESTAMP(current_date) AND
tbl_service_order.serviceOrderID=tbl_billing.service_order_id GROUP BY
project_number,tbl_billing.report_id ORDER BY project_number
DESC,tbl_billing.report_id DESC </cfquery>

<cfreturn rsLocations>

</cffunction>

</cfcomponent>

XML:
<!--- Any parameters in the URL? --->

<cfparam name="URL.user">

<cfparam name="URL.pwd">

<cfparam name="URL.locationid">

<cfparam name="URL.start_date">



<!--- Query the database --->

<CFQUERY NAME="getProjects" DATASOURCE="apex_production" USERNAME="#URL.user#"
PASSWORD="#URL.pwd#">

SELECT

tbl_master.master_id,


concat(tbl_master.locationID,tbl_master.year,'-',tbl_master.increment) AS
project_number,

tbl_master.projectName,

tbl_billing.report_id

FROM tbl_master,tbl_service_order,tbl_billing

WHERE

tbl_master.locationID=#URL.locationid#

AND tbl_service_order.master_id=tbl_master.master_id

AND UNIX_TIMESTAMP(tbl_service_order.dispatchDate)
BETWEEN UNIX_TIMESTAMP(#URL.start_date#) AND UNIX_TIMESTAMP(current_date)

AND
tbl_service_order.serviceOrderID=tbl_billing.service_order_id

GROUP BY project_number,tbl_billing.report_id

ORDER BY project_number DESC,tbl_billing.report_id DESC

</CFQUERY>



<!--- Compose XML document --->

<cfxml variable="myXML">

<queryResults>

<!--- For each project returned... --->

<CFOUTPUT QUERY="getProjects" GROUP="master_id"><p
label="#ToString(project_number)# - #projectName#"><!--- For each report within
the project... ---><CFOUTPUT><r label="#report_id#"></r></CFOUTPUT></p>

</CFOUTPUT>

</queryResults>

</cfxml>



<!--- Omit debug info, and anything not in <CFOUTPUT> blocks --->

<cfsetting showdebugoutput="No" enablecfoutputonly="Yes">



<!--- Set the MIME content-type of our response to "text/xml" --->

<cfcontent pe="text/xml" reset="yes">



<!--- Output the XML code --->

<cfoutput>#ToString(myXML)#</cfoutput>


Stephen Rogers
6/10/2004 4:25:58 AM
Here is the only testing research that I've seen.

http://www.flashorb.com/articles/soap_vs_flash_remoting_benchmark.shtml

Remoting is the way to go if you know what you're doing.
AddThis Social Bookmark Button