Open James4Ever0 opened 1 year ago
I believe is for the same reason as https://github.com/extremeheat/JSPyBridge/issues/67#issuecomment-1618083903 / https://github.com/extremeheat/JSPyBridge/pull/103#issuecomment-1765155766, just with the opposite direction. JSON serialization isn't suitable to transfer big binary data.
PR https://github.com/extremeheat/JSPyBridge/pull/103 proposes a new transfer strategy that would fix the Js -> Py direction. Something similar will be needed for Py -> Js. And I suppose pythonia will be affected as well and equally require a bidirectional fix.
However, note that it will still be more performant to produce data natively in the language where it's needed and avoid transferring big values if you can help it, for even though the transfer can be made much more efficient, it will always add some overhead. This is because Js/Py are separate processes that do not share the same memory, but have to communicate over a pipe instead.
To demonstrate this problem, the following code is used:
I can only get this working by writing this in javascript and read the file in the js script, only return the final result to python.