Inside MSXML Performance(MSXML性能分析) (5) (转)

Inside MSXML Performance(MSXML性能分析) (5) (转)[@more@]

SaveXML:namespace prefix = o ns = "urn:schemas-microsoft-com:Office:office" />

保存

Saving a document is generally slower than loading one. The following table summarizes the differences:

保存一个文档总的来说要比载入慢。下面的表格显示了其中的区别:

Sample
样本

Load (milliseconds)
载入(毫秒)

Save (milliseconds)
保存(毫秒)

Difference (percentage)
差别(百分比)

Ado.xml

677

1,441

113

Hamlet.xml

104

184

77

Ot.xml

1,063

1,971

85

Northwind.xml

62

103

66

When saving each sample, the worst case is the attribute-heavy ADO Recordset, which is more than twice as slow as loading it into memory. Given that it seems perfectly reasonable to expect a write operation to be slower than a read operation, these numbers are rather good. But be careful. You can easily strain the file system if you are loading and saving lots of small XML documents, as shown in the section "Free-Threaded Documents."

当保存每一个样本文件时,最糟糕的情况发生在属性比重大的ADO Recordset文件上,它写入时间比载入内存要慢两倍。由于一般认为写操作比读操作慢一些是很合理的,所以以上数字大家都可以接受。但是请注意,如果你载入并保存很多小的XML文档,文件系统很可能会受到影响,正如在“自由线程文档”将要讨论的那样。

Namespaces

名字空间

XML Namespaces also add some overhead in XML parsing time, but not as much as you might think. I have two versions of the Ado.xml example. One uses a namespace prefix "recordset:" on all 2,347 rows, and one does not. The following table shows the difference in load time:

XML名字空间也增加了一些XML解析时的开销,但是并不如你想象得那么多。这里有两个版本的Ado.xml示例。其中一个在2,347行中都使用了“recordset:”前缀,而另一个没有。下面的表格显示了它们在载入时间上的不同:

Measurement
度量

Ado.xml

Ado-ns.xml

Difference (percentage)
差别(百分比)

File size
文件大小

1,007,214

1,030,651

2.3

Load time (milliseconds)
载入时间(毫秒)

662

680

2.7

Most of the difference in load time can be explained by the increase in file size.

Free-Threaded Documents

自由线程文档

A "free-threaded" dom document (CLSID_DOMFreeThreadedDocument, "Microsoft.FreeThreadedXMLDOM") exposes the same interface as the "rental" threaded document (IID_IXMLDOMDocument). This object can be safely shared across any thread in the same process.

自由线程DOM文档(CLSID_DOMFreeThreadedDocument, "Microsoft.FreeThreadedXMLDOM")提供了租用线程文档(IID_IXMLDOMDocument)相同的接口。这个对象可以安全的在同一进程中的任意线程间共享。

Free-threaded documents are generally slower than rental documents because of the extra thread safety work they do. You use them when you want to share a document among multiple threads at the same time, avoiding the need for each of those threads to load up their own copy. In some scenarios, this can result in a big win that outweighs the cost of the extra thread safety work.

自由线程文档一般比租用线程文档要慢,因为它要为线程安全性增加开销。如果你想要同时在多个线程中共享文档,可以使用它,以避免在每个线程都要载入自己的拷贝。在某些情况下,这会大大提高性能,即使在线程安全性上有额外的开销。

For example, suppose you have a 2-KB XML file on your web server, and you have a simple ASP page that loads that file, increments an attribute inside the file, and saves the file again.

例如,假设在你的Web服务器上有一个2KB的XML文件,还有一个简单的ASP页面要载入这个文件,在文件中加入一个属性,然后将它保存。

jscript %>

Response.Expires = -1;

var filename = Server.MapPath("simple.xml");

Application.Lock();

var doc = Server.CreateObject("Microsoft.XMLDOM");

doc.async = false;

doc.load(filename);

var c = parseInt(doc.documentElement.getAttribute("count"))+1;

doc.documentElement.setAttribute("count",c);

doc.save(filename);

Application.UnLock();

%>

This ASP code will be completely disk I/O bound. On my Pentium II 450-MHz dual-processor computer, I was not able to get any more than 50 percent cpu utilization. The disk was making a lot of noise.

这段ASP代码会极大的占用磁盘读写通道。在我的Pentium II 450-MHz双处理器的机器上,我不能得到50%以上的CPU使用率。

