-
Notifications
You must be signed in to change notification settings - Fork 32
Performance improvement for content script when loading hundreds of snippets #296
Comments
Using the
The only solution I can think of to this is to disable Enter key and Tab key from being used, which is not at all ideal. So, we'll use the |
|
Selection change does not fire on: backspace, delete, ctrl-x. Also, no need of trie as object access in js is already O(1). And my Data.getUniqueSnip function is hence O(1) |
Even at the latest commit (b4ab33b), this has the problem of taking up infinite memory in Chrome. After binary searching by putting Further investigation reveals, putting a |
This test code:
inserts as many snippets as it can into the context menu in one second. Turns out that figure is around 1200 snippets in 1.005 seconds approx. Also, upping the I would believe therefore that a safe limit to number of context menu items is 500 items max. Any more than that and they should be clipped. How to clip them is something we need to decide. What do you think? |
The currently demarcated safe limit is 800 snippets. It's really huge though. We should note that given the infinite nesting we support, it is possible to have 10 main level folders, and 10 more folders within each. In this, we have 100 folders and even if each folder has five snippets, we have five hundred ctx menu entries. In this situation, it takes three simple snippets to navigate even to the 500-th snippet. So, it is not impossible that a user with a hundred snippets wouldn't use the context menu. |
Content script should query the background page every time user presses a hotkey (while also cancelling the event).
If the hotkey is valid, insert the snippet as before. If the hotkey is invalid, use
chrome.debugger
to dispatch the hotkey event using thekey
andcode
properties as usual. (link)This will avoid the problem of every tab getting a list of hundreds of snippets and loading it in the tab.
So, the whole thing is almost done in branch performance-improvement. Now, we first need to upgrade the hotkey storage in #140 for v3.6.2 upgrade, and then push this upgrade out in v3.6.3. Reason being chrome debugger doesn't support
keyCode
but rather onlykey
andcode
.The text was updated successfully, but these errors were encountered: