Parallelization of configure_file
#12424
Replies: 1 comment 8 replies
-
What's the actual problem with using generator()? Note that parallelizing configure_file would require the ability to run a meson function, get its return value, and wait until later to do the action that actually creates said return value. There are more high-profile scenarios where this would be nice to have, such as compiler checks which are quite slow as they involve forking the compiler and compiling a file. The line immediately below, may very well be using the result for any reason at all -- compiler checks return booleans usable in It's also not clear to me what's especially slow about configure_file at scale. The major bottleneck that can actually be parallelized is the I/O involved, and the big thing we can do to parallelize this is introduce threads/worker processes. (To contrast this to compiler checks, where we always fork, we'd just have to avoid wait()ing on the subprocess.) Threads are not free, worker processes are even worse. I don't have any numbers on whether it's slower to thread or to wait on writing out all these files though. Are you using configure_file with a command instead of a configuration_data? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I understand that typically the use case for
configure_file
is to spit out one or two headers, such as aversion.h
orconfig.h
based off environment variables or detected compiler/language/runtime features. As such, the fact thatconfigure_file
runs sequentially is inconsequential, as the generation of these files is typically pretty quick.I have a use case in which I want to generate a decent number of headers. For legacy reasons, I really cannot use
generator()
(think cyclic dependencies, and issues where I cannot link at the library-level but at the executable-level).configure_file
seems like a good choice here; my files get generated at configure time, prior to any compilation occuring, so my build configuration is happy.Here's the problem: I want to generate a few hundred files, and the generation of these files is anywhere between 250ms and 1s. Since
configure_file
runs sequentially, this will not work for me. A possible solution, what ifconfigure_file
could be parallellized? Obviously it does introduce new risks, and could induce a slowdown in the case of single-file generation, however I'm not seeing a clear way in how I should do my build configuration otherwise, besides having it done externally to meson.Beta Was this translation helpful? Give feedback.
All reactions