Free and open source application for reading manga, novels, and watching animes available on Android, iOS, macOS, Linux and Windows
Find a file
Mehakdeep Singh 8babb975ab perf(statistics): aggregate inside Isar instead of loading all favourite chapters into memory
Fixes #543. The statistics screen was crashing on Android with a
populated library (~75+ favourites). Repro: open the More -> Statistics
screen on an account with a real-sized library; app hangs and is
killed.

Cause is in `getStatistics()` in `lib/modules/more/statistics/
statistics_provider.dart`. The provider materialised every favourite
manga *and* every chapter of every favourite into a Dart list, then
walked the lists in memory:

    final items = await isar.mangas.filter()...findAll();
    final chapters = await isar.chapters.filter()
        .manga((q) => q.favoriteEqualTo(true)...).findAll();

For a library with 75 favourites at ~100 chapters each that is 7,500+
heavy Isar objects materialised at once just to compute six counts.
The "completed items" loop then re-fetched chapters per completed
manga via the link relation (`item.chapters.toList()`), and the
reading-time aggregation loaded every History row to sum a single
int field.

This commit rewrites the function to do all aggregation inside Isar:

* total / read / completed-items / downloads => `count()` queries on
  indexed filter chains. No object hydration.
* completed favourites => projects only the IDs (`idProperty()`),
  then runs two cheap `count()` queries per item to check
  "has-chapters && unread == 0". Logic is unchanged from the original
  `every(isRead) && isNotEmpty` check.
* reading time => projects the `readingTimeSeconds` field
  (`readingTimeSecondsProperty()`) and folds the resulting List<int?>.
  Avoids hydrating full History rows.

Memory: peak in-memory list shrinks from ~7,500 fully-hydrated chapters
plus all favourite mangas plus all history rows, to (at most) the IDs
of completed favourites (typically <50 ints) and the projected reading-
time list (one int per history row, decoded as a flat list).

DB round-trips: the completed-items branch now does 2 round-trips per
completed favourite instead of 1 link-traversal per completed favourite.
On indexed `mangaId` + `isRead` filters this is sub-millisecond per
query and well below the cost of materialising thousands of rows. The
overall function is faster end-to-end on any non-trivial library.

Behaviour preserved: same six fields, same definitions, same edge
cases (manga with no chapters is not counted as completed).

Verified
- `flutter analyze` clean on the touched file
- `flutter build macos --release` succeeds
- Manual smoke test on macOS with the local-all-fixes build (the bug
  reproduces only with a large mobile library; macOS desktop with a
  small test library returns the same numbers as before)
2026-05-09 23:12:49 -07:00
.github - 2026-01-09 11:54:10 +01:00
android Enhance torrent server functionality and performance 2026-04-13 12:43:13 +01:00
assets adjusted tracker icons 2025-08-25 19:08:50 +02:00
go Enhance torrent server functionality and performance 2026-04-13 12:43:13 +01:00
ios Enhance torrent server functionality and performance 2026-04-13 12:43:13 +01:00
lib perf(statistics): aggregate inside Isar instead of loading all favourite chapters into memory 2026-05-09 23:12:49 -07:00
linux chore: update libmtorrentserver binaries 2026-04-13 14:10:28 +01:00
macos Enhance torrent server functionality and performance 2026-04-13 12:43:13 +01:00
packaging/arch Create PKGBUILD for Arch linux 2025-06-09 21:48:05 +01:00
proto updated grpc fields for Aniyomi backup 2026-04-19 23:42:12 +02:00
repo source update: v0.7.70 2026-04-30 13:19:10 +00:00
rust Update dependencies, refactor HTTP client handling and fix dart extension header handling 2026-04-03 12:13:11 +01:00
rust_builder feat: enhance RhttpCompatibleClient with cancel token support and improve error handling; add new target for Windows ARM64 2026-02-25 12:56:16 +01:00
test first commit 2023-04-03 10:57:02 +01:00
windows chore: update libmtorrentserver binaries 2026-04-13 14:10:28 +01:00
.gitignore integrated ApkBridge for desktop 2026-04-04 23:05:51 +02:00
analysis_options.yaml Upgrade gradle config, Upgrade packages & some fix 2024-12-13 18:21:49 +01:00
devtools_options.yaml changed to a different html widget 2024-12-21 00:21:03 +01:00
ffigen.yaml Added Windows torrent server ffi lib 2024-01-24 11:46:32 +01:00
flutter_rust_bridge.yaml + 2024-09-11 12:04:01 +01:00
l10n.yaml Add fixed versions packages of isar_generator and hive_generator to avoid the Analyzer plugin error 2025-08-25 13:21:37 +01:00
LICENSE Update LICENSE 2023-04-17 09:20:00 +01:00
pubspec.lock Update 2026-05-08 15:05:03 +01:00
pubspec.yaml Update 2026-05-08 15:05:03 +01:00
README.md Update README 2026-04-07 15:59:34 +01:00

Mangayomi

GitHub downloads star Discord server

Mangayomi is an open-source Flutter app for reading manga, novels, and watching animes across multiple platforms.

Features

Features include:

  • Reading manga, webtoons, comics, novels, animes, movies, and more.
  • Local reading of content.
  • A configurable reader with multiple viewers, reading directions and other settings.
  • Tracker support for anime and manga: MyAnimeList, AniList, SIMKL, trakt and Kitsu support.
  • Categories to organize your library.
  • Light and dark themes.
  • Create backups locally to read offline or to your desired cloud service.

Download

Get the app from our releases page.

iOS Sideloading Sources

AltStore Source   Feather Source   Sidestore Source   Direct URL Source

Note: Only future releases (> 0.5.2) will be signed (and therefore have AltStore/SideStore compatibility).

Contributing

Contributions are welcome!

To get started with extension development, see CONTRIBUTING-DART.md for create sources in Dart or CONTRIBUTING-JS.md for create sources in JavaScript.

Using flutter_rust_bridge

To run and build this app, you need to have Flutter SDK and Rust toolchain installed on your system. You can check that your system is ready with the commands below. Note that all the Flutter subcomponents should be installed.

rustc --version
flutter doctor

You also need to have the CLI tool for flutter_rust_bridge ready.

cargo install 'flutter_rust_bridge_codegen'

run the following command:

flutter_rust_bridge_codegen generate

Now you can run and build this app just like any other Flutter projects.

flutter run

License

Copyright 2023 Moustapha Kodjo Amadou

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Disclaimer

Mangayomi is not hosting any kind of content and the developer(s) of this application does not have any affiliation with the content providers that are freely available in the internet.