Skip to content

Update everything #45

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 101 commits into from
Jun 12, 2014
Merged

Update everything #45

merged 101 commits into from
Jun 12, 2014

Conversation

lovasoa
Copy link
Member

@lovasoa lovasoa commented Apr 28, 2014

I updated old code and added new feature.

  • More recent version of SQLite (3.8.4)
  • Compiled to asm.js (should be faster, at least on firefox)
  • Changed API. Results now have the form [{'columns':[], values:[]}]
  • Improved GUI of the demo. It now has :
    • syntax highlighting
    • nice HTML tables to display results
    • ability to load and save sqlite database files

If you want to merge only some changes, I can make several distinct pull requests.

@@ -1,20 +1,27 @@
# Need $(EMSCRIPTEN), for example run with emmake make

EMCC=$(EMSCRIPTEN)/emcc -s RESERVED_FUNCTION_POINTERS=2 -O2 --closure 1 -s ASM_JS=0
EMSCRIPTEN?=/usr/bin
EMCC=EMCC_FAST_COMPILER=1 $(EMSCRIPTEN)/emcc -s RESERVED_FUNCTION_POINTERS=2 -s ALIASING_FUNCTION_POINTERS=1 -s OUTLINING_LIMIT=100 -O3
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In current emscripten, no need for EMCC_FAST_COMPILER=1 (on by default). And ALIASING_FUNCTION_POINTERS=1 is the default so that should not be needed either.

Why is there the outlining limit?

@kripken
Copy link
Collaborator

kripken commented Apr 29, 2014

Thanks for submitting this!

@lovasoa
Copy link
Member Author

lovasoa commented Apr 29, 2014

You’re welcome :)
I will remove EMCC_FAST_COMPILER and ALIASING_FUNCTION_POINTERS
I added OUTLINING_LIMIT because I got a warning ("Output contains some very large functions [...]"). But I still get it, and firefox still takes several hundreds of ms to compile the code. I can't figure out what value to give to OUTLINING_LIMIT...

@ispedals
Copy link

For what it's worth, this also fixes non-ASCII TEXT values being improperly decoded.

@kripken
Copy link
Collaborator

kripken commented Apr 30, 2014

An outlining limit of 500 is going to be very bad for throughput, check that.

@lovasoa
Copy link
Member Author

lovasoa commented Apr 30, 2014

But even with that, sqlite3_exec doesn't seem to be outlined, and is
signaled by firefox as being slow to compile. Is there a way to specify
which functions to outline ?

@kripken
Copy link
Collaborator

kripken commented May 2, 2014

No, just by size right now.

Outlining always makes things slower, and is bad for code size too. Perhaps we should ship an outlined and a non-outlined version, so people can choose either fast startup or fast throughout.

@lovasoa
Copy link
Member Author

lovasoa commented May 3, 2014

Yes, maybe we should do that.
But I don't know how to compile the quick startup version, since even with a low OUTLINING_LIMIT, firefox takes more than 2 seconds to compile the code, and complains about _sqlite3VdbeExec compiling slowly.

@lovasoa
Copy link
Member Author

lovasoa commented May 3, 2014

I added an outlining benchmark: http://lovasoa.github.io/sql.js/test/outlining/benchmark.html
(the results may be affected by garbage collection, so you may have to run it several times to get significant results)
I will delete it when it's not needed anymore.
I was a bit surprised by the results: outlining doesn't seem to have any significant impact on the speed of the compiled asm.js code. However, apart from that, it has only negative consequences, as you stated. That can be seen by running the test in chrome.

For now, I chose an OUTLINING_LIMIT of 6500. With that, it takes around 3 seconds for Firefox to compile the code.

I think the only solution to create the fast startup version, is to not to use the amalgamation of sqlite, but the base source code (http://www.sqlite.org/amalgamation.html). What do you think about it?

@lovasoa
Copy link
Member Author

lovasoa commented May 3, 2014

Or maybe we could just ship a non-asmjs version, that wouldn't have the compilation overhead...

…tlining. Generate a non-asmjs version with even shorter loading times.

Performance is now very good in both Firefox and Chrome with the asm.js version.
With the non-asm version, firefox can take a few hundred ms to execute complex queries
@lovasoa
Copy link
Member Author

lovasoa commented May 5, 2014

Do you think it can be merged now?

@lovasoa
Copy link
Member Author

lovasoa commented May 28, 2014

@kripken ?

@lovasoa
Copy link
Member Author

lovasoa commented Jun 11, 2014

Hello !

Don't keep track of finalized statements.
@kripken
Copy link
Collaborator

kripken commented Jun 11, 2014

Sorry, this keeps dropping off my radar...

@kripken
Copy link
Collaborator

kripken commented Jun 11, 2014

I added you as a collaborator now. Again, sorry - my other emails keep drowning out this one and I miss it. I just don't have the time to focus on this project myself.

@lovasoa
Copy link
Member Author

lovasoa commented Jun 12, 2014

Thanks!

lovasoa added a commit that referenced this pull request Jun 12, 2014
* Update SQLite to 3.8.5
* Change the API
* Add support for prepared statements
* Add support for BLOBs
* Compile to asm.js
* Many other things, see the commits
@lovasoa lovasoa merged commit 55b6177 into sql-js:master Jun 12, 2014
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.

3 participants