【问题标题】:What is the performance difference between native Canvas api and html5 canvas API for android?原生 Canvas api 和 html5 canvas API for android 之间的性能差异是什么?
【发布时间】:2011-06-13 23:17:30
【问题描述】:

我有使用 html5 画布的非交互式 2d 动画应用程序,它在桌面浏览器下运行良好,但在 android 下性能很差。 android原生Canvas vs html5 canvas性能对比如何?由于在我花费所有努力发布这个问题之前,API 完全不同。是否有与用于 2d 动画应用的 html5 canvas 非常相似的替代原生 android API?

【问题讨论】:

  • 原生 API 的性能可能会更好,但这也取决于设备。桌面浏览器将在功能更强大的桌面计算机上运行。

标签: android


【解决方案1】:

我的回答是 Android 的 Native One 比 js canvas 慢得多......

难以置信!!!

这是在我的机器上绘制一个简单的矩形 1000 次的结果

1: 使用 View 和 onDraw : 花费 5~7s

2:使用 Native Canvas(singleton) 和虚拟位图(singleton)、Paint(singleton) 和 Thread。 3~6s

3:使用 Javascript 和 createElement :1.1s

4:使用Javascript和画布:0.1~0.2s

【讨论】:

    【解决方案2】:

    android 浏览器及其画布实现存在问题。与普通的旧 iPad v1 相比,使用 xoom(双 cpu)的画布性能很难看。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-02-01
      • 2012-07-23
      • 2010-10-25
      • 2020-05-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多