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

MINI PCIE接口设计要点: 3.3Vaux(5pins):3.3V电源。PERST#信号通过外接复位电路,可实现模块复位。模块可以通过硬件方式或软件方式关闭射频通信(不包括 GNSS)。LED_WWAN#:(O)漏极开漏,低有效。:(I)低激活系统禁止射频信号(飞行模式),因此需加上拉。UIM_PWR (1 pin):(O)UIM的电源输出。SMB_DATA:SMBus2.0数据信号线。UIM_VPP:(O)A类设备的可变电源电压。SMB_CLK:SMBus2.0时钟信号线。UIM_RESET:(O)UIM的复位信号。 阅读详情

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 contain a child "Name" element. Take a look at the DTD for Hamlet.xml (hamletdtd.htm) and the XML Schema for Hamlet.xml (hamletschema.htm).

验证是指按照文档类型定义(DTD)或者XML Schema来检查XML文档中的元素类型。例如,DTD中规定所有“Customer”元素必须包含一个“Name”子元素。可以看一下Hamlet.xml的DTD(hamletdtd.htm)和Hamlet.xml的XML Schema(hamletschema.htm)[SL1] 。

Validation is another huge area for performance analysis, but I only have time for a brief mention today. Validation is expensive for several reasons. First, it involves loading a separate file (the DTD or XML Schema) and compiling it. Second, it requires state machinery for performing the validation itself. Third, when the schema also includes information about data types, any data types also have to be validated. For example, if an XML element or attribute is typed as an integer, that text has to be parsed to see if it is a valid integer.

验证是性能分析的另一大领域,但是这里只有一个比较简单的讨论。由于很多原因,验证的代价是很大的。首先,它牵涉到另一个单独的文件(DTD或者XML Schema)需要载入。第二,它需要状态机(state machinery)配合进行验证。第三,如果Schema包含了数据类型的信息,那么所有数据类型都必须经过验证。例如,如果一个XML元素或类型被定为整型,那么相应的文本必须经过解析来查看它是否是一个合法的整型。

The following table shows the difference between loading without validation, with DTD validation, and with XML Schema validation.

下表中显示了载入时没有验证,有DTD验证和有XML Schema验证的不同情况:

Sample
样本

Load (milliseconds)
载入(毫秒)

DTD (milliseconds)
DTD
(毫秒)

Schema (milliseconds)
Schema
(毫秒)

Schema plus datatypes (milliseconds)
Schema
并有数据类型检验(毫秒)

Ado.xml

662

2,230

2,167

3064

Hamlet.xml

106

215

220

N/A

Ot.xml

1,069

2,168

2,193

N/A

Northwind.xml

64

123

127

N/A

The bottom line is to expect validation to double or triple the time it takes to load your documents. New to MSXML January 2000 Web Release is a SchemaCollection object, which allows you to load the XML Schema once and then share it across your documents for validation. This will be discussed in a future article.

最起码,验证可能会使载入文档的时间增加两倍或三倍。MSXML January 2000 Web Release中新增加了SchemaCollection对象,它能够使得XML Schema只需载入一次,并能在各文档验证时共享。这将在以后的文章中讨论。

XSL

XSL can be a big performance win over using DOM code for generating "transformed" reports from an XML document. For example, suppose you wanted to print out all the speeches by Hamlet in the sample Hamlet.xml. You might use selectNodes to find all the speeches by Hamlet, then use another selectNodes call to iterate through the lines of each of those speeches, as follows:

XSL在性能上大大优于使用DOM代码去转化XML文档。例如,假设你想要打印出Hamlet.xml中哈姆雷特所有的话。你可能会用selectNodes来查找所有哈姆雷特的话,然后使用另一个selectNodes来查找这些话中的每一行,代码如下:

function Method1(doc)

{

    var speeches = doc.selectNodes("/PLAY/ACT/SCENE/SPEECH[SPEAKER='HAMLET']");

    var s = speeches.nextNode();

    var out = "";

    while (s)

    {

        var lines = s.selectNodes("LINE");

        var line = lines.nextNode();

        while (line)

        {

            out += line.text;

            line = lines.nextNode();

        }

        out += "<hr>";

        s = speeches.nextNode();

    }

    return out;

}

This works, but it takes about 1,500 milliseconds. A better way to tackle this problem is to use XSL. The following XSL style sheet (or template) does exactly the same thing:

这能够达到目的,但是会花大概1,500毫秒。一个更好的处理这个问题的方式是使用XSL。以下的XSL样式表(或者模板)可以完成同样的任务:

<xsl:template xmlns:xsl="http://www.w3.org/TR/WD-xsl">

  <xsl:for-each select="/PLAY/ACT/SCENE/SPEECH[SPEAKER='HAMLET']">

    <xsl:for-each select="LINE">

        <xsl:value-of/>

    </xsl:for-each>

    <hr/>

  </xsl:for-each>

</xsl:template>

You can then write the following simpler script code that uses this template:

你可以使用该模板写以下简单的脚本代码:

function Method2(doc)

{

    var xsl = new ActiveXObject("Microsoft.XMLDOM");

    xsl.async = false;

    xsl.load("hamlet.xsl");

    return doc.transformNode(xsl)

}

This takes only 203 milliseconds—it is more than seven times faster. This is a rather compelling reason to use XSL. In addition, it is easier to update the XSL template than it is to rewrite your code every time you want to get a different report.

这只需203毫秒就可以了——比前面的方法快7倍以上。这也是为什么要使用XSL的有力理由。而且,如果你想要得到不同的报告,改写XSL模板比改写你的代码要容易得多。

The problem is that XSL is very powerful. You have a lot of rope with which to hang yourself, so to speak. XSL has a rich expression language that can be used to walk all over the document in any order. It is highly recursive, and the MSXML parser includes script support for added extensibility. Using all these features with reckless abandon will result in slow XSL style sheets. The following sections describe a few specific traps to watch out for.

问题是XSL太强大了。所以你可以用很多方法来处理问题。XSL有很丰富的表达语言让你以任何次序来遍历文档。它是高度递归的,而且MSXML解析器增加了对扩展性的脚本支持。滥用这些功能会导致效率很低的XSL样式表。以下几个部分会讨论一些必须注意的陷阱。

Scripting

脚本

It is convenient to call script from within an XSL style sheet, and it is a great extensibility mechanism. But as always, there is a catch. Script code is slow. For purposes of illustration, imagine that we wrote the following style sheet instead of the one shown previously:

在XSL样式表中可以很方便的调用脚本,这提供了很好的扩展性能。但是它总是带来性能上的损失。脚本代码的执行速度比较慢。为了说明这一点,我们改写前面的样式表如下:

<xsl:template xmlns:xsl="http://www.w3.org/TR/WD-xsl">

  <xsl:for-each select="/PLAY/ACT/SCENE/SPEECH[SPEAKER='HAMLET']">

    <xsl:eval>this.text</xsl:eval>

    <hr/>

  </xsl:for-each>

</xsl:template>

 

This produces the same result, but it takes 266 milliseconds instead of 203 milliseconds—a whopping 23 percent slower. The more frequently your xsl:eval statements are executed, the slower the performance becomes. For purposes of illustration only, lets move the xsl:eval inside the inner for-each loop:

这产生相同的结果,但执行需要266毫秒而不是203毫秒了,慢了整整23%。你越经常执行xsl:eval语句,性能下降就越明显。为了说明这一点,将xsl:eval移到内层for-each循环中:

    <xsl:for-each select="LINE">

        <xsl:eval>this.text</xsl:eval>

    </xsl:for-each>

This one takes 516 milliseconds, more than twice as slow. The bottom line is to be careful with script code in XSL.

这个代码的执行速度为516毫秒,比原先慢了2倍。所以,你应该对XSL中的脚本代码小心使用。

The Dreaded "//" Operator

令人担心的“//”运算符

Watch out for the "//" operator. This little operator walks the entire subtree looking for matches. Developers use it more than they should just because they are too lazy to type in the full path. (I catch myself using it all the time, too.) For example, try switching the select statement in the previous example to the following:

小心“//”运算符。这个小小的运算符会遍历整个子树来进行查找匹配。开发者经常在不必要的情况下使用它,只是因为他们懒得打入完整路径。(我发现我也总是使用它。)例如,将前面例中的select语句改写如下:

  <xsl:for-each select="//SPEECH[SPEAKER='HAMLET']">

The time it takes to perform the selection jumps from 203 milliseconds to 234 milliseconds. My laziness just cost me a 15 percent tax.

这次,它的执行时间从203毫秒升至234毫秒。我的懒惰造成了15%的损失。

Prune the Search Tree

精简查找树

If there's anything you can do to "prune" the search tree, by all means do it. For example, suppose you were reporting all speeches by Bernardo from Hamlet.xml. All Bernardo's speeches happen to be in Act I. If you already knew this, you could skip the entire search of Act II through Act V. The following shows what the new select statement would look like:

如果你有任何方法可以“精简”查找树,那就尽力去做。例如,假设你想查找Hamle.xml中所有Bernardo的话。而所有他的话都在第一幕中。如果你已经知道这一点了,你就应该跳过查找第二至第四幕。以下是新的select语句:

