[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [creduce-dev] [RFC] Switching from Perl to Python

Oh, seems like a will have a hard time to convince you that Python is not too bad in the end. When I first used Python I was sceptical as well but after using it for some time it has become a convenient tool for tasks which require a little bit more than just a shell script. But I guess that is what you would use Perl for.

Well, I'm not especially opposed, it just has never grabbed me.

Just be clear, I run the same passes for both version (Perl and Python). Because the Python version is not complete yet, I had to disable some of the passes in the Perl version. I also checked that both version produce the same reduced file in the end.
It might be that not using the original test scripts but Python based ones have caused the difference. But as long as performance is not a main criterion for you I would spent more time in analysis this.

I see, very interesting. Yes, probably the reduced forking is the win then.

I would be willing to do the rewriting. Though instead of just "translating" the Perl code into Python I would suggest to think about potential changes to improve the maintainability and readability. Maybe you have something that you always wanted to change anyway but never had the time?
I think that could be easily done in the style of small code reviews by splitting the work up into smaller chunks.

Yes, absolutely, there's no requirement for a line-by-line rewrite. I'll have to look at the code to find things I'm unhappy with, but the short version is I've rewritten the C-Reduce core enough times that I'm pretty happy with it.

One thing I've wanted is a way to better specify the pass ordering, which is kind of hacky. It would also be nice to allow users to customize the passes using a little file. Also we'd like to customize the passes based on the language that is being reduced.

Regarding the passes, there's some pretty bad stuff in the regex-based passes. These are basically the original C-Reduce code from the mid/late 2000s. It would be great to find better ways to do these rewrites.

In the meantime, it should be easy enough to just invoke the Perl interpreter to run these passes. No need to touch them or even look at them!