简体   繁体   English

与本地应用程序相比,Sencha Touch + PhoneGap在速度方面的表现如何?

[英]How does Sencha Touch + PhoneGap perform compared to native apps in terms of speed?

I'm really worried that when I write iPhone app with Sencha Touch and put it in PhoneGap container the user experience would downgrade. 我真的很担心,当我用Sencha Touch编写iPhone应用程序并将其放在PhoneGap容器中时,用户体验会降级。

I particularly see the bottlenecks in: 我特别看到以下瓶颈:

  • fluency of the screen transitions (animations) 屏幕过渡(动画)的流畅度
  • fluency of scrolling 滚动流畅

Please have in mind that there are lot of 3G iPhones runnin iOS 4.x that made them very slow. 请记住,在iOS 4.x上运行的许多3G iPhone使其运行非常缓慢。 I'm discarding the support for the original iPhone. 我放弃了对原始iPhone的支持。

I, being a trained UI professional, can spot the ST app just by touching few things in it. 作为一名经过培训的UI专业人员,我只需触摸一下ST应用程序就可以发现它。

Does the shift from Safari to PhoneGap container increases the performance? 从Safari到PhoneGap容器的转变是否可以提高性能?

Do you have any experience with it? 你有经验吗?

I haven't used ST or PhoneGap, but I have used an app built with them. 我没有使用过ST或PhoneGap,但我使用了使用它们构建的应用程序。 I can say definitely experience about the apps was worst in my 3GS. 我可以肯定地说,在我的3GS中,关于应用程序的体验最差 If you're planning a demo, prototype or test, you're safe with them. 如果您正在计划演示,原型或测试,则可以放心使用。 However if you want to make an app with competitive UI/UX , you should not. 但是,如果要使用具有竞争力的UI / UX制作应用程序,则不应这样做。 (and even you want to make prototypes, it should be better having some papers) (甚至您想制作原型,最好有一些论文)

For your question, the speed. 对于您的问题,速度。 It's definitely not comparable. 绝对不可比。 HTML + CSS is feature-rich, easy to use framework. HTML + CSS是功能丰富,易于使用的框架。 Of course, it's slow as much as it's easy. 当然,它既慢又容易。 Most of HTML based UI tools uses just UIWebView which is a part of native framework. 大多数基于HTML的UI工具仅使用UIWebView ,它是本机框架的一部分。 In fact UIWebView is Mobile Safari itself. 实际上, UIWebView本身就是Mobile Safari。 So the performance of the tools never be better than Mobile Safari. 因此,这些工具的性能永远不会比Mobile Safari更好。 If you want to check performance in animations, just visit http://www.chromeexperiments.com/ with Mobile Safari. 如果要检查动画的性能,只需通过Mobile Safari访问http://www.chromeexperiments.com/ I checked none of showcase is running smoothly even many of them does not require strong graphical power. 我检查了所有展示柜是否运行平稳,甚至其中许多不需要强大的图形功能。

Native apps are compiled and optimized with cutting edge technologies from professional researches over decades. 数十年来,本机应用程序都是使用来自专业研究的尖端技术进行编译和优化的。 And there are a lot of options to tweak and tune the code for performance. 并且有很多选项可以调整和调整代码以提高性能。 However a few of them are applied to HTML. 但是其中一些适用于HTML。 Because HTML should guarantee feature-rich, easy-to-use framework always. 因为HTML应该始终保证功能丰富,易于使用的框架。 And most of optimizations (which makes performance improvement) are trade off between feature and simplicity. 而且大多数优化(可以提高性能)都需要在功能和简单性之间进行权衡。

However in iOS 4.3 Mobile Safari's performance is improved. 但是,在iOS 4.3中,移动Safari的性能得到了改善。 But I don't believe it's meaningful for apps with shining UIs. 但是我认为这对于具有闪亮UI的应用程序没有意义。

I saw a considerable graphic framework with JavaScript. 我看到了一个带有JavaScript的图形框架。 In fact, it was game framework with scripting in JavaScript. 实际上,这是带有JavaScript脚本的游戏框架。 So it has no relation with HTML or CSS. 因此它与HTML或CSS无关。 (I forgot the name of it, however it was incomplete product) (我忘记了它的名称,但是它是不完整的产品)

PS. PS。

And there is another big reason for you. 还有另一个重要原因。 The UI behavioral inconsistency. UI行为不一致。 The frameworks mimics native UI of iOS but incomplete. 框架模仿iOS的本机UI,但不完整。 So it feels uncomfortable like imitated copycat brands. 因此,就像模仿的模仿品牌一样,感觉不舒服。 However you have no need to care about it if you don't want native UI. 但是,如果您不想使用本机UI,则无需关心它。

Edit 编辑

It's been a long time after I answered this question, but I realized that I also have to mention about GC. 我回答这个问题已经很长时间了,但是我意识到我也不得不提到GC。 JavaScript is GC based language. JavaScript是基于GC的语言。 It means, it has unpredictable GC time which makes main thread stops. 这意味着,它具有不可预测的GC时间,这会使主线程停止。 This makes UI struggles. 这使UI陷入困境。 On native implementation, you have control to use GC or not. 在本机实现上,您可以控制是否使用GC。

This wouldn't be a problem on Android. 在Android上这不是问题。 Android always had those struggling because of GC on Java. Android总是因为Java上的GC而苦苦挣扎。 Consequently, users will not feel any difference. 因此,用户不会有任何区别。 But on iOS, your HTML5 based app never provide better experience than competitor's native app. 但是在iOS上,基于HTML5的应用程序永远无法提供比竞争对手的本机应用程序更好的体验。

