File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed
Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change 11import 'dart:collection' ;
22import 'dart:ffi' ;
3+ import 'dart:io' ;
34
45import 'package:objectbox_benchmark/benchmark.dart' ;
56import 'package:objectbox_benchmark/objectbox.g.dart' ;
@@ -14,6 +15,8 @@ void main() async {
1415
1516 await DynLibProcess ().report ();
1617 await DynLibFile ().report ();
18+
19+ await StoreOpen ().report ();
1720}
1821
1922class ModelInit extends Benchmark {
@@ -102,3 +105,27 @@ class BoxAccessList extends Benchmark {
102105 }
103106 }
104107}
108+
109+ class StoreOpen extends Benchmark {
110+ final String dbDir = 'benchmark-db' ;
111+
112+ StoreOpen () : super ('$StoreOpen ' );
113+
114+ @override
115+ void runIteration (int iteration) {
116+ final store = Store (getObjectBoxModel (), directory: dbDir);
117+ store.close ();
118+ }
119+
120+ @override
121+ void teardown () {
122+ // Note: do not delete before test, not benchmarking file creation time.
123+ deleteDbDir ();
124+ super .teardown ();
125+ }
126+
127+ void deleteDbDir () {
128+ final dir = Directory (dbDir);
129+ if (dir.existsSync ()) dir.deleteSync (recursive: true );
130+ }
131+ }
You can’t perform that action at this time.
0 commit comments