{{ message }}
simplify dist by merging sql-asm-memory-growth.js into sql-asm.js#431
Open
kaizhu256 wants to merge 3 commits into
Open
simplify dist by merging sql-asm-memory-growth.js into sql-asm.js#431kaizhu256 wants to merge 3 commits into
kaizhu256 wants to merge 3 commits into
Conversation
Co-authored-by: Yan Li <yanli0303@outlook.com> Co-authored-by: kai zhu <kaizhu256@gmail.com>
Member
Member
Author
|
good question. the following benchmark indicates asm2 is 1-6% slower running queries on a 60mb database: you can emulate above result in following steps:
copy all tables in 60mb database-- create database-schema
CREATE TABLE `employeelist2` (
`eid` integer NOT NULL PRIMARY KEY AUTOINCREMENT
, `firstName` varchar(31) NOT NULL DEFAULT ''
, `lastName` varchar(31) NOT NULL DEFAULT ''
, `Email_id` varchar(31) NOT NULL DEFAULT ''
, `Email2` varchar(31) DEFAULT NULL
, `Email3` varchar(31) DEFAULT NULL
, `EMail4` varchar(31) DEFAULT NULL
, `folder` varchar(31) NOT NULL DEFAULT ''
, `status` varchar(50) DEFAULT NULL
, UNIQUE (`Email_id`)
);
CREATE TABLE `message2` (
`mid` integer NOT NULL DEFAULT '0'
, `sender` varchar(127) NOT NULL DEFAULT ''
, `date` datetime DEFAULT NULL
, `message_id` varchar(127) DEFAULT NULL
-- , `subject` text
-- , `body` text
, `folder` varchar(127) NOT NULL DEFAULT ''
, PRIMARY KEY (`mid`)
);
CREATE TABLE `recipientinfo2` (
`rid` integer NOT NULL DEFAULT '0'
, `mid` integer NOT NULL DEFAULT '0'
, `rtype` text DEFAULT NULL
, `rvalue` varchar(127) DEFAULT NULL
, `dater` datetime DEFAULT NULL
, PRIMARY KEY (`rid`)
, FOREIGN KEY (mid) REFERENCES message2(mid)
);
CREATE TABLE `referenceinfo2` (
`rfid` integer NOT NULL DEFAULT '0'
, `mid` integer NOT NULL DEFAULT '0'
, `reference` text
, PRIMARY KEY (`rfid`)
, FOREIGN KEY (mid) REFERENCES message2(mid)
);
CREATE INDEX "idx_message_sender2" ON "message2" (`sender`);
CREATE VIRTUAL TABLE messages_ft2 USING fts4(subject, body);
-- insert tables
-- employeelist2
-- message2
-- recipientinfo2
-- referenceinfo2
-- message_ft
SELECT 'employeelist', COUNT(*) FROM employeelist;
SELECT 'message', COUNT(*) FROM message;
SELECT 'recipientinfo', COUNT(*) FROM recipientinfo;
SELECT 'referenceinfo', COUNT(*) FROM referenceinfo;
SELECT 'messages_ft', COUNT(*) FROM messages_ft;
INSERT INTO message2 SELECT * FROM
(
SELECT
message.mid,
message.sender,
message.date,
message.message_id,
-- message.subject,
-- message.body,
message.folder
FROM
(
SELECT DISTINCT message.mid
FROM message
INNER JOIN recipientinfo ON recipientinfo.mid = message.mid
INNER JOIN referenceinfo ON referenceinfo.mid = message.mid
) AS tmp1
INNER JOIN message ON message.mid = tmp1.mid
ORDER BY tmp1.mid
LIMIT 10000
) AS tmp1;
INSERT INTO employeelist2 SELECT * FROM employeelist;
INSERT INTO recipientinfo2 SELECT
tmp1.rid,
tmp1.mid,
tmp1.rtype,
tmp1.rvalue,
tmp1.dater
FROM message2
LEFT JOIN recipientinfo AS tmp1 ON tmp1.mid = message2.mid
ORDER BY tmp1.rid;
INSERT INTO referenceinfo2 SELECT
tmp1.rfid,
tmp1.mid,
tmp1.reference
FROM message2
LEFT JOIN referenceinfo AS tmp1 ON tmp1.mid = message2.mid
ORDER BY tmp1.rfid;
INSERT INTO messages_ft2 (
rowid, subject, body
)
SELECT
tmp1.rowid, tmp1.subject, tmp1.body
FROM message2
INNER JOIN messages_ft AS tmp1 ON tmp1.rowid = message2.mid
ORDER BY tmp1.rowid;
VACUUM;
SELECT 'employeelist2', COUNT(*) FROM employeelist2;
SELECT 'message2', COUNT(*) FROM message2;
SELECT 'recipientinfo2', COUNT(*) FROM recipientinfo2;
SELECT 'referenceinfo2', COUNT(*) FROM referenceinfo2;
SELECT 'messages_ft2', COUNT(*) FROM messages_ft2;
--*/fts-query with joinsSELECT * FROM messages_ft2
INNER JOIN recipientinfo2 ON recipientinfo2.mid = messages_ft2.rowid
INNER JOIN referenceinfo2 ON referenceinfo2.mid = messages_ft2.rowid
WHERE body MATCH 'energy NEAR oil'; |
Member
Author
|
also the difference in size is < 1%: |
Member
|
If we want to be able to merge this without breaking backwards compatibility, we can first add On the next major version bump, we can delete the memory growth version. |
…includes memory-growth and ie11 support.
Member
Author
…ow essentially a copy of sql-asm.js
Member
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.




Co-authored-by: Yan Li yanli0303@outlook.com
Co-authored-by: kai zhu kaizhu256@gmail.com
this implements suggestion #239 (comment)
removed or edited all references to memory-growth using command
git grep -i 'memory.*growth'