Closed
Conversation
I believe that using thit `when` makes the various case.
Sometime, the answer side's image are slow to load, and I find it frustrating as the images were already on the front side. I'm not sure there is a good way to prepare the answer side webview because of the javascript part, but we certainly can prepare the media. This is what I do in a currently very naive heuristic. That is, I search for `src="..."`, and if the part inside the quote corresponds to a media that exists, and it weigths at most 10mb, I prefetch it so that there is no need for file access later. Only the first 20 media are fetched, in order to limit the memory impact. I expect that: * most cards would actually contains less than 20 media and most media of less than 10mb, so probably would still improve most cards, * the memory usage is probably reasonable as it's already the usage in the webview. If this works well and don't cause any issue, I'd love to do the same thing for the question side. But I'd need a back-end method that allows to fetch the potential future question. So I want to experiment with answer side first. Also, when the same media appear in both side, it may be interesting to avoid reading the file twice and instead saving the file during the first read. This improvement would make sense to do if this experiment is a success. If so, doing the same thing for audio can be interesting too.
Member
|
Based on the desktop JS code, the new reviewer is supposed to preload the answer side media. Could you test that (without the changes of this PR)? |
BrayanDSO
requested changes
May 25, 2025
Comment on lines
+59
to
+64
| try { | ||
| WebResourceResponse(guessMimeType(path), null, inputStream) | ||
| } catch (_: Exception) { | ||
| Timber.d("File $mathjaxAssetPath not found") | ||
| null | ||
| } |
Member
There was a problem hiding this comment.
this is a functional change. Exceptions thrown above this aren't catch. And the assertManager.open part is the most likely to throw
Contributor
|
Hello 👋, this PR has had no activity for more than 2 weeks and needs a reply from the author. If you think this is a mistake please comment and ping a maintainer to get this merged ASAP! Thanks for contributing! You have 7 days until this gets closed automatically |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Prefetch 20 media which are at most 10mb to prepare the answer side
Sometime, the answer side's image are slow to load, and I find it
frustrating as the images were already on the front side. I'm not sure
there is a good way to prepare the answer side webview because of the
javascript part, but we certainly can prepare the media.
This is what I do in a currently very naive heuristic. That is, I
search for
src="...", and if the part inside the quote correspondsto a media that exists, and it weigths at most 10mb, I prefetch it so
that there is no need for file access later. Only the first 20 media
are fetched, in order to limit the memory impact. I expect that:
of less than 10mb, so probably would still improve most cards,
the webview.
If this works well and don't cause any issue, I'd love to do the same
thing for the question side. But I'd need a back-end method that
allows to fetch the potential future question. So I want to experiment
with answer side first.
Also, when the same media appear in both side, it may be interesting
to avoid reading the file twice and instead saving the file during the
first read. This improvement would make sense to do if this experiment
is a success.
If so, doing the same thing for audio can be interesting too.