1

If you create a sample Sencha Touch 2.3 app using sencha app generate... and package it with Cordova, you will see that it takes about 4 seconds to launch the app and show the main view. If this basic skeleton app takes this long, then actual apps that have many more views, controllers, stores etc will take much longer (6-8+ seconds).

Is there any way to speed up the launch? For reference, lets take the example of the sencha started app itself. It takes 4 seconds now. So how do we improve the performance so that it takes 1 or less than 1 second to launch?

4

4 回答 4

1

除了你应该只包括必要的控制器、视图等......从生成一个开发、测试构建与一个压缩、最小化所有 js(Sencha+你的代码)在一个独特的 'js 中的生产构建有很大的不同' 文件和一个独特的 'css' 文件,大大提高了启动时间(在开发阶段,每个类都是一个单独的文件)。

sencha app build production 
于 2014-09-01T18:59:08.217 回答
0

我的建议是:

  • 避免过度嵌套视图
  • 进行分层加载(并非所有视图控制器模型和 app.js 中的商店,但使用需要)
  • 确保您没有创建对象并让它们在没有适当破坏的情况下四处走动。
  • 速度很大程度上取决于手机,因此如果您的目标是资源有限的手机,可能需要考虑其他选择。

据说这不是原生的,你不会获得相同的速度(至少现在不是),但你会获得很多其他好处。

于 2014-09-01T16:47:19.270 回答
0

正如malcubierre 所说,我们需要使用sencha app build命令压缩所有需要的 js 和 css 文件。如果你的目标是手机,那么你可以去sencha app build package指挥。

您还可以从应用程序中未使用的app.scss文件中删除额外的导入。删除主题部分中的额外导入减少了app.css的加载时间。

于 2015-02-27T16:32:54.263 回答
0

由于以下原因(我面临),大多数时候启动应用程序需要很长时间

1.app.js中直接加载控制器、视图的不必要的加载。

2.每当我们刷新应用程序时,都会不必要地加载静态图像/pdf(任何静态内容)。

如果您在任何煎茶触摸应用程序中正确遵循这些步骤,以下步骤将很有用。

  1. 不要直接加载 app.js 中的所有控制器,您可以使用配置文件加载特定于设备的控制器,如下所示

    个人资料:['平板电脑','手机'],

    上面一行将在 app.js 中,它负责加载相应的配置文件,这些配置文件进一步负责根据设备加载所有控制器和视图。

  2. app.json 文件包含 app.cache 部分,其中有缓存部分,您可以在其中提及所有静态图像或 pdf,以避免每次不必要的加载。

于 2014-09-01T17:34:09.580 回答