简体   繁体   English

浏览器性能问题

[英]Browser performance question

Using an adapted version of jquery.inplace.js for some page creation and use an OBDC connection in the background php file to query for content. 使用改编版的jquery.inplace.js进行某些页面创建,并在后台php文件中使用OBDC连接来查询内容。 Everything works, BUT... 一切正常,但是...

I am surprised that IE6, 7, or 8 are all pretty quick, as is chrome, but firefox seems to take quite a few seconds for exactly the same task, in this case. 令我惊讶的是,IE6、7或8都非常快,而chrome也是如此,但是在这种情况下,Firefox似乎要花几秒钟来完成完全相同的任务。

This is without firebug, or lots of other add-ons enabled. 这没有Firebug,也没有启用其他许多插件。 I am puzzled by what to look for. 我对寻找的东西感到困惑。 It is a fairly simple return of some html content. 这是一些html内容的相当简单的返回。

What would you try? 你会尝试什么?

A cursory look at the source in the SVN doesn't show anything which I believe firefox would have problems with. 粗略地看一下SVN中的源代码并没有显示我相信Firefox有问题的任何内容。

Can you explain exactly what is "slow"? 您能确切解释什么是“慢”吗? Is it the POST request? 是POST请求吗? Have you tried logging the HTTP Headers sent to the server from both IE and FF? 您是否尝试记录过从IE和FF发送到服务器的HTTP标头?

If it's the javascript itself, try running the profiler in firebug; 如果是javascript本身,请尝试在firebug中运行事件探查器; FF might find a specific function a little "heavy" (for instance, one of the regexes). FF可能会发现某个特定功能有些“繁重”(例如,一个正则表达式)。

Also, FF3.5+ already has String.trim*() methods built-in. 同样,FF3.5 +已经内置了String.trim*()方法。 The code you're using overwrites those with a custom version, which will be much slower and might even be causing firefox to behave oddly. 您正在使用的代码将覆盖使用自定义版本的代码,这会慢很多 ,甚至可能导致Firefox表现异常。 Try changing the source to the following: 尝试将源更改为以下内容:

if( String.prototype.trim === undefined ) {
    String.prototype.trim = function() {
        return this.replace(/^\s+/, '').replace(/\s+$/, '');
    };
}

That way the plugin will only add the trim method for older browsers. 这样,该插件只会为旧版浏览器添加trim方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM