Current LMU maintainer was proven unresponsive to concerns about the towering
complexity of that modules dependency chain. Use a pure-perl implementation
of uniq() compatible with the version in LMU 0.4xx series
The slowdown, while noticeable, is of no consequence to the larger codebase
~$ dd if=/dev/urandom bs=512 count=1 2>/dev/null | perl -0777 -Ilib -MSQL::Translator::Utils -MList::MoreUtils::XS -MBenchmark::Dumb -e '
my @list = map ord, split "", <>;
Benchmark::Dumb::cmpthese( 0.0001 => {
lmu => sub {
List::MoreUtils::uniq(@list);
},
pp => sub {
SQL::Translator::Utils::uniq(@list);
}
})
'
Rate pp lmu
pp 2838.17+-0.28/s -- -35.2%
lmu 4381.99+-0.44/s 54.4% --
* Add support for monotonically increasing SQLite autoincs (GH#47)
* Declare dependencies in deterministic order (RT#102859)
+ * Remove dependency on List::MoreUtils ( http://is.gd/lmu_cac_debacle )
0.11021 2015-01-29
'Package::Variant' => '1.001001',
'Sub::Quote' => '0',
'Try::Tiny' => '0.04',
- 'List::MoreUtils' => '0.09',
'Scalar::Util' => '0',
},
recommends => {
=cut
-use SQL::Translator::Utils qw(parse_list_arg ex2err);
-use List::MoreUtils qw(uniq);
+use SQL::Translator::Utils qw(parse_list_arg ex2err uniq);
use Sub::Quote qw(quote_sub);
use Package::Variant (
=cut
use Moo;
-use SQL::Translator::Utils qw(parse_list_arg ex2err throw);
+use SQL::Translator::Utils qw(parse_list_arg ex2err throw uniq);
use SQL::Translator::Types qw(schema_obj enum);
-use List::MoreUtils qw(uniq);
use Sub::Quote qw(quote_sub);
extends 'SQL::Translator::Schema::Object';
debug normalize_name header_comment parse_list_arg truncate_id_uniquely
$DEFAULT_COMMENT parse_mysql_version parse_dbms_version
ddl_parser_instance batch_alter_table_statements
- throw ex2err carp_ro
+ uniq throw ex2err carp_ro
normalize_quote_options
);
use constant COLLISION_TAG_LENGTH => 8;
}
}
+sub uniq {
+ my( %seen, $seen_undef, $numeric_preserving_copy );
+ grep { not (
+ defined $_
+ ? $seen{ $numeric_preserving_copy = $_ }++
+ : $seen_undef++
+ ) } @_;
+}
+
sub throw {
die SQL::Translator::Utils::Error->new($_[0]);
}