Skip to content

Conversation

@nolanlawson
Copy link
Member

@calvinmetcalf I think your expertise would be very useful here.

Background: we need to pull hex binaries out of WebSQL using the SQLite HEX() function because WebSQL has a fun bug. For the record, I recently filed the bug on Chromium and Safari.

This is what's causing the DOM to freeze. The proof is in this bl.ocks.org. You can run the Chrome profiler and see that parseHexString() is blocking.

I've coded up this fix, which blocks the DOM a lot less, but apparently the function is still blocking quite a bit according to the Chrome profiler. And the GIFs are still jerky. @calvinmetcalf I'm not sure what else I could be doing; I even did a jsperf to verify my hex parser. Any ideas?

@calvinmetcalf
Copy link
Contributor

process.nextTick is not what you want you want
global.setImmediate||global.setTimeout.
On Oct 19, 2014 12:23 PM, "Nolan Lawson" [email protected] wrote:

@calvinmetcalf https://github.com/calvinmetcalf I think your expertise
would be very useful here.

Background: we need to pull hex binaries out of WebSQL using the SQLite
HEX() function because WebSQL has a fun bug. For the record, I recently
filed the bug on Chromium
https://code.google.com/p/chromium/issues/detail?id=422690 and (Safari)[
https://bugs.webkit.org/show_bug.cgi?id=137637].

This is what's causing the DOM to freeze. The proof is in this bl.ocks.org
http://bl.ocks.org/nolanlawson/raw/73f15f3fe612b8770e79/. You can run
the Chrome profiler and see that parseHexString() is blocking.

I've coded up this fix, which blocks the DOM a lot less, but apparently
the function is still blocking quite a bit according to the Chrome
profiler. And the GIFs are still jerky. @calvinmetcalf
https://github.com/calvinmetcalf I'm not sure what else I could be
doing; I even did a jsperf http://jsperf.com/parse-hex to verify my hex

parser. Any ideas?

You can merge this Pull Request by running

git pull https://github.com/pouchdb/pouchdb 2890-2

Or view, comment on, or merge it at:

#2899
Commit Summary

File Changes

Patch Links:


Reply to this email directly or view it on GitHub
#2899.

@nolanlawson
Copy link
Member Author

Tried that, didn't improve the performance at all.

@calvinmetcalf
Copy link
Contributor

Your also going to want to drastically lower the block size to like 16
bytes
On Oct 19, 2014 1:01 PM, "Nolan Lawson" [email protected] wrote:

Tried that, didn't improve the performance at all.


Reply to this email directly or view it on GitHub
#2899 (comment).

@nolanlawson
Copy link
Member Author

I figured out a much better solution. If we just transform the \u0000 before storing and then put them back in after retrieval, we don't need hex() at all.

@nolanlawson
Copy link
Member Author

this will require a migration, tho

@nolanlawson
Copy link
Member Author

Here's proof that the no-hex technique works very well: http://bl.ocks.org/nolanlawson/raw/11b1af329e1f8f27fa13/

@nolanlawson
Copy link
Member Author

Closing in favor of #2900. It's way better than my meager improvements, although they are still nice to have.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants