表现查询 [英] Performance inquiry

查看:40
本文介绍了表现查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

想象一下三个选项:


a)有一个XML文件。 PHP5脚本加载它并将其放入DOM

文档对象中。然后,给定一个输入字符串,函数通过XPath查看具有该名称(或可能是属性值)的节点,并返回

节点的内容。


b)有一个包含序列化数组的文本文件。 PHP脚本打开它

并将数组反序列化为变量;然后,给定一个输入字符串,

查找具有相同键的数组元素并返回元素'

的值。


c)有一个PHP文件只包含数组的定义。 PHP

脚本包含它,并且在给定输入字符串的情况下,使用相同的键查找数组元素

并返回元素的值。


有没有人知道哪个选项最快,哪个?b
最慢?


谢谢,


Berislav

解决方案

因为你很聪明地提出这个问题为什么你不能写下

自己测试每个选项的代码?


-

Tony Marston

< a rel =nofollowhref =http://www.tonymarston.nettarget =_ blank> http://www.tonymarston.net


Berislav Lopac <是************ @ dimedia.hr>在留言中写道

news:k9 **************************** @ 40tude.net ... < blockquote class =post_quotes>想象一下三个选项:

a)有一个XML文件。 PHP5脚本加载它并将其放入DOM
文档对象。然后,给定一个输入字符串,函数通过XPath查找具有该名称(或可能是属性值)的节点,并返回该节点的内容。
b)有一个包含序列化数组的文本文件。 PHP脚本打开它
并将数组反序列化为一个变量;然后,给定一个输入字符串,
查找具有相同键的数组元素并返回元素的值。

c)有一个PHP文件只包含数组的定义。 PHP
脚本包含它,并且在给定输入字符串的情况下,使用相同的键查找数组元素并返回元素的值。

有没有人有任何想法哪个选项最快,哪三个最慢?

谢谢,

Berislav



" Tony Marston" <至** @ NOSPAM.demon.co.uk>写在

新闻:cj ******************* @ news.demon.co.uk:

路径:
phobos.telenet-ops.be!ossa.telenet-ops.be!feed1.news.be.easynet.net!new
s2.telebyte.nl!news.glorb。 com!border1.nntp.dca.gig anews.com!nntp.gigane
ws.com!peer01.cox.net!cox.net!peer-uk.news.demon.net!kibo.news.demon。 ne!
t!news.demon.co.uk!恶魔!不用于邮件来自:&#; Tony Marston"
< to ** @ NOSPAM.demon.co.uk>新闻组:comp.lang.php
主题:回复:表现查询
日期:星期一,2004年9月27日11:03:03 +0100
行数:36
消息ID: < cj ******************* @ news.demon.co.uk>
参考文献:< k9 ********** ******************@40tude.net>
回复:Tony Marston < to ** @ marston-home.demon.co.uk>
NNTP-Posting-Host:marston-home.demon.co.uk
X-Trace:news.demon.co.uk 1096279383 15906 80.177.120.119(2004年9月27日格林威治标准时间10:03:03)X-Complaints-To: ab *** @ demon。 net
NNTP-Posting-Date:Mon,27 Sep 2004 10:03:03 +0000(UTC)
X-MimeOLE:由Microsoft MimeOLE制作V6.00.2900.2180 X-Priority:3
X-RFC2646:格式=流动;原创
X-MSMail-Priority:正常
X-Newsreader:Microsoft Outlook Express 6.00.2900.2180
外部参照:ossa.telenet-ops.be comp.lang.php:69100

你很聪明地提出这个问题为什么你不能自己编写代码来测试每个选项?




并在此发布结果;-)


2004年9月27日星期一10:57:16 +0200,Berislav Lopac

< be ************@dimedia.hr>写道:

想象一下三个选项:

a)有一个XML文件。 PHP5脚本加载它并将其放入DOM
文档对象。然后,给定一个输入字符串,函数通过XPath查找具有该名称(或可能是属性值)的节点,并返回该节点的内容。
b)有一个包含序列化数组的文本文件。 PHP脚本打开
并将数组反序列化为变量;然后,给定一个输入字符串,
查找具有相同键的数组元素并返回元素的值。