select="/PLAY/ACT[TITLE='ACT I']/SCENE/SPEECH[SPEAKER='BERNARDO']"

This chops the time down from 141 milliseconds to 125 milliseconds, a healthy 11 percent improvement.

这使得运行时间从141毫秒降低到125毫秒,整整提高了11%性能。

Cross-Threading Models

跨线程模式

Before, the transformNode and transformNodeToObject methods required that the threading model of the style sheet and that of the document being transformed be the same. In the MSXML January 2000 Web Release, you can use free-threaded style sheets on rental documents and vice versa. This means you can get the performance benefit of using rental documents at the same time as the performance win of sharing free-threaded style sheets across threads.

以前,transformNode和transformNodeToObject方法要求样式表和被转换文档的线程模式必须相同。在MSXML January 2000 Web Release中,你可以在租用模式的文档上使用自由线程的样式表,也可以反过来。这意味着你可以在得到租用文档的性能优势的同时享受自由线程模式的样式表在各线程之中共享的性能提升。

Conclusion


 [SL1]Since the link is not available, we can omit this sentence

Wafer的T7 Code是什么,怎么来的 在半导体Cim系统中,waferstart 业务需要支持 Sorter 读取 Wafer 的 T7 Code,与 MES 的 Wafer ID 进行绑定,以便向 前追溯 Wafer 历史,那么问题来了,T7code 是什么Wafer的T7 Code是一种,用于标识双面抛光的晶圆。这种标记采用二维矩阵代码符号,适用于各种尺寸的晶圆,不仅限于450mm无缺口晶圆7。T7 Code是衬底来料背面通常会有的供应商刻的追溯ID,这是一串数字和字母组成的流水码。 阅读详情

相关推荐

别再手动上传了!用宝塔面板的‘Let‘s Encrypt’免费SSL证书,3分钟自动续期

本文详细介绍了如何利用宝塔面板的‘Let‘s Encrypt’功能实现SSL证书的自动申请和续期,3分钟完成配置即可永久免费使用。通过对比不同SSL证书方案,突出Let's Encrypt的免费、自动续期和高安全性优势,特别适合个人博客和中小企业官网。

weixin_30415113的博客 156

【转载】MSXML应用总结 概念篇

原文:http://blog.sina.com.cn/s/blog_48f93b530100e9tr.html 微软提供了大量的XML开发工具和技术,而SMXML(Microsoft XML Core Services)应该是一般开发中最常用到的技术了。MSXML支持了包括DOM(Document Object Model)、SAX(Simple API for XML)、XMLHttpRequ...

weixin_34356555的博客 309

FPGA以太网通信实战(一):实现MDIO接口驱动,掌控PHY芯片的钥匙

本文介绍了以太网通信技术及其核心组件。首先概述了以太网的发展历程,从标准以太网(10Mbps)到万兆以太网(10Gbps)的技术演进。重点分析了以太网接口的两大核心部件:MAC控制器负责数据链路层协议处理,PHY芯片负责物理信号转换和连接管理。文章详细解读了MDIO接口规范,包括帧格式和读写时序,并以YT8531 PHY芯片为例,介绍了其寄存器配置方法。最后设计了一个FPGA实现方案,通过MDIO接口完成PHY芯片的软复位和状态监测功能,并利用LED指示灯实时显示网络连接速率。

weixin_64402689的博客 1667

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

[ 人力资源面试篇 ] HR 面试题分析详解大集合,看完直怼面试官(二)

那么在这个系列的文章中,我们聊到 HR 面谈什么?并且总结了五十个常见的人力资源面试题,在这里分享给大家。

qq_51577576的博客 1385

基于 YOLOv26 的校园安全监控系统:多场景应用

本文提出了一种基于YOLOv26的校园安全监控系统,采用多场景应用架构实现对校园安全的智能监测。系统核心技术包括YOLOv26目标检测、DeepSORT目标跟踪、区域安全定义和行为分析等模块,通过边缘计算平台实现实时处理。研究构建了包含多种校园场景的专业数据集,并采用数据增强技术提升模型性能。系统可检测人员、车辆和物品等目标,分析其行为轨迹,评估安全风险并触发告警。实验结果表明,该系统能有效识别校园安全隐患,为安全管理提供智能化解决方案。

一键难忘的博客 512

XML 解析器之一 :MSXML使用教程(转)

介绍 微软的msxml是基于COM接口开发的,如同vbscript和javascript一样,微软这么做是为了提供更好的扩展性。你可以在用脚本来调用msxml,也可以用C++这样编程语言一样调用(虽然这么使用是非常烦的)。这篇文章算是一个总结吧,我自己msxml也用的不熟,说心里话,我宁愿选择使用expat、tinyxml,而不是msxml,COM接口库很烦,为了得到一个节点的属性,你不得不首先获得一个属性集,然后再得到所要的节点,在调用get_text才能得到其值。而且特别是接口指针的释放,我做了个实验,