However, we could bring the file into shared-application state using a free-threaded DOM document, as follows:

但是,我们可以运用自由线程DOM文档将文件可以进行共享,代码如下:

Response.Expires = -1;

var doc = Application("shared");

if (doc == null)

{

  doc = Server.CreateObject("Microsoft.FreeThreadedXMLDOM");

  doc.async = false;

  doc.load(Server.MapPath("simple.xml"));

  Application("shared") = doc;

}

Application.Lock();

var c = parseInt(doc.documentElement.getAttribute("count"))+1;

doc.documentElement.setAttribute("count",c);

Application.UnLock();

 

%>

Then we would see the throughput jump dramatically:

这样,我们可以看到吞吐量剧烈的飞跃:

Method
方法

Requests/second
请求/秒

Load/Save
载入/保存

34

Shared
共享

250

In other words, this second approach using the free-threaded DOM document is seven times faster than the other!

可以说,使用了自由线程DOM文档的第二种方法比第一种方法快7倍。

Delayed Memory Cleanup

延迟的内存释放

The one downside to the free-threaded model is that it exhibits more latency in how it cleans up unused memory, affecting the performance of subsequent operations. (Some people report this as a memory leak when in fact it is just delayed cleanup.) The larger the XML document, the more pronounced the latency. The following table shows the increase in load time and working set when using the free-threaded document as opposed to the rental document:

自由线程模式的一个不足是它在释放不使用的内存空间时会有延迟,这影响了后续操作的性能。(有些人将这个现象报告为内存泄漏,事实上,它只是延迟释放内存而已。)XML文档越大,延迟就越显著。下面的表格中显示了使用自由线程同使用租用模式在载入时间和工作空间上的增量:

Sample
样本

Load time (percentage increase)
载入时间(增量百分比)

Working set (percentage increase)
工作空间(增量百分比)

Ado.xml

4

137

Hamlet.xml

23

83

Ot.xml

1

53

Northwind.xml

2

42

These results show that the worst case is when you have many nodes (as in Ado.xml), which makes sense because this generates more memory for the memory manager to clean up. Note that the benefits of being able to share the same document object across threads, as shown above, still outweigh the downside of slower load time and a larger working set.

上述结果表明最坏情况发生在有许多节点的文档上(就像在Ado.xml中的情况)。请注意,能够在线程间共享文档的益处,如上文所示,仍然超过它在载入时间和工作空间上的不利影响。

Virtual Memory

虚拟内存

In the free-threaded model, the working set can spike if you generate enormous amounts of memory for the memory manager to clean up—which can happen when perfoRming xsl transformations on large documents. In this case, you will use up all available memory and strain the virtual memory manager, causing the performance to dramatically decrease. Watch the peak working set of your application under a heavy load to make sure this doesn't happen. If it does, redesign your application by breaking the XML down into smaller chunks. This situation has been improved somewhat in the MSXML January 2000 Web Release. In fact, we got the following reader comment on the January 2000 Web Release page:

在自由线程模式中,工作空间会大大增加,如果你产生了很多需要内存管理去释放的内存,这在进行大文档的XSL转换时会发生。在这种情况下,你会将可用的内存资源用尽,并频繁调用虚存管理器,性能也就急剧下降。你可以通过观察高负荷情况下应用程序的峰值工作空间来确定这种现象不会发生。如果发生了,可将XML拆开成小块,重新设计你的应用程序。这种情况在MSXML January 2000 Web Release中有了些改进。事实上,我们从中得到以下读者评论:

Faster!

更快!

I've done a couple of informal speed trials on server-side transforms (XML to HTML via XSL), and noticed that there's a big improvement.

我做了一些非正式的服务器端转换(通过XSL将XML转换到HTML)速度测试,发现有了巨大的改进。

-  Anonymous 9-Feb-2000

-  匿名 2-9,2000

IDispatch

IDispatch

Late-bound scripting languages, such as JScript and vbscript, add a lot of overhead to each method call and property access in the DOM interface. The script engines actually invoke the methods and properties indirectly through the IDispatch interface. First, both script engines call GetIDsOfNames or GetDispID, which will pass in a string name for the method or property and return a DISPID. Then the engines package all the arguments into an array and call Invoke with the DISPID.

晚绑定(late-bound)脚本语言,如JScirpt和VBScirpt,在每次DOM接口的方法调用和属性访问时增加了许多开销。脚本引擎实际上是通过IDispatch接口间接调用方法和属性的。首先,脚本引擎调用GetIDsOfNames或者GetDispID,传入方法和属性名字符串,返回一个DISPID。然后引擎将所有的参数打包到一个数组并以DISPID调用Invoke。

