[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Piping contents of SVG directly to stdout
From: |
Jean Abou Samra |
Subject: |
Re: Piping contents of SVG directly to stdout |
Date: |
Sun, 17 Jul 2022 18:11:54 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 |
Le 15/07/2022 à 21:15, DoubleFelix a écrit :
Hello,
I'm using lilypond to programmatically generate sheet music. I already
have a system in place to crop the SVGs, but now I need to load them
in my software. I could use the default behavior of letting lilypond
write to some file, and then reading it, but file I/O tends to be
pretty expensive, especially when you're doing it in bulk like I am,
so I'd like to avoid that.
My question is this: Is there a way to get lilypond to write the
output to stdout to save on performance, or do I need to use a file as
a middleman? For reference, my current command is:
"lilypond --svg --loglevel=none file.ly <http://file.ly>"
I don't think this exists. On the other hand, I strongly
doubt that file I/O can prove expensive compared to the
time required to process the LilyPond file. For example,
with Python,
$ time lily -s --svg input/regression/parenthesize.ly
real 0m0,719s
user 0m0,637s
sys 0m0,061s
$ python
Python 3.10.5 (main, Jun 9 2022, 00:00:00) [GCC 12.1.1 20220507 (Red
Hat 12.1.1-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from pathlib import Path
>>> from timeit import timeit
>>> timeit("Path('parenthesize.svg').read_bytes()", number=1000,
globals=globals())
0.015240808002999984
As you can see, the time taken to read the output SVG
file was 2% of the time to compile the file in this example.
Best,
Jean
Re: Piping contents of SVG directly to stdout, William, 2022/07/18