MannHello的专栏 7447

3、神经网络在汽车中的应用

本文探讨了神经网络在现代汽车中的多种应用,包括防抱死制动系统(ABS)、燃油喷射系统、自动驾驶辅助系统以及发动机故障诊断。通过详细分析这些系统的具体工作流程和神经网络的集成方式,展示了神经网络如何提升车辆的安全性、效率与智能化水平。

moss5的博客 238

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

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

csd3176的博客 174

EndNote X9 参考文献附录列表 格式调整

EndNote X9 插入参考文献常见问题总结

程序员,他们想的是什么?他们想的永远都是技术,他们崇尚的也永远都是技术。 2573

【华为OD机试真题 新系统】1029、字符串处理 | 机试真题+思路参考+代码解析(C++、Java、Py、C语言、JS)

【华为OD机试真题 新系统】1029、字符串处理 | 机试真题+思路参考+代码解析(C++、Java、Py、C语言、JS) 华为od机试,华为od机试真题,华为od机试E卷,华为odE卷,华为od机试真题E卷,华为OD,华为OD机试,华为OD机试真题,华为od机考,华为od机试D卷,华为od机试真题D卷,华为od手撕代码,华为od,华为od机试C卷,华为od e卷,华为2026e卷,od机试,2026E卷,华为OD机试E卷,什么是华为od,华为od介绍,全面了解华为od,2026华为od,如何备战华为od,

KJ.JK 226

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

YOLOv11改进 | 主干/Backbone篇 | 利用RT-DETR主干网络PPHGNetV2助力yolov11有效涨点(轻量化目标检测网络)

本文给大家带来利用RT-DETR模型主干HGNet去替换YOLOv11的主干,RT-DETR是今年由百度推出的第一款实时的ViT模型,其在实时检测的领域上号称是打败了YOLO系列,其利用两个主干一个是HGNet一个是ResNet,其中HGNet就是我们今天来讲解的网络结构模型,这个网络结构目前还没有推出论文,所以其理论知识在网络上也是非常的少,我也是根据网络结构图进行了分析(精度mAP提高0.05)。YOLOv11改进系列专栏——本专栏持续复习各种顶会内容——科研必备​目录一、本文介绍。

Snu77的博客 3728

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

IMSL CNL 7.0.0 (x86-64)Crack

IMSL CNL 7.0.0 (x86-64)Crack intel的算法库破解文件,这是C++版本的破解文件

精雕软件(JDpaint) 5.5 绿色版

精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版

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

SAP B1中文培訓教材_SDK

公司内部培训资料,对开发工具 ,DIAPI, UIAPI,Add-ON有详细解说

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

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

csd3176的博客 118

复分析 阿尔福斯(Ahlfors) 第三版答案 英文

答案分为十章,有部分习题没有答案,全英文复分析阿尔福斯(Ahlfors) 第三版答案

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

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

csd3176的博客 143

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性能分析) (转)

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

csd3176的博客 128

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) (转)

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

csd3176的博客 128

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

XML------XML文档类型定义(Schema结构)

XML Schema结构                                                                                                                                  5.1 Schema概述 XML Schema是2001年5月正式发布的W3C的推荐标准,经过数年的大规模讨

Me丿以卿之名 8497

MSXML的不同版本使用

我参与了IE7的开发过程,看到了在IE浏览器中形形色色使用MSXML的方法。显然有一些东西困扰着开发者:MSXML“混乱”的版本以及如何创建“正确”的实例。下面是一段非常常见的代码: if (Web.Application.get_type() == Web.ApplicationType.InternetExplorer) {  var progIDs = [ 'Msxml2.DOMDocum

菜鸟天路 6653

MSXML应用总结 开发篇(上)

<br />由于包含太多格式符号,新浪提示篇幅过长,因此分为上、下两篇) <br />本篇是接前文“MSXML应用总结 概念篇”写的,主要总结一下MSXML DOM接口的应用。DOM(Document Object Model)是微软提供的处理XML文档的一个API标准库,我们可以将其理解为一组抽象了XML文档结构的接口。<br /> <br />MSXML的DOM模型是符合W3C DOM标准的,而DOM API在Windows中以COM接口的形式提供,关于COM请大家查阅相关资料。简单来说,COM提供了一

vagabond1的专栏 3693
上一篇: Inside MSXML Performance(MSXML性能分析) (5)
下一篇: Inside MSXML Performance(MSXML性能分析) (7)
ayusay
博客等级 码龄25年 1粉丝 9原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值