I am using lore knowledge from MMORPG game called Tibia. If I start with all books inside game, which is around 400k tokens. I am directly pasting it into prompt in form of array of strings without spaces.
Then if I start conversation, it will graduatly go from slow, to unacceptable and eventually crash the browser. Each time I write question manually regarding the pasted content, and each time the gemini will answer, each of that response will be generated for each letter of that, and with extra comment inside DOM as visible.
If, after inserting the prompt I will just manually delete the DOM that contains the prompt I just inserted (via dev tools) it won’t crash as I will essentialy delete all of the mess.
This is what other 40k tokens prompt DOM looks like: (168k span elements inside DOM).
If you will eventually start to chat with gemini for a long amount of time, manually writing everything. Each of the prompts letter will be wrapped around . with class.
Each time if you update the DOM with a new node with a new class - each time all CSS inside DOM will need to be revaluated, causing tons of memory to be used.
Not to mention that it is unacceptable for an end user to have 168k span nodes inside his few questions prompt, that advertises it is capable of 1kk token window. 168k span nodes has been generated for 40k tokens.
If I do all books inside the game (400k tokens) and add halved npc knowledge inside game (totaling around 800k tokens) If I paste 800k tokens, and then ask an one or two questions, it will just crash faster. Meaning the longer pasted thing is, the faster it will crash.
The solution is obvious - fix it so it doesnt generate milions of span nodes. Keep it simple - there is no need to have each letter of the word wrapped inside span. Animating the text inside HTML can be done with just css**.
animation: typing 3s steps(30, end), blink 0.5s 1;