indexedDB在iOS上表现不佳? [英] indexedDB has bad performance on iOS?

查看:143
本文介绍了indexedDB在iOS上表现不佳?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我从indexedDB读取数据(在我的情况下超过3000个项目)时,它的工作非常缓慢。这与我使用的浏览器无关。我在Chrome和Safari上获得了相同的结果。我使用iPad 3进行测试。
在这个问题的范围中,我发现了以下有趣的东西:


  1. 当我打开我的客户端应用程序在桌面版Chrome浏览器中,以适当方式使用 在Safari中使用 indexedDB 时,它的工作原理 SLOW

  2. li>

    当我们在iPad 3上使用 Chrome时, SLOW 也起作用。 (因为Chrome使用indexedDB)


    WebSQL已被弃用,根据我的调查,indexedDB在iOS上有一些瓶颈我的情况下iOS 9.3.5和iPad 3)。
    我最好的办法是找到Chrome的解决方案(在iOS上)。请写下你的想法和提示。谢谢!

    解决方案

    更新:下面描述的测试描述了Safari中的一个问题,该问题似乎在10.12.4 beta中得到修复。

    这里有更多的数据,但基本上我看到了与您所看到的相同的东西。我使用 bulkPut()将不同数量的记录写入了干净的IndexedDB。我在XCode模拟器中运行的Chrome,Safari和iOS 10.2上执行了此操作。所有三个都在同一台Macbook Pro上运行。我使用的是Dexie.js包装器,所以有一些机会是由于包装而导致的,而不是归功于IndexedDB本身。



    我看到的是iOS和Safari试图编写的记录越多,每次写入时间就越差,而Chrome每次写入记录的时间几乎相同,无论我尝试写入的记录数量多少。



    此表显示每个浏览器中的记录/ ms。

     记录Chrome Safari ios模拟器
    100 5.26 0.63 1.54
    4.63 0.92 0.62
    1000 5.26 0.71 0.61
    2000 4.23 0.09 0.16
    5000 4.21 0.02 0.02

    然后我使用 put()代替 bulkPut()。对于少量的记录,并且始终在Chrome上,这种情况要慢得多。但是,对于Safari浏览器中的大量记录,这种情况会更快: $ b

    记录Chrome Safari ios模拟器
    100 0.45 0.08 0.40
    500 0.46 0.14 0.35
    1000 0.51 0.20 0.36
    2000 0.54 0.21 0.39
    5000 0.38 0.19 0.60

    When I read data (in my case more then 3000 items) from indexedDB it works so slow. And it doesn't matter what browser I use. I got the same results on Chrome and Safari. I used iPad 3 for testing. In scope of this issue I've found out the following interesting things:

    1. When I open my client application on the desktop version of Chrome it works in appropriate way.

    2. In case when I use WebSQL in Safari it looks fine BUT when I use indexedDB in Safari it worked SLOW.

    3. When we've used Chrome on the iPad 3 it worked SLOW too. (because, Chrome uses indexedDB)

    WebSQL is deprecated and according to my investigation indexedDB has some bottlenecks on iOS (in my case iOS 9.3.5 and iPad 3). The best way for me is to find solution for Chrome(on iOS). Please write your thoughts and tips. Thanks!

    解决方案

    UPDATE: The test described below describes an issue in Safari which appears to be fixed in the 10.12.4 beta.

    Here is a bit more data, but basically I'm seeing the same thing you saw. I wrote different number of records using bulkPut() to a clean IndexedDB. I did this on Chrome, Safari, and iOS 10.2 running in the XCode simulator. All three were running on the same Macbook Pro. I was using the Dexie.js wrapper, so there is some chance that this is due to the wrapper and not due to IndexedDB itself.

    What I saw was that iOS and Safari both got worse per-record write times the more records I tried to write, while Chrome kept pretty much the same per-record write time regardless of the number of records I tried to write.

    This table shows the records/ms in each browser.

    records Chrome  Safari  ios Simulator
    100     5.26    0.63    1.54
    500     4.63    0.92    0.62
    1000    5.26    0.71    0.61
    2000    4.23    0.09    0.16
    5000    4.21    0.02    0.02
    

    Then I tried the same records using put() instead of bulkPut(). For small numbers of records, and always on Chrome, this is much slower. But for large numbers of records on either Safari browser, this is faster:

    records Chrome  Safari  ios Simulator
    100     0.45    0.08    0.40
    500     0.46    0.14    0.35
    1000    0.51    0.20    0.36
    2000    0.54    0.21    0.39
    5000    0.38    0.19    0.60
    

    If this is correct (and I'm a bit skeptical that it is in all cases, since it makes no sense), then I guess the best strategy would be to use bulkPut on Chrome, but on Safari to use bulkPut in chunks of no more than 1000 records? Seems terrible. I would love to know if anyone else has more info about this or other suggestions.

    这篇关于indexedDB在iOS上表现不佳?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