IEnumerator AsyncPerformanceTestCoroutine() { // Copy Database yield return(StartCoroutine( CopyFileFromStreamingAssetsToPersistanceFolder("db.sqlite"))); SQLiteExt.Handle handle = new SQLiteExt.Handle(); // Open Database yield return(StartCoroutine( this.SQLiteOpenDatabase(ExtensionMethods.AppWritableDirectory() + "/db.sqlite", handle))); // Select yield return(StartCoroutine( this.SQLiteQuery("SELECT * FROM en WHERE word like 'a%' LIMIT 1", handle))); // Step yield return(StartCoroutine( this.SQLiteStep(handle))); if (handle.Success) { UnityEngine.Debug.Log(handle.Query.GetString("word")); } // release query yield return(StartCoroutine( this.SQLiteRelease(handle))); // Close database yield return(StartCoroutine( this.SQLiteCloseDatabase(handle))); log += "\ndone."; }
IEnumerator AsyncPerformanceTestCoroutine() { Stopwatch stopwatch = new Stopwatch(); log = "Coroutine Api Test"; // Copy Database yield return(StartCoroutine( CopyFileFromStreamingAssetsToPersistanceFolder("db.sqlite"))); SQLiteExt.Handle handle = new SQLiteExt.Handle(); // Open Database stopwatch.Start(); yield return(StartCoroutine( this.SQLiteOpenDatabase(Application.persistentDataPath + "/db.sqlite", handle))); stopwatch.Stop(); log += "\n Open Database: " + stopwatch.ElapsedMilliseconds + " msec"; // Select stopwatch.Start(); yield return(StartCoroutine( this.SQLiteQuery("SELECT * FROM en WHERE word like 'a%' LIMIT 1", handle))); stopwatch.Stop(); log += "\n Create Query: " + stopwatch.ElapsedMilliseconds + " msec"; // Step stopwatch.Start(); yield return(StartCoroutine( this.SQLiteStep(handle))); stopwatch.Stop(); log += "\n Step: " + stopwatch.ElapsedMilliseconds + " msec"; if (handle.Success) { UnityEngine.Debug.Log(handle.Query.GetString("word")); } // release query stopwatch.Start(); yield return(StartCoroutine( this.SQLiteRelease(handle))); stopwatch.Stop(); log += "\n Relese query: " + stopwatch.ElapsedMilliseconds + " msec"; // Close database stopwatch.Start(); yield return(StartCoroutine( this.SQLiteCloseDatabase(handle))); stopwatch.Stop(); log += "\n Close Database: " + stopwatch.ElapsedMilliseconds + " msec"; log += "\ndone."; }