@@ -5,6 +5,7 @@ import 'package:ndk_rust_verifier/data_layer/repositories/verifiers/rust_event_v
55
66class MyVerifiers {
77 static final bip340Verifier = Bip340EventVerifier ();
8+ static final bip340VerifierNoIsolate = Bip340EventVerifier (useIsolate: false );
89 static final rustVerifier = RustEventVerifier ();
910}
1011
@@ -19,16 +20,25 @@ class QueryPerformancePage extends StatefulWidget {
1920class _QueryPerformancePageState extends State <QueryPerformancePage > {
2021 int _eventCount = 100 ;
2122 String _bip340Time = '' ;
23+ String _bip340NoIsolateTime = '' ;
2224 String _rustTime = '' ;
2325 bool _isVerifyingBip340 = false ;
26+ bool _isVerifyingBip340NoIsolate = false ;
2427 bool _isVerifyingRust = false ;
2528
26- static const relays = ["ws ://localhost:10547 " ];
29+ static const relays = ["wss ://relay.primal.net " ];
2730
2831 final ndkBip340 = Ndk (NdkConfig (
2932 eventVerifier: MyVerifiers .bip340Verifier,
3033 cache: MemCacheManager (),
3134 bootstrapRelays: relays,
35+ logLevel: LogLevel .warning
36+ ));
37+
38+ final ndkBip340NoIsolate = Ndk (NdkConfig (
39+ eventVerifier: MyVerifiers .bip340VerifierNoIsolate,
40+ cache: MemCacheManager (),
41+ bootstrapRelays: relays,
3242 ));
3343
3444 final ndkRust = Ndk (NdkConfig (
@@ -53,6 +63,22 @@ class _QueryPerformancePageState extends State<QueryPerformancePage> {
5363 });
5464 }
5565
66+ Future <void > _runBip340NoIsolateQuery () async {
67+ setState (() {
68+ _isVerifyingBip340NoIsolate = true ;
69+ _bip340NoIsolateTime = '' ;
70+ });
71+
72+ final stopwatch = Stopwatch ()..start ();
73+ await _runQuery (ndkBip340NoIsolate);
74+ stopwatch.stop ();
75+
76+ setState (() {
77+ _isVerifyingBip340NoIsolate = false ;
78+ _bip340NoIsolateTime = '${stopwatch .elapsedMilliseconds }ms' ;
79+ });
80+ }
81+
5682 Future <void > _runRustQuery () async {
5783 setState (() {
5884 _isVerifyingRust = true ;
@@ -135,6 +161,23 @@ class _QueryPerformancePageState extends State<QueryPerformancePage> {
135161 style: Theme .of (context).textTheme.bodyLarge,
136162 ),
137163 const SizedBox (height: 24 ),
164+ ElevatedButton (
165+ onPressed: _isVerifyingBip340NoIsolate ? null : _runBip340NoIsolateQuery,
166+ child: _isVerifyingBip340NoIsolate
167+ ? const SizedBox (
168+ height: 20 ,
169+ width: 20 ,
170+ child: CircularProgressIndicator (strokeWidth: 2 ),
171+ )
172+ : const Text ('Run with BIP340 (no isolate)' ),
173+ ),
174+ const SizedBox (height: 8 ),
175+ Text (
176+ _bip340NoIsolateTime.isEmpty ? 'Not run yet' : 'Time: $_bip340NoIsolateTime ' ,
177+ textAlign: TextAlign .center,
178+ style: Theme .of (context).textTheme.bodyLarge,
179+ ),
180+ const SizedBox (height: 24 ),
138181 ElevatedButton (
139182 onPressed: _isVerifyingRust ? null : _runRustQuery,
140183 child: _isVerifyingRust
0 commit comments