c)有一个PHP文件只包含数组的定义。 PHP
脚本包含它,并且在给定输入字符串的情况下,使用相同的键查找数组元素并返回元素的值。

有没有人有任何想法哪个选项最快,哪三个最慢?

谢谢,

Berislav




c> b> a

-

使用Opera革命性的电子邮件客户端: http://www.opera.com/m2/


Imagine three options:

a) There is an XML file. A PHP5 script loads it and puts it into a DOM
document object. Then, given an input string, a function looks via XPath
for a node with that name (or possibly value of an attribute) and returns
the node''s content.

b) There is a text file containing a serialized array. PHP script opens it
and deserializes the array into a variable; then, given an input string,
looks for an array element with the same key and returns the element''s
value.

c) There is a PHP file containing just a definition for an array. PHP
script includes it and, given an input string, looks for an array element
with the same key and returns the element''s value.

Does anyone have any idea which option would be the fastest, and which the
slowest of the three?

Thanks,

Berislav

解决方案

As you are clever enough to come up with that question why can''t you write
the code to test each option yourself?

--
Tony Marston

http://www.tonymarston.net

"Berislav Lopac" <be************@dimedia.hr> wrote in message
news:k9****************************@40tude.net...

Imagine three options:

a) There is an XML file. A PHP5 script loads it and puts it into a DOM
document object. Then, given an input string, a function looks via XPath
for a node with that name (or possibly value of an attribute) and returns
the node''s content.

b) There is a text file containing a serialized array. PHP script opens it
and deserializes the array into a variable; then, given an input string,
looks for an array element with the same key and returns the element''s
value.

c) There is a PHP file containing just a definition for an array. PHP
script includes it and, given an input string, looks for an array element
with the same key and returns the element''s value.

Does anyone have any idea which option would be the fastest, and which the
slowest of the three?

Thanks,

Berislav



"Tony Marston" <to**@NOSPAM.demon.co.uk> wrote in
news:cj*******************@news.demon.co.uk:

Path:
phobos.telenet-ops.be!ossa.telenet-ops.be!feed1.news.be.easynet.net!new
s2.telebyte.nl!news.glorb.com!border1.nntp.dca.gig anews.com!nntp.gigane
ws.com!peer01.cox.net!cox.net!peer-uk.news.demon.net!kibo.news.demon.ne
t!news.demon.co.uk!demon!not-for-mail From: "Tony Marston"
<to**@NOSPAM.demon.co.uk> Newsgroups: comp.lang.php
Subject: Re: Performance inquiry
Date: Mon, 27 Sep 2004 11:03:03 +0100
Lines: 36
Message-ID: <cj*******************@news.demon.co.uk>
References: <k9****************************@40tude.net>
Reply-To: "Tony Marston" <to**@marston-home.demon.co.uk>
NNTP-Posting-Host: marston-home.demon.co.uk
X-Trace: news.demon.co.uk 1096279383 15906 80.177.120.119 (27 Sep 2004
10:03:03 GMT) X-Complaints-To: ab***@demon.net
NNTP-Posting-Date: Mon, 27 Sep 2004 10:03:03 +0000 (UTC)
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
X-Priority: 3
X-RFC2646: Format=Flowed; Original
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
Xref: ossa.telenet-ops.be comp.lang.php:69100

As you are clever enough to come up with that question why can''t you
write the code to test each option yourself?



and post the results here ;-)


On Mon, 27 Sep 2004 10:57:16 +0200, Berislav Lopac
<be************@dimedia.hr> wrote:

Imagine three options:

a) There is an XML file. A PHP5 script loads it and puts it into a DOM
document object. Then, given an input string, a function looks via XPath
for a node with that name (or possibly value of an attribute) and returns
the node''s content.

b) There is a text file containing a serialized array. PHP script opens
it
and deserializes the array into a variable; then, given an input string,
looks for an array element with the same key and returns the element''s
value.

c) There is a PHP file containing just a definition for an array. PHP
script includes it and, given an input string, looks for an array element
with the same key and returns the element''s value.

Does anyone have any idea which option would be the fastest, and which
the
slowest of the three?

Thanks,

Berislav



c > b > a
--
Using Opera''s revolutionary e-mail client: http://www.opera.com/m2/


这篇关于表现查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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