Skip to content

Commit c210c21

Browse files
committed
Use Perl instead of Ruby in %rename
Ruby can be quite slow to start on some configurations. Using Perl speeds up the generation of all the wrappers by a factor of 30: down from 6min to 11s.
1 parent c59659c commit c210c21

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

ext/taglib_base/taglib_base.i

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,12 @@ namespace TagLib {
3232

3333
// Rename setters to Ruby convention (combining SWIG rename functions
3434
// does not seem to be possible, thus resort to some magic)
35-
%rename("%(command: ruby -e 'print(ARGV[0][3..-1].split(/(?=[A-Z])/).join(\"_\").downcase + \"=\")' )s",
35+
// setFoo -> foo=
36+
%rename("%(command: perl -e \"print lc(join('_', split(/(?=[A-Z])/, substr(@ARGV[0], 3)))), '='\" )s",
3637
regexmatch$name="^set[A-Z]") "";
3738

3839
// isFoo -> foo?
39-
%rename("%(command: ruby -e 'print(ARGV[0][2..-1].split(/(?=[A-Z])/).join(\"_\").downcase + \"?\")' )s",
40+
%rename("%(command: perl -e \"print lc(join('_', split(/(?=[A-Z])/, substr(@ARGV[0], 2)))), '?'\" )s",
4041
regexmatch$name="^is[A-Z]") "";
4142

4243
// ByteVector

0 commit comments

Comments
 (0)