Need I say more? Clearly, this is going to be slower than calling a virtual function in C++ or compiled Visual Basic. Visual Basic is a bit tricky, though, because you can actually do both styles of programming in one application. For example:

需要更多信息?显然,这会比调用C++虚函数或编译的Visual Basic要慢。但是Visual Basic复杂一些,因为你可以在一个应用程序中使用两种编程方式。例如:

  Dim doc as Object

  set doc = CreateObject("Microsoft.XMLDOM")

  ...

This is late-bound and will be as slow as VBScript or JScript. To speed this up, from the Project menu, select References and add a reference to the latest version of the "Microsoft XML" library. Then you can write the following early-bound code:

这是晚绑定的,会和VBScript和Jscript一样慢。为了提高速度,按Project菜单,选择References并加入最新版的“Microsoft XML”库。然后你可以写以下早绑定代码:

  Dim doc As New MSXML.DOMDocument

  ...

The other advantage of programming this way is that you'll get all sorts of helpful drop-down lists of available methods and their arguments from Visual Basic.

这种编程方式的另一个优点是你可以在Visual Basic中在下拉列表中得到各种方法名等帮助信息。


来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/10752043/viewspace-991708/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/10752043/viewspace-991708/

基于MediaPipe的智能俯卧撑计数与姿势矫正系统 在现代健身和体能训练中,俯卧撑是最基础也是最有效的自重训练动作之一。然而,许多人在进行俯卧撑训练时常常存在姿势不正确、计数不准确等问题。本文将介绍如何利用计算机视觉和姿态估计技术,开发一个智能的俯卧撑计数与姿势矫正系统。 阅读详情

相关推荐

华大HC32F460 ADC+DMA高效数据采集实战解析

本文深入解析了华大HC32F460微控制器中ADC与DMA协同工作的高效数据采集方案。通过实战代码演示,详细阐述了如何配置硬件触发、序列扫描及AOS事件联动,实现后台自动采集,从而解放CPU资源,提升系统实时性与可靠性,适用于传感器数据采集、音频处理等多种场景。

weixin_29189373的博客 184

Inside MSXML Performance(MSXML性能分析)

Inside MSXML PerformanceMSXML性能分析Chris Lovett Microsoft CorporationFebruary 21, 2000Download the source code for this article (1.17MB)下载本文中示例的源代码ContentsMetricsMSXML FeaturesWorking SetM

ayusay的专栏 1240

python123题目——摩尔斯电码转换

类型:列表元组。

m0_62488776的博客 4442

Inside MSXML Performance(MSXML性能分析) (3)

MSXML FeaturesMSXML特点Next, lets examine some important scenarios associated with the Document Object Model (DOM)—including loading, saving, walking a DOM tree, and creating a new DOM tree in memo

ayusay的专栏 1150

GOM Correlate拉伸试验后处理操作

本文描述了使用GOM Software 2022对拉伸试样进行后处理的操作,包括设置检测点、引伸计、输出应变数据到表格、输出报告为视频等

qq_45008924的博客 4683

内网Linux服务器离线安装python包

3、将下载的依赖包和requirements.txt 拷贝到内网主机,依赖包和requirements.txt放同一级目录,进入该目录,运行指令。其实还有个更加方便的办法,联网主机装个与内网主机一样环境的虚拟机,在虚拟机中下载py包,拷贝到内网主机后就能直接安装了,省去手动下载py包的步骤。简单记录下最近遇到的一个小问题,内网主机没有内网源,处于无互联网状态,安装python包只能通过联网主机下载好后拷贝到内网主机。由于内网主机安装了多个版本的python,为了防止搞错,使用这种方式来调用pip安装。

cyc头发还挺多的博客 657

Inside MSXML Performance(MSXML性能分析) (7)

小结The XML team at Microsoft has done some great work to improve the performance of the MSXML parser over the last three releases. They made a major improvement to the scalability of MSXML for the Wi

ayusay的专栏 1072

LTM4644 四通道并联 16A 输出配置:PCB 布局 3 要点与热仿真验证

本文详细解析了LTM4644四通道并联实现16A输出的PCB布局与热管理要点,包括电流路径对称性设计、热优化布局技巧和接地系统优化。通过实际工程案例,展示了如何确保电流均流、热分布均衡及长期可靠性,为FPGA、ASIC和服务器主板供电设计提供高效解决方案。

