Safari实现indexeddb非常慢 [英] Safari implementation of indexeddb is very slow

查看:907
本文介绍了Safari实现indexeddb非常慢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Apple最近在OSX上的iOS8 Safari和Safari 7.1中添加了对indexeddb的支持。我试图在一个Web应用程序中使用它,它在indexeddb中存储大约65,000条记录,并使用一些复合索引查询它们。

Apple recently added support for indexeddb in both iOS8 Safari and Safari 7.1 on OSX. I am attempting to use this in a web application that stores about 65,000 records in indexeddb and queries them using some compound indexes.

它对我有用,但与Chrome的实现相比indexeddb,它真的非常慢。

It's working for me, but compared to Chrome's implementation of indexeddb, it's really, really slow.

具体而言...针对Chrome的indexeddb需要2ms的查询对Apple的indexedbb需要500ms。此特定查询使用复合indexeddb索引(键中的2个字段),使用键的IDBKeyRange.only值返回约65个总计的100个文档。

To be specific... a query that takes 2ms against Chrome's indexeddb takes 500ms against Apple's indexedbb. This particular query is using a compound indexeddb index (2 fields in the key) using a IDBKeyRange.only value for the key to bring back about 100 documents of the 65,000 total.

我的应用程序也支持websql作为存储机制,当我在Safari中切换到它时,性能非常好。我的查询会在几毫秒后返回,就像Chrome一样。

My application supports websql as the storage mechanism as well and when I switch to that in Safari, performance is great. My query returns in a few ms, just like Chrome.

其他人在Apple的indexeddb实施缓慢时遇到问题?有关如何使其更好地工作的任何建议,还是我们只需等待Apple修复它?

Anyone else having trouble with the slowness of Apple's indexeddb implementation? Any suggestions as to how to make it work better or do we just have to wait for Apple to fix it?

我相信Apple的indexeddb实现实际上只是一个包装器websql的顶部以及我可以直接使用websql以良好的性能实现我的应用程序这一事实意味着这样的包装器,如果实现得好,应该可以正常运行。可悲的是,情况还不是这样!

I believe that Apple's indexeddb implementation is actually just a wrapper on top of websql and the fact that I can implement my app using websql directly with good performance would imply that such a wrapper, if implemented well, should perform fine. Sadly, that is not yet the case!

推荐答案

我们已经看到了同样的事情。插入10000个对象的过程在Android上完成大约需要5到6秒,在iOS8上需要15分钟才能完成。

We have seen the same thing. A process which inserts 10000 objects takes around 5 or 6 seconds to complete on Android and 15 minutes to complete on iOS8.

Safari是一个webkit浏览器,所以如果它使用相同的代码库如下:

Safari is a webkit browser so if it uses the same code base as this:

https://github.com/WebKit/webkit/blob/master/Source/WebKit2/DatabaseProcess/IndexedDB

然后IndexedDB是(很糟糕)基于SQLLite数据库。

then IndexedDB is (badly) based on a SQLLite database.

这篇关于Safari实现indexeddb非常慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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