Windows Phone 7 - 加速数据获取的最佳实践

发布于 2024-10-22 05:06:38 字数 191 浏览 2 评论 0原文

我有一个 Windows Phone 7 应用程序(当前)调用 OData 服务来获取数据,并将数据放入列表框中。现在速度慢得可怕。我首先想到的是 OData 返回的数据比我实际需要的多得多。

对于加快 Windows Phone 7 应用程序中的数据获取速度,有哪些建议/最佳实践?我可以在应用程序中做些什么来加快数据检索并更快地将其呈现在用户面前?

I have a Windows Phone 7 app that (currently) calls an OData service to get data, and throws the data into a listbox. It is horribly slow right now. The first thing I can think of is because OData returns way more data than I actually need.

What are some suggestions/best practices for speeding up the fetching of data in a Windows Phone 7 app? Anything I could be doing in the app to speed up the retrieval of data and putting into in front of the user faster?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

初心 2024-10-29 05:06:38

听起来你已经有了一些关于要追逐什么的线索。

我尝试的一些基本操作是:

  1. 使您的 HTTP 请求尽可能小 - 如果可能,仅获取您绝对需要的实体和字段。
  2. 考虑使用多个 HTTP 请求增量获取数据,而不是一次性获取所有内容(当然,这实际上会使应用程序变慢,但通常会让应用程序感觉更快)
  3. 对于大型文本传输,请确保内容正在传输压缩传输(这应该发生在 HTTP 级别)
  4. 请注意,渲染数据的 XAML 不要太臃肿 - 列表中重复的大型 XAML 结构可能会导致速度缓慢。
  5. 优化时,永远不要假设您知道速度问题出在哪里 - 始终先进行测量!
  6. 将图像插入列表时要小心 - MS MarketPlace 应用程序在我的手机上似乎经常卡顿 - 我认为这是由图像获取和渲染过程引起的。

Sounds like you've already got some clues about what to chase.

Some basic things I'd try are:

  1. Make your HTTP requests as small as possible - if possible, only fetch the entities and fields you absolutely need.
  2. Consider using multiple HTTP requests to fetch the data incrementally instead of fetching everything in one go (this can, of course, actually make the app slower, but generally makes the app feel faster)
  3. For large text transfers, make sure that the content is being zipped for transfer (this should happen at the HTTP level)
  4. Be careful that the XAML rendering the data isn't too bloated - large XAML structure repeated in a list can cause slowness.
  5. When optimising, never assume you know where the speed problem is - always measure first!
  6. Be careful when inserting images into a list - the MS MarketPlace app often seems to stutter on my phone - and I think this is caused by the image fetch and render process.
旧人九事 2024-10-29 05:06:38

除了 Stuart 的精彩列表之外,还要考虑发送的数据的格式。

查看 Rob Tiffany 的这篇博文。它讨论基于数据格式的性能。它是专门针对 WCF 编写的,但要点仍然适用。

In addition to Stuart's great list, also consider the format of the data that's sent.

Check out this blog post by Rob Tiffany. It discusses performance based on data formats. It was written specifically with WCF in mind but the points still apply.

请别遗忘我 2024-10-29 05:06:38

作为 Stuart 列表的扩展:

实际上有 3 个领域 - 通信、解析、UI。单独测量它们:

  • 仅在处理关闭的情况下进行通信。
  • 测量固定 ODATA 格式字符串的解析。

不管你信不信,它也可以是 UI。

例如,ProgressBar 使用不当可能会导致处理速度急剧下降。 (一般来说,您不应使用任何 UI 动画,如此处所述。)

此外,请确保 UI 处理不会阻止数据通信。

As an extension to the Stuart's list:

In fact there are 3 areas - communication, parsing, UI. Measure them separately:

  • Do just the communication with the processing switched off.
  • Measure parsing of fixed ODATA-formatted string.

Whether you believe or not it can be also the UI.

For example a bad usage of ProgressBar can result in dramatical decrease of the processing speed. (In general you should not use any UI animations as explained here.)

Also, make sure that the UI processing does not block the data communication.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文