weixin_33314040的博客 404

Inside MSXML Performance(MSXML性能分析) (6)

Validation验证Validation compares the types of elements in an XML document against a Document Type Definition (DTD) or XML Schema. For example, the DTD may say that all "Customer" elements must cont

ayusay的专栏 1002

Windows系统监控实战:Grafana+Prometheus+node_exporter保姆级配置指南(含常见问题解决)

本文提供了一份详尽的Windows系统监控实战指南,详细讲解了如何从零部署Grafana、Prometheus和node_exporter(实际为windows_exporter)监控栈。内容涵盖核心组件认知、分步配置解析、高级生产环境考量,并重点针对配置过程中常见的“No Data”问题提供了系统性的排查手册,旨在帮助用户快速搭建稳定可靠的系统资源监控平台。

weixin_29197835的博客 1016

BACnet协议栈基本对象BI、BO、AI、AO、AV以及device和File对象介绍

BACnet协议栈基本对象BI、BO、AI、AO、AV以及device和File对象介绍

shufawangzhang的博客 3994

Inside MSXML Performance(MSXML性能分析) (2)

Metrics度量指标There are four key performance metrics that most of you are interested in as you develop your XML-based Web application: 当开发基于XML的Web应用程序时,大部分人对以下四个主要的性能度量指标感兴趣:·                  

ayusay的专栏 968

【知识分享】IBIS 建模指南 03

本文介绍了差分缓冲器的数据提取方法,重点分析了差分系统与单端系统的核心差异。文章详细阐述了差分接收机和驱动器的结构特点、工作原理及建模方法,指出全差分结构具有优异的电源噪声抑制能力。针对IBIS建模规范,作者提出了三维I-V曲面数据提取技术,并介绍了共模/差模电流分离、片上端接处理以及V-T表生成的解决方案。文章还探讨了差分电容(C_diff)的测量方法和数据简化策略,为复杂差分缓冲器的精确建模提供了系统化的技术路径。

一只豌豆象的博客 1285

Inside MSXML Performance(MSXML性能分析) (7) (转)

Inside MSXML Performance(MSXML性能分析) (7) (转)[@more@] ...

csd3176的博客 118

win10 跳过U8环境检测的IE WebControls.rar

win10 安装u8的时候 提示IE WebControls 不通过,这个工具可以欺骗u8的检查。 跳过U8环境检测的IE WebControls。提示导入失败后,重新检测通过。

LinePhone3.2.7(android端最新版本) sip客户端

SIP客户端For android:LinePhone3.2.7(最新版本),官网地址:http://www.linphone.org/

Inside MSXML Performance(MSXML性能分析) (3) (转)

Inside MSXML Performance(MSXML性能分析) (3) (转)[@more@]MSXML Featuresmicrosoft-com:Office:office" /> MSXML特点 Next...

csd3176的博客 143

大中型超市收银系统(可直接运行)

光步前台收银系统系统功能:商品销售、商品退货、挂单、收银员权限、会员销售、单品取消、整单取消、商品查询、脱机销售、脱机数据上传,基本资料下载,开钱箱、小票打印、收款结算,支持多币种付款方式(现金、储值卡、礼券、微信等),支持多种促销。运行环境:.net 4.0登陆信息用户名:1001 密码:123456内置商品信息,商品编码可输入00001000 - 00010000,测试效果相关功能键F5 结算 F9挂单 F11商品查询 F8退货 Insert单品取消 Del整单取消 F12开钱箱F2 会员 Ctrl+Z退出系统 Home 锁屏 相关源码待公开

Inside MSXML Performance(MSXML性能分析) (转)

Inside MSXML Performance(MSXML性能分析) (转)[@more@]XML02212000>Inside MSXML Performancemicrosoft-com:Office:office"...

csd3176的博客 128

visio安装包

Microsoft Office Visio 是一款专业的制图软件。利用经过更新的形状、协作工具和数据链接图表,创建专业级图表以简化复杂的信息。

Inside MSXML Performance(MSXML性能分析) (6) (转)

Inside MSXML Performance(MSXML性能分析) (6) (转)[@more@]ValidationXML:namespace prefix = o ns = "urn:schemas-microsoft-...

csd3176的博客 174

Inside MSXML Performance(MSXML性能分析) (4)

