[metapost] Running mpost as a unix daemon?

Hans Hagen pragma at wxs.nl
Thu Feb 20 09:35:50 CET 2014


On 2/20/2014 12:00 AM, Dave Crossland wrote:
> Hi!
>
> https://github.com/metapolator/metapolator/ is a font family editor
> application, which calls mpost
>
> This means the application is slow, because in
> https://github.com/metapolator/metapolator/blob/master/metapolator/views.py#L876
> we use the Python standard library's subprocess.Popen and incur a long
> startup time each time it is run.

you could use it as library and then avoid the run

> Non-Solution: Jonathan Fine's
> https://bitbucket.org/jfine/tex-daemon/src/default/texd/py/metapost/metapostdp.py
> looked like it might speed things up, but it seems it won't because it
> isn't really a metapostd, but a wrapper that makes metapost appear
> like a daemon, but still starts up metapost each time with
> subprocess.Popen on
> https://bitbucket.org/jfine/tex-daemon/src/default/texd/py/tex/util.py#83
>
> I see 3 options for making this work as a daemon:
>
> Option: Write a new C/C++ unix daemon 'metapostd' in C, to run MPLib
> as so there is no start up time
>
> Option: Write a python binding for MPLib, to access metapost
> calculations directly from Python
>
> Option: Write a nodejs binding for MPLib, to access metapost
> calculations directly from node
>
> I wonder what the metapost community thinks about these options -
> which would be most widely useful?
>
> I'd love it if we could make a metapostd in python, but not sure its possible.

It's not so hard to make such a deamnon (after all it's a library) but 
you need to keep in mind that unless you have a limited well known 
application you still have to restart the mp session from scratch as 
macros can rewrite themselves, variables can be set, and one run can 
influence an upcoming one.

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------



More information about the metapost mailing list