Am 23.11.2011 03:00, schrieb David Prévot: > Since isoquery has been rewritten in Python, it's a lot slower than it > used to be.
Hi David, I've done some profiling now and I couldn't find any bottlenecks which could be improved. The most time for ISO 639-3 takes the call to lxml.etree.parse, which I don't have an influence on -- that's the python lxml library. However, even that call takes only 15 milliseconds on my system. Are you sure that those additional five minutes needed for the build are coming from isoquery? If the system has been upgraded to Squeeze, maybe another program is the culprit. Anyway, I've been looking at the file in question (dtc.def) and tried to rewrite it a bit. With this new version, two calls to isoquery are removed from the source. I think that this should speed up the build, if isoquery is really responsible for the additional time. Could you please try the patch? Unfortunately, I haven't had the chance to do so, because wml currently fails on my system. Regards, Tobias
--- dtc.def 2011-11-24 21:07:59.864448432 +0100
+++ dtc.def.new 2011-11-24 21:07:16.772447320 +0100
@@ -143,36 +143,35 @@
use Locale::gettext;
sub language_name {
- my $lang=shift;
- my $country=undef;
+ my $lang=shift;
+ my $country=undef;
# make the build fail if isoquery is not available
- `isoquery >/dev/null`;
+ `isoquery -v > /dev/null`;
- $lang =~ s/@.*$//;
- if ($lang =~ m,^(..)_(..)$,) {
- $lang=$1;
- $country=$2;
- }
- if (`isoquery -i 639-3 --name $lang 2>/dev/null`) {
- $lang = `isoquery -i 639-3 -n $lang`;
- chomp $lang;
- $lang =~ s/^.*\t//;
- $lang = dgettext("iso_639_3", "$lang");
+ $lang =~ s/@.*$//;
+ if ($lang =~ m,^(..)_(..)$,) {
+ $lang=$1;
+ $country=$2;
+ }
+ my $lang_fullname = chomp(`isoquery -i 639-3 $lang`);
+ if ($? == 0) {
+ $lang_fullname =~ s/^.*\t//;
+ $lang_fullname = dgettext("iso_639_3", "$lang_fullname");
# #624476 workaround: French typography expect languages to start with a lowercase
- $lang = lcfirst $lang if ($(CUR_LANG) eq 'French');
- } else {
- return qq(<Unknown_Language>);
- }
- if ((defined $country) && (`isoquery --name $country 2>/dev/null`)) {
- $country = `isoquery -c --name $country`;
- chomp $country;
- $country =~ s/^.*\t//;
- $country = dgettext("iso_3166", "$country");
- return "<langcountryoutput $lang $country>";
- } else {
- return $lang;
- }
+ $lang_fullname = lcfirst $lang_fullname if ($(CUR_LANG) eq 'French');
+ } else {
+ return qq(<Unknown_Language>);
+ }
+ if (defined $country) {
+ my $country_fullname = chomp(`isoquery -c $country`);
+ if ($? == 0) {
+ $country_fullname =~ s/^.*\t//;
+ $country_fullname = dgettext("iso_3166", "$country_fullname");
+ return "<langcountryoutput $lang_fullname $country_fullname>";
+ }
+ }
+ return $lang_fullname;
}
:>
signature.asc
Description: OpenPGP digital signature