First DOM Walk Working Set Delta第一次DOM树遍历引起的工作空间增量Walking the DOM tree for the first time has an impact on the working set metric because some nodes in the tree are created on demand. To illustrat

ayusay的专栏 1240

Inside MSXML Performance(MSXML性能分析) (2) (转)

Inside MSXML Performance(MSXML性能分析) (2) (转)[@more@]MetricsXML:namespace prefix = o ns = "urn:schemas-microsoft-com...

csd3176的博客 142

Inside MSXML Performance(MSXML性能分析) (4) (转)

Inside MSXML Performance(MSXML性能分析) (4) (转)[@more@]First dom Walk Working Set DeltaXML:namespace prefix = o ns = "...

csd3176的博客 119

Inside MSXML Performance(MSXML性能分析) (5)

Save保存Saving a document is generally slower than loading one. The following table summarizes the differences:保存一个文档总的来说要比载入慢。下面的表格显示了其中的区别:Sample样本Load (milliseconds)载入(毫秒)Save

ayusay的专栏 1081

鸿蒙 PC 适配:把 wxFormBuilder 的设计器引擎做成可安装应用

传统 C++ 桌面框架的鸿蒙适配,难点不在业务代码,而在「界面层拿不到」这件事。把模型与生成逻辑从 GUI 里剥出来,配合一层类型替身,能让大部分上游代码原样编译;代价是设计器界面需要另写。。

2202_76097976的博客 5711

C++性能分析完全指南:从perf、cachegrind到VTune的工程化性能调优(萍水相逢)

本文以一次“差点被开除”的性能优化教训为引,系统讲解性能分析的核心方法论与实战工具。强调“不要猜、先测量、改一处测一次”的铁律,梳理CPU、I/O、内存密集型问题的识别与应对策略。重点介绍perf(采样、统计、火焰图)、gprof、cachegrind、sanitizer及google/benchmark等工具的使用,结合真实案例展示如何精准定位热点、避免盲目优化。最后提供从诊断到调优的完整流程,助力开发者用数据驱动性能提升,实现高效、可靠的代码优化。

瑶池酒剑仙的博客 284

C++语言原理与实践(十四):stack,queue和priority_queue的底层实现

适配器是一种设计模式,它将已有类的接口转换成使用者需要的另一种接口。stack:后进先出。queue:先进先出。要实现这些规则,可以利用已有容器保存元素,再把底层容器的接口包装成栈、队列的接口。pop_back();push();pop();根据栈或队列的规则,将外层操作转换为底层容器的相应操作。例如,同样是调用pop()stack 将其转换为底层容器的pop_back()。queue 将其转换为底层容器的。我们将要实现的stack和queue所使用的容器适配器就说deque!

2502_93841997的博客 310

开源鸿蒙PC适配教程:把小熊猫C++(RedPanda-CPP)搬到鸿蒙桌面端

小熊猫C++(RedPanda-CPP)是一个用 C++17 和 Qt Widgets 写的轻量 C/C++ IDE,自带词法分析、预处理、补全、编译运行和 GDB 调试。本项目把它迁移到鸿蒙 PC,目标不是“能打开一个窗口”,而是让编辑、文件工作流、符号索引、补全和导航在鸿蒙桌面端真正可用。项目选择保留与 UI 解耦的上游解析器,用 ArkUI 重建外壳,这样工作量可控,解析器行为也不会和桌面版分叉。这样解析器看到的是“展开后的真实代码”,不会把。,先编译,看链接器缺什么,再只补缺失的声明和最少实现。

忆~遂愿的博客 6716

【Linux网络】HTTP 服务器怎么返回网页和图片?从 404、301 到 Content-Type 与静态资源完整实战

本文实现了一个简易HTTP服务器,重点解决请求解析、资源映射与响应构造问题。基于C++17与POSIX Socket,在Linux环境下验证了首页、图片、404、301、GET/POST等场景。通过Content-Length与\r\n\r\n识别报文边界,使用stat获取文件大小,根据后缀自动设置Content-Type,确保浏览器正确解析静态资源。代码无第三方依赖,强调状态码语义一致性与响应完整性,为理解HTTP核心机制提供实践基础。

2402_87731470的博客 1259
上一篇: 选择:J2EE还是.NET,这是一个问题 (转)
下一篇: The Ultimate (DLL) Header File (转)
csd3176
博客等级 码龄11年 20粉丝 0原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符  | 博主筛选后可见
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值