[sage-support] avoiding startup time cost with multiple invocations

2018-01-10 Thread Berkeley Churchill
As part of a research project we're using sage as a subroutine for some matrix computations over rings. We have hundreds or thousands of these computations, but each computation is fairly quick. Right now, for each computation we write python code into a .sage file, and then start a new proce

Re: [sage-support] avoiding startup time cost with multiple invocations

2018-01-10 Thread Berkeley Churchill
.is_prime()\n"); >Py_Finalize(); >return 0; > } > }}} > > 2. Then to compile you need to do > > $ sage -sh > $ gcc $(python2-config --cflags) $(python2-config --ldflags) test.c > > 3. Run the program (still in the sage-sh shell) > > $ .

Re: [sage-support] avoiding startup time cost with multiple invocations

2018-01-11 Thread Berkeley Churchill
I'll look into using a pipe, that's a good suggestion and might be easier than the embedded interpreter. On Jan 10, 2018 23:54, "Jori Mäntysalo" wrote: On Wed, 10 Jan 2018, Berkeley Churchill wrote: (@Jori: unfortunately starting one process and doing all the computat