I agree that this is an interesting idea, but before adding it I also
would like to see at least one case where it improves efficiency is a
measurable way or else that it leads to a more readable predicate.
My guess is that it will be possible to speed up reductions that are
already fast, but I don't find that very necessary.
On the other hand, it would be great to speed up reductions that are
currently slow, but those are generally dominated by overhead in the
forked code, not overhead of fork itself.
But I'm happy to be shown wrong.
I'll add that I have a small pile of speedups to implement in C-Reduce,
some of which will make a difference in practice, I think.
John
On 6/20/12 8:01 AM, Eric Eide wrote:
"Konstantin" == Konstantin Tokarev<[email protected]> writes:
Konstantin> I think that it could be useful to add support for
Konstantin> predicates written in perl to creduce. In this case
Konstantin> predicate could be loaded as a module reducing run
Konstantin> overhead.
This is an interesting idea. Do you have an example of a predicate that you
would actually like to use like this?
I can think of at least two reasons that someone might want to use a predicate
written in Perl. This first is that somebody might simply want to use Perl
language features --- Perl regexps, existing Perl modules, etc. The second is
to be more efficient at run time.
In thinking about the overhead of shell scripting, consider: If the predicate
has to invoke one (or more) C/C++ compilers, and possibly a validity-checking
tool like Frama-C or KCC, there is a limit to how much efficiency can be gained
by moving the predicate script itself from shell to Perl.
Although I haven't measured it, I would expect that the time spent forking
shells and whatnot for an external predicate script is quite small compared to
the time taken by the compiler and Frama-C/KCC, which are invoked by the
script --- regardless of whether the script is written in shell or Perl.
If you have an example of an "in creduce" predicate that would be much more
efficient for you, I would like to see it!
Thanks ---
Eric.