There are many workarounds for this GC time issue. 有很多解决此GC时间问题的方法。 Such as incremental-GC, realtime-GC and so on. 如增量GC,实时GC等。 But actually, there's no real solution. 但是实际上,没有真正的解决方案。 Because the primitive problem is you don't have control . 因为原始问题是您没有控制权

It turns out that putting a PhoneGap wrapper around any webapp (including all ST2 apps) can actually significantly decrease their performance. 事实证明,将PhoneGap包装器放置在任何Web应用程序(包括所有ST2应用程序)周围实际上会大大降低其性能。 This is because the UIWebView which it uses is actually not the same as iOS's Safari browser which has had a number of enhancements to make it more perforant. 这是因为它采用了一个UIWebView实际上是一样的iOS的Safari浏览器已经有许多增强功能,使其更穿通。 One reason behind this is that as of iOS 4.3 , Safari make use of the "Nitro" JavaScript engine which is pretty fast, this is not available on the UIWebView which is used by PhoneGap (although as of iOS5 it's available for webapps running in full screen mode ). 这背后的一个原因是,从iOS 4.3开始 ,Safari使用了非常快的“ Nitro” JavaScript引擎,但 PhoneGap使用的UIWebView上却不可用(尽管从iOS5开始,它可用于完全运行的Webapp屏幕模式 )。

A few people have experimented with the performance to see what the impact is, one looking at the performance of the Facebook App and another at canvas performance . 一些人尝试了该性能,以查看其影响,一个人查看Facebook App的性能,另一个人查看画布的性能

It turns out that the embedded UI browser maybe worse than the Andriod one as some tests have shown . 事实证明,如某些测试所示 ,嵌入式UI浏览器可能比Andriod浏览器差。

我发现ST应用程序的性能甚至在PhoneGap之外也很糟糕。

At time of writing I would say: Good for mockup and quick app with no high demanding graphics. 在撰写本文时,我会说:适用于没有高要求图形的模型和快速应用程序。

But things could change over time as both project (PhoneGap and Sencha Touch) are improving day after day. 但是随着两个项目(PhoneGap和Sencha Touch)的日新月异,事情可能会随着时间而改变。

And hardware is becoming more and more powerful (iPhone 4, 5, ..., dual arm cpu, ...) so there will be a time where ST and PhoneGap based applications will have performance close to native apps, and this might come after than expected. 而且硬件变得越来越强大(iPhone 4、5,...,双臂cpu等),因此基于ST和PhoneGap的应用程序的性能将接近本机应用程序,这可能会出现之后超出预期。

So keep an eye on these projects and keep on developing "basic" applications with them to test their performance. 因此,请密切关注这些项目,并继续与它们一起开发“基本”应用程序以测试其性能。

I built a business app with Sencha Touch with and without PhoneGap. 我使用带有和不带有PhoneGap的Sencha Touch构建了一个业务应用程序。 Any major performance impact is from Sencha Touch (1.x or 2), not PhoneGap. 任何主要的性能影响都来自Sencha Touch(1.x或2),而不是PhoneGap。 As Eonil explains, this is because PhoneGap is really using the native browser. 正如Eonil解释的那样,这是因为PhoneGap实际上是在使用本机浏览器。 I've noticed ST performance "good enough" on iPhone 4 (and I'd argue 3GS with iOS 4.3+; depends on your users' expectations). 我注意到iPhone 4上的ST性能“足够好”(我认为3GS和iOS 4.3及更高版本取决于用户的期望)。 On Android, only really recent devices are adequate for ST 1.1, but ST 2 has focused on Android performance. 在Android上,只有非常新的设备才适合ST 1.1,但是ST 2专注于Android性能。 I'm sure Sencha will continue to innovate and drive performance because their business depends on it. 我确信Sencha将继续创新并提高绩效,因为他们的业务依赖于此。

If you do use Sencha Touch (or any JavaScript), be sure to use the minified (-debug) version. 如果您确实使用了Sencha Touch(或任何JavaScript),请确保使用缩小的(-debug)版本。

I've also built trivial native apps on iOS and Android, and indeed there is no comparison; 我还在iOS和Android上构建了一些琐碎的本机应用程序,确实没有可比性。 native is far faster. 本机要快得多。

I've made several app with ST2, and wrapped for native. 我已经用ST2制作了几个应用程序,并包装成本地语言。 You can of course compare the two, however they are very different beasts! 您当然可以比较两者,但是它们是非常不同的野兽!

Put simply, if your Sencha app performs well in Safari and Android Stock, it will perform in a similar manner once it is wrapped for iOS or Android. 简而言之,如果您的Sencha应用程序在Safari和Android Stock中表现良好,那么将其包装到iOS或Android后,其性能也会类似。 Phonegap/Cordova do not effect performance much, these are simply the bridge/container to the native functionality. Phonegap / Cordova对性能的影响不大,它们只是本机功能的桥梁/容器。

I think if you are worried about performance, look at the many tutorials around optimizing ST2 apps. 我认为,如果您担心性能,请查看有关优化ST2应用程序的许多教程。 There is lots that can be done to improve transitions and list scrolling. 有很多可以改善过渡和列表滚动的工作。

If you are happy with how your app performs as a web app, then I think you have kind of answered your question already. 如果您对应用程序作为网络应用程序的性能感到满意,那么我认为您已经回答了您的问题。 Webapps are not native, and this masquerading done by some of the bigger frameworks is misleading. Webapp不是本机的,并且某些较大的框架伪装的内容具有误导性。 Ultimately the user will have expectations that are not always met. 最终,用户将拥有并不总是能够满足的期望。

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

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