Open maleadt opened 1 year ago
A single line change is all you need to use cvise
:
cvise
diff --git a/reduce b/reduce
index 9b4a8ff..be55ba6 100755
--- a/reduce
+++ b/reduce
@@ -34,4 +34,5 @@ for path in "${SOURCES[@]}"; do
done
chmod +w src/*
-nice -n 20 creduce --timeout 60 --tidy --n $(nproc) --not-c "$@" ./run src/*
+# cvise doesn't like folders
+cd src && nice -n 20 cvise --timeout 60 --tidy --n $(nproc) --not-c "$@" ../run *.jl
if you don't cd src
, cvise
throw an error:
cvise.utils.error.FolderInPathTestCaseError: Test case cannot contain a folder in path: 'src/10.jl'!
We should try this out to see if it improves reducing Julia code.
I haven't compared the speed of the two programs,
but I've found that cvise
is configurable and very extensible with minor modifications.
With --pass-group-file pass.json
, We can specify that certain passes should be used or skipped.
cvise
calls external programs through child processes.
I guess we could hack cvise.py
to implement julia-specific passes (By calling julia script).
e.g. automatically remove all comments, format code before output, etc.
Possible ways to extend: Inherit class AbstractPass
to write julia-specific subclasses,
and add the new subclasses to CVise.pass_name_mapping
, then we can use this pass in our json.
What a coincidence, I just tried cvise
(necessitating the above change) just today as well! Couldn't notice a significant improvement either, likely because we aren't generally bottlenecked by the speed of the reducer, but by Julia taking a long time to compile and run code.
@gbaraldi pointed me towards https://github.com/marxin/cvise, which is supposedly a faster version of creduce, and should be fully compatible. We should try this out to see if it improves reducing Julia code.