Running Sage from other languages with high(er) performance?
-c command line option and executing it through PHP with
This approach is extremely slow (takes several seconds and CPU load is fairly high). This is - as far as I'm aware - a result of Sage having to load all its libraries each time it's run.
Is there any way I can optimize this approach? I would prefer an approach similar to the
-c option where I can just send a command and read the printed result.
I have no issues writing a wrapper in C (or Python if neccessary), nor working with sockets (if any are available) provided it can be done as simple as the
-c option (the WebSocket messages seen in Sage Cell seems too much trouble to do manually).
What I need to know is mostly whether or not it's even possible, if so then where to start otherwise I'd like to know if there are any alternative approaches?
Why not use Sage Cell/Cloud?
- I don't have complete control of the UI, so I can't actually embed a Sage Cell.
- The CAS tool is part of a much larger system with other services sharing resources.
- Both are a bit overkill for the job since they include a UI and webserver - I just need to send the command and read the response.