Skip to content
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

feat(all): update libraries #280

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open

feat(all): update libraries #280

wants to merge 15 commits into from

Conversation

m1ga
Copy link
Contributor

@m1ga m1ga commented Aug 13, 2022

  • update github workflow

Android

This new API release provides major benefits including optimized support for concurrent database access, drastic performance improvements, API simplification, and codebase modernization.

iOS

  • update sqlite to 3.42.0

Binary:
appcelerator.encrypteddatabase-android-5.0.1.zip

appcelerator.encrypteddatabase-iphone-4.0.1.zip


according to SQLCipher: 59.59 sec vs 3.01 sec (Pixel 6):
Screenshot_20220814_005040

source: SQLCipher

My tests:

normal: 10.05 sec
4.1.0: 54.5 sec
5.0.0: 39.5 sec
var DB = require('appcelerator.encrypteddatabase');
var instance = null;
var dataTofetch = null;
var win = Ti.UI.createWindow();
var lbl = Ti.UI.createLabel();
var timeStart = 0;
win.addEventListener('open', function() {
	timeStart = new Date();
	init();
	setup();
	insert();
	fetch();
	closeDB();
	lbl.text = ((new Date()) - timeStart) / 1000 + " sec";
});

function init() {
	DB.password = 'secret';
	Ti.API.info('Opening DB ...');
	// instance = Ti.Database.open('myDatabase');	// use normal database
	instance = DB.open('test.db');
}

function setup() {
	console.log("setup");
	instance.execute('CREATE TABLE IF NOT EXISTS testtable(id integer PRIMARY KEY);');
	for (var i = 0; i < 10000; ++i) {
		console.log("adding row " + i);
		instance.execute('INSERT OR IGNORE INTO testtable(id) VALUES (' + i + ');');
	}
}

function insert() {
	console.log("insert");
	var dataToInsertHandle = instance.execute('SELECT id FROM testtable ORDER BY id DESC LIMIT 1;');
	var dataToInsert = null;
	if (dataToInsertHandle.isValidRow()) {
		dataToInsert = (dataToInsertHandle.fieldByName('id') + 1);
		dataTofetch = dataToInsert;
	}
	instance.execute('INSERT OR IGNORE INTO testtable(id) VALUES (' + dataToInsert + ');');

	for (var i = dataToInsert; i < dataToInsert + 10000; ++i) {
		console.log("adding row " + i);
		instance.execute('INSERT OR IGNORE INTO testtable(id) VALUES (' + i + ');');
	}
}

function fetch() {
	console.log("read");
	var rowValue = null;
	for (var i = 0; i < 10000; ++i) {
		var dataTofetch = Math.round(Math.random() * 10000);
		var rowHandle = instance.execute('SELECT * FROM testtable WHERE id=' + dataTofetch + ';');
		if (rowHandle.isValidRow()) {
			rowValue = rowHandle.fieldByName('id');
			console.log("got value: " + rowValue);
		}
	}
}

function closeDB() {
	instance.close();
}
win.add(lbl);
win.open();

@m1ga m1ga marked this pull request as ready for review August 21, 2022 19:09
@m1ga m1ga changed the title feat(android): update feat(all): update libraries Sep 13, 2022
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.

1 participant