使用Coldfusion或Java压缩文件的最有效方法 [英] most efficient way to zip files using coldfusion or java

查看:103
本文介绍了使用Coldfusion或Java压缩文件的最有效方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找使用ColdFusion或Java压缩许多大型文件的内存效率最高的方法.我尝试使用Nate Nielsen(zip.cfc可以更多地使用锯齿"式内存.

I'm looking for the most memory efficient way to zip many large files using ColdFusion or Java. I have tried using <cfzip> and using zip.cfc by Nate Nielsen (http://farmancreative.com/womenskiteboarding/admin/dccom/components/dcFileManagerV3/actions/cfc/zip.cfc). For the tests I zipped up a directory that contains 80 mp4 files totaling 1.18GB. The results are below. I could not tell a difference at all when the <cfzip> tag was running, the normal "steps" of ColdFusion appeared unchanged. But with zip.cfc it was more "saw tooth" memory usage.

所以我的问题是,哪个结果更好?还是有我不知道的另一种新方法比这两种方法都更好?

我更关心内存使用而不是速度.但就速度而言,<cfzip>快一点. <cfzip>时间是100,871. zip.cfc时间是141,285.

I care more about memory usage than speed. But as far as speed goes, <cfzip> was a little faster. <cfzip> time was 100,871. zip.cfc time was 141,285.

谢谢!

<cfzip>测试代码:

<cfoutput>
    <cfset tBegin = GetTickCount()>
    <cfzip
        action="zip"
        source="#dir#"
        file="#zipFile#"
        storepath="false"
        overwrite="true"
        />
    <cfset tEnd = GetTickCount()>
    <cfset scriptTime = (tEnd - tBegin)>
    Script Time: #scriptTime#
</cfoutput>

zip.cfc测试代码:

<cfdirectory directory="#dir#" name="d" recurse="false">
<cfoutput>
    <cfset tBegin = GetTickCount()>
    <cfset zipper = createObject("component", "zip")>
    <cfscript>zipper.newZip(zipFile);</cfscript>
    <cfloop query="d">
        <cfset zipper.addFile(dir&d.name)>
    </cfloop>
    <cfscript>zipper.createZip();</cfscript>
    <cfset tEnd = GetTickCount()>
    <cfset scriptTime = (tEnd - tBegin)>
    Script Time: #scriptTime#
</cfoutput>

推荐答案

我必须运行,所以现在不能输入太多内容,但明天会再讲.这是针对实际文件类型(.txt,.ppt,.doc,.swf等)运行后的测试结果.看起来<cfzip>zip.cfc好得多.

I have to run so can't type much right now but will come back to this tomorrow. Here are my test results after running it against real world file types (.txt, .ppt, .doc, .swf, etc...). Looks like <cfzip> is much better than zip.cfc.

这篇关于使用Coldfusion或Java压缩文件的最有效方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