Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

[mob] Use diff val for fetch & parallel indexing

Neeraj Guptaeee168837e82
diff --git a/mobile/lib/services/machine_learning/face_ml/face_ml_service.dart b/mobile/lib/services/machine_learning/face_ml/face_ml_service.dart
index 8cbf5173eb..d88b8f041b 100644
--- a/mobile/lib/services/machine_learning/face_ml/face_ml_service.dart
+++ b/mobile/lib/services/machine_learning/face_ml/face_ml_service.dart
@@ -84,7 +84,7 @@ class FaceMlService {
bool isInitialized = false;
bool isImageIndexRunning = false;
- int kParallelism = 15;
+ int kParallelism = 50;
Future<void> init({bool initializeImageMlIsolate = false}) async {
return _initLock.synchronized(() async {
@@ -578,27 +578,29 @@ class FaceMlService {
rethrow;
}
}
-
- for (final enteFile in chunk) {
- if (isImageIndexRunning == false) {
- _logger.info("indexAllImages() was paused, stopping");
- break outerLoop;
- }
- if (_skipAnalysisEnteFile(
- enteFile,
- alreadyIndexedFiles,
- )) {
- fileSkippedCount++;
- continue;
+ final smallerChuncks = chunk.chunks(10);
+ for (final smallerChunck in smallerChuncks) {
+ for (final enteFile in smallerChunck) {
+ if (isImageIndexRunning == false) {
+ _logger.info("indexAllImages() was paused, stopping");
+ break outerLoop;
+ }
+ if (_skipAnalysisEnteFile(
+ enteFile,
+ alreadyIndexedFiles,
+ )) {
+ fileSkippedCount++;
+ continue;
+ }
+ futures.add(processImage(enteFile));
}
- futures.add(processImage(enteFile));
+ final awaitedFutures = await Future.wait(futures);
+ final sumFutures = awaitedFutures.fold<int>(
+ 0,
+ (previousValue, element) => previousValue + (element ? 1 : 0),
+ );
+ fileAnalyzedCount += sumFutures;
}
- final awaitedFutures = await Future.wait(futures);
- final sumFutures = awaitedFutures.fold<int>(
- 0,
- (previousValue, element) => previousValue + (element ? 1 : 0),
- );
- fileAnalyzedCount += sumFutures;
}
stopwatch.stop();