-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

at a customer's place we noticed  a performance problem while rendering
some (mostly large) pages. The culprit turned out to live in
Kernel/Output/HTML/OutputFilterTextURL.pm, somewhere here:

 |  for my $Key ( sort keys %{ $Self->{LinkHash} } ) {
 |      my $LinkSmall = $Self->{LinkHash}->{$Key};
 |      $LinkSmall =~ s/^(.{75}).*$/$1\[\.\.\]/gs;
 |      $Self->{LinkHash}->{$Key} =~ s/ //g;
 |      ${ $Param{Data} }
 |          =~ s/\Q$Key\E/<a href=\"$Self->{LinkHash}->{$Key}\" 
target=\"_blank\" title=\"$Self->{LinkHash}->{$Key}\">$LinkSmall<\/a>/;
 |  }

This code compiles a new regex for each $Key and does its substitution
thingy. In our case, there were over 5000 (!) $Keys, so the whole thing
took about 12 seconds in total.

I've replaced this by one regex, under the assumption that the $Keys
have the form "##################329", i.e. a sufficient number of
hash signs and a decimal number, like so:

    $Param{Data} =~ s/(#{10,}\d+)/$Self->_renderlink($1)/eg;

with a suitable method _renderlink, which constructs the link given the
Key.

Now my questions:

 * Am I assuming right that the internal link keys have of this form?

 * Would you be interested in a patch?

 * What is this line doing up there:
   $Self->{LinkHash}->{$Key} =~ s/ //g; ?

Thanks for any insight

- -- tomás
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFNVBRbBcgs9XrR2kYRAp7ZAJ9hIJ3R/jcCHREzafASoObRUNMeZwCcC1BW
cXPZpdXFkaM9yvMBhrQ8nB4=
=8Jq+
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
OTRS mailing list: otrs - Webpage: http://otrs.org/
Archive: http://lists.otrs.org/pipermail/otrs
To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/otrs

Reply via email to