FooSoft / yomichan

Japanese pop-up dictionary extension for Chrome and Firefox.
https://foosoft.net/projects/yomichan
Other
1.06k stars 213 forks source link

Anki freezes due to AnkiConnect & Yomichan with large deck sizes #993

Closed kanjieater closed 3 years ago

kanjieater commented 3 years ago

When a user has a large collection size, AnkiConnect and Anki freezes when yomichan attempts to show the green buttons. They never show, and it makes anki unusable while a search is happening. My collection size is greater than 200k cards.

I have the collection search settings to the deck only in yomichan. This yomichan deck only contains 6 cards.

I'm guessing this is related to the duplication search, and am hoping there is a way to disable it to workaround it.

I believe this to be unrelated to the issue I just posted here as I'm using a different profile here: https://github.com/FooSoft/yomichan/issues/992

toasted-nutbread commented 3 years ago

I assume you mean the Duplicate scope option?

If so, then any slowness that occurred with that value as Collection will still occur, due to how that is implemented in AnkiConnect. I can take a look to see if that redundant check can be removed for the non-Collection modes in AnkiConnect.

kanjieater commented 3 years ago

I assume you mean the Duplicate scope option?

If so, then any slowness that occurred with that value as Collection will still occur, due to how that is implemented in AnkiConnect. I can take a look to see if that redundant check can be removed for the non-Collection modes in AnkiConnect.

That is correct, the option is Duplication Scope. It's set to Deck, but it does seem like it's having the performance problems of searching the collection. Let me know if you need anything else on my end.

Searches inside of anki's search feature though perform in less than a second still.

toasted-nutbread commented 3 years ago

I've submitted a change to AnkiConnect that should improve performance when searching using Duplicate scope = Deck mode, but it's not likely to be more performant than the Collection mode; the code is roughly the same. It looks like Anki recently changed its implementation of their duplicate check, so depending on the version of Anki you're using, and if that change has been released, maybe that can affect things.

kanjieater commented 3 years ago

I'm on :

I'm on: Version 2.1.22 (0ecc189a) Python 3.8.0 Qt 5.14.1 PyQt 5.14.1 Windows 10

I can test your change now, and I'll let you know.

kanjieater commented 3 years ago

It does seem faster. It is a little unreliable though: https://altema.jp/megaten3/daisojo

If you have a card for: 菩提

It won't let you add a card for 煩悩即菩提

It also thinks the {sentence} is 煩悩即菩提, when it's really

だいそうじょうは、HPを一定以下に減らすと精神属性スキル「煩悩即菩提」を使用するので、精神耐性の高い仲魔を編成しましょう。

Should I just make these as two separate issues, one for the sentence missing, and one for false duplicate?

Would it be possible to just have an option to not look for the duplicate & allow for duplicates?

toasted-nutbread commented 3 years ago

The missing sentence is working as designed, although maybe unexpected. "Sentences" are terminated by quotes or quote-like characters, hence why that part is detected as the sentence.

I'll look into the second issue.

toasted-nutbread commented 3 years ago

I am able to add both 菩提 and 煩悩即菩提; how are you able to tell that that 菩提 is causing the issue?

kanjieater commented 3 years ago

I think I had it backwards. I made a card for 煩悩即菩提. It won't let me make a card for 菩提 or 即. It also can be very slow between look ups.

toasted-nutbread commented 3 years ago

I am able to create all of the terms in any order. When you say It won't let me make a card, how do you mean? Are the buttons grayed out? If so, is there a book icon next to them? If not, what else?

kanjieater commented 3 years ago

I think I figured it out. The sentence was always the same since 「煩悩即菩提」 is registered as the sentence. My note's first field is the sentence. I think this is intended behavior for now, though it was a little confusing.

The duplication check is still very slow though for large decks. Would it be possible to optionally ignore the duplication check?

toasted-nutbread commented 3 years ago

So the expected behaviour for your use case would be that the + buttons are always shown in green, and the book icon next to them is not shown, even if the term already exists?

kanjieater commented 3 years ago

So the expected behaviour for your use case would be that the + buttons are always shown in green, and the book icon next to them is not shown, even if the term already exists?

Yes. Due to the duplicate searches freezing anki and yomichan, that seems to be the best way to move forward. This way users could still add more cards even if their deck is large, without freezing yomichan.