diff options
author | mathdesc <mathdesc@web> | 2012-08-14 08:20:35 -0400 |
---|---|---|
committer | admin <admin@branchable.com> | 2012-08-14 08:20:35 -0400 |
commit | 639965c7cc8f373d770b8ac0c7cb53e78b285e5c (patch) | |
tree | c43e49e453b659ebc1a67f94810e991122246362 /doc/bugs/Slow_Filecheck_attachments___34__snails_it_all__34__.mdwn | |
parent | 66f33bc314c1bb8e2abb1bdd4c06a9c3623e5e86 (diff) | |
download | ikiwiki-639965c7cc8f373d770b8ac0c7cb53e78b285e5c.tar ikiwiki-639965c7cc8f373d770b8ac0c7cb53e78b285e5c.tar.gz |
synthetic description of the bug
Diffstat (limited to 'doc/bugs/Slow_Filecheck_attachments___34__snails_it_all__34__.mdwn')
-rw-r--r-- | doc/bugs/Slow_Filecheck_attachments___34__snails_it_all__34__.mdwn | 41 |
1 files changed, 40 insertions, 1 deletions
diff --git a/doc/bugs/Slow_Filecheck_attachments___34__snails_it_all__34__.mdwn b/doc/bugs/Slow_Filecheck_attachments___34__snails_it_all__34__.mdwn index 8cbffb858..1f68acc41 100644 --- a/doc/bugs/Slow_Filecheck_attachments___34__snails_it_all__34__.mdwn +++ b/doc/bugs/Slow_Filecheck_attachments___34__snails_it_all__34__.mdwn @@ -1 +1,40 @@ -see [[users/mathdesc]] +Saving a wiki page in ikwiki or +<tt>ikiwiki --setup wiki.setup --rebuild</tt> takes a **dozen minutes** on a tiny tiny wiki (10 user-added pages)! + +I profiled ikiwiki with [[!cpan Devel::SmallProf]] : see [[users/mathdesc]] for details. + +And I came to the conclusion that filecheck on attachment was the only cause. +It always go the fallback code using time-consuming file even there it's look like it's +not successful. + +<pre> + # Get the mime type. + # + # First, try File::Mimeinfo. This is fast, but doesn't recognise + # all files. + eval q{use File::MimeInfo::Magic}; + my $mimeinfo_ok=! $@; + my $mimetype; + if ($mimeinfo_ok) { + my $mimetype=File::MimeInfo::Magic::magic($file); + } + + # Fall back to using file, which has a more complete + # magic database. + if (! defined $mimetype) { + open(my $file_h, "-|", "file", "-bi", $file); + $mimetype=<$file_h>; + chomp $mimetype; + close $file_h; + } + if (! defined $mimetype || $mimetype !~s /;.*//) { + # Fall back to default value. + $mimetype=File::MimeInfo::Magic::default($file) + if $mimeinfo_ok; + if (! defined $mimetype) { + $mimetype="unknown"; + } + } +</pre> + +Any ideas , solve :) more that welcome. |