google / lovefield

Lovefield is a relational database for web apps. Written in JavaScript, works cross-browser. Provides SQL-like APIs that are fast, safe, and easy to use.
https://google.github.io/lovefield/
Apache License 2.0
6.82k stars 367 forks source link

concerning the late connect method(schemaBuilder.connect()) after applying Windows Update #238

Closed satoshi2018 closed 6 years ago

satoshi2018 commented 6 years ago

【environment】 Windows 8.1 Memory 4 GB CPU 3.59 GHz lovefield 2.1.9 Browser IE 11 updated version: 11.0.56 (KB 4092946), 11.0.60 (KB 4103768)

【An event】 After applying the Windows Monthly Update in April, May 2018, execute the connect method(schemaBuilder.connect()) and add it to IndexDB It took about 5 to 8 seconds to connect. In my environment / system, there are three tables in the DB connected by the connect method(schemaBuilder.connect()). About 4,500 of them (capacity 3 MB) are stored in one table among them. Before the monthly update in April 2018 (11.0.49) it took only 1-2 seconds. Why did the connect(schemaBuilder.connect()) method take time?

【Supplement】 Even raising the version of lovefield(2.1.10, 2.1.11, 2.1.12) did the same. I confirmed the operation with Chrome (67.0), it took about 1 second.

arthurhsu commented 6 years ago

Not sure if we will support Windows 8 and Internet Explorer in the near future. Can you try on Windows 10 and Edge? As you mentioned, modern browsers like Chrome takes just 1 second to run. Performance-wise, there is very little we can do if Microsoft already gave up on their old platform/browser.

satoshi2018 commented 6 years ago

I'm sorry I have not received a reply.

Since the system that I am creating is mainly used from Windows 8 and IE 11, It is meaningless to check the operation with Edge.

I think that it takes time to connect by bulk loading. I think that lazy load improves the connection speed, Specify options when connecting to use bulk loading and lazy load differently Is it possible?

After that, the table created by lovefield will have id as the primary key, Is it possible to rewrite id to an arbitrary value? Because id is the primary key, you can use the IndexedDB API to create a table created with lovefield When searching, it will be a full scan.

arthurhsu commented 6 years ago

It's not as simple as people often think "lazy load". It's designed so for a reason: JavaScript does not provide locking, the only thing we have is the guarantee of single thread accessing heap. As a result, to provide long-living transactions, we MUST load everything upfront.

As to the primary key, that's your schema's issue. Lovefield let you specify what to index and that's not necessarily be id. What you see id is our internal data structure. Because we are bulk loading no matter what, IndexedDB indexing is irrelevant.

Also, IE11 IndexedDB performance is not great either. Please consider using Chrome or upgrade to Window 10. As I mentioned earlier, there's no way for a JavaScript library to make up the speed of an abandoned Microsoft product. IE 11 will be slow one way or the other.