excalidraw-jetbrains-plugin
excalidraw-jetbrains-plugin copied to clipboard
Rework Plugin / JCef exchange of file payload
Currently file are exchanged as base64 strings in a payload run by CefFrame::executeJavaScript, this is not optimal for several reasons :
- Base 64 encoding increase the size by ~33 % (not even accounting the line breaks)
- Given excalidraw can embed pictures, the payload can be even bigger.
- Big strings (backed by an array) will cause on G1GC (the default on IJ at this time) to create humongous region if the string is bigger than half the region size (which by default depends on the total Java heap).
- Java heap of
4 GiBusually have2 MiBregions, so HO are created when content is over1 MiB, - Java heap of 2 GiB usually have 1 Mib regions, so HO are created when content is over
512 KiB.
- Java heap of
In order to improve that aspects there are multiple options
- Use "the server" that would be able to server and receive files
- Avoid facing the problem by changing the encode to uuEncoding. (Not a lot of implementation out there : https://github.com/biagioT/java-uudecoder)
- Explore approaches using browser file system APIs (may not be be supported by Cef)
- https://developer.mozilla.org/en-US/docs/Web/API/FileSystem
- https://developer.chrome.com/docs/apps/reference/fileSystem