简体   繁体   English

Chrome应用程序性能不佳

[英]Chrome App Poor Performance

I am developing a Chrome App which is based on the same code as the normal web based version. 我正在开发一个Chrome应用,该应用基于与普通基于网络的版本相同的代码。 It's a web-audio app so quite performance critical for timing purposes. 这是一个网络音频应用,因此对于计时而言,性能至关重要。

I have noticed whilst holding down the mouse button within the app and wiggling it around, performance drops significantly, enough to mess up the timing. 我注意到,在按住应用程序内的鼠标按钮并使其摆动时,性能显着下降,足以弄乱时间。 This issue does not occur in the ordinary browser based version which is running the same code. 在运行相同代码的普通基于浏览器的版本中不会发生此问题。

I have recorded the activity with the Chrome developer tools and the only thing I can spot that does not happen with the browser based version is a function call to updateAppWindowProperties - which is a built in Chrome App function. 我已经使用Chrome开发人员工具记录了该活动,而我发现唯一无法通过基于浏览器的版本进行的事情是对updateAppWindowProperties的函数调用-这是Chrome App的内置函数。

I have attached a screenshot of the dev tools recording where you can see 3 big spikes in the activity, these are the bits where I am holding down the mouse button and moving it around. 我已经附上了开发工具记录的屏幕快照,您可以在其中看到活动中的三个大峰值,这些是我按住鼠标按钮并在其中移动的地方。

Anyone know what the cause of this could be, is it something to do with the Chrome App checking the window size? 有人知道这可能是什么原因,这与Chrome应用检查窗口大小有关吗?

Chrome应用的性能

It seems to have been fixed by reducing the number of css classes. 似乎已通过减少CSS类的数量来解决此问题。 I had a LOT of classes that were used only for jquery selectors, I changed them to data attribs and that seems to have fixed the performance issues. 我有很多只用于jquery选择器的类,将它们更改为数据属性,这似乎已经解决了性能问题。

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

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