The following command sometimes takes as much as half a minute to run under Cygwin (1-7.19-1) and perl 5, version 14, subversion 2 (v5.14.2) built for cygwin-thread-multi-64int on an otherwise idle system with 16GB of RAM and an 8-core CPU running Windows 7.
$ time /usr/bin/perl -e 'use File::Temp' real 0m38.796s user 0m0.109s sys 0m0.124s
The second time it is executed it is typically considerably faster.
$ time /usr/bin/perl -e 'use File::Temp' real 0m2.498s user 0m0.124s sys 0m0.124s

I have run the command under strace to see if there was a particular system call that takes a long time to execute, but a cursory examination of the output didn't show me such a culprit.

I also looked at the time when each included file is opened, and I see that they are evenly spread out, with some however (warnings, Cwd, Config, Basename, constant) taking more than a second to load.

$ awk '/open: open/{print $2 / 1e6, $7}' strace.out 0.062687 open(/dev/urandom, 0.093652 open(/dev/urandom, 0.162175 open(/dev/null, 0.332337 open(/usr/lib/perl5/5.14/File/Temp.pm, 0.413667 open(/usr/lib/perl5/5.14/strict.pm, 0.574798 open(/usr/lib/perl5/5.14/Carp.pm, 0.647806 open(/usr/lib/perl5/5.14/warnings.pm, 2.12777 open(/usr/lib/perl5/5.14/Exporter.pm, 2.40747 open(/usr/lib/perl5/5.14/i686-cygwin-threads-64int/File/Spec.p +m, 2.48178 open(/usr/lib/perl5/5.14/vars.pm, 2.56121 open(/usr/lib/perl5/5.14/warnings/register.pm, 2.83884 open(/usr/lib/perl5/5.14/i686-cygwin-threads-64int/File/Spec/C +ygwin.pm, 3.06084 open(/usr/lib/perl5/5.14/i686-cygwin-threads-64int/File/Spec/U +nix.pm, 3.59694 open(/usr/lib/perl5/5.14/File/Path.pm, 3.67258 open(/usr/lib/perl5/5.14/i686-cygwin-threads-64int/Cwd.pm, 4.72324 open(/usr/lib/perl5/5.14/XSLoader.pm, 4.94318 open(/usr/lib/perl5/5.14/i686-cygwin-threads-64int/DynaLoader. +pm, 5.00538 open(/usr/lib/perl5/5.14/i686-cygwin-threads-64int/Config.pm, 16.219 open(/usr/lib/perl5/5.14/File/Basename.pm, 17.3896 open(/usr/lib/perl5/5.14/i686-cygwin-threads-64int/Fcntl.pm, 17.7389 open(/usr/lib/perl5/5.14/i686-cygwin-threads-64int/IO/Seekable +.pm, 17.8311 open(/usr/lib/perl5/5.14/i686-cygwin-threads-64int/IO/Handle.p +m, 17.9298 open(/usr/lib/perl5/5.14/Symbol.pm, 18.1662 open(/usr/lib/perl5/5.14/SelectSaver.pm, 18.2823 open(/usr/lib/perl5/5.14/i686-cygwin-threads-64int/IO.pm, 19.0989 open(/usr/lib/perl5/5.14/i686-cygwin-threads-64int/Errno.pm, 19.468 open(/usr/lib/perl5/5.14/base.pm, 19.8129 open(/usr/lib/perl5/5.14/overload.pm, 20.236 open(/usr/lib/perl5/5.14/constant.pm, 22.0238 open(/usr/lib/perl5/5.14/Carp/Heavy.pm, 22.1132 open(/usr/lib/perl5/5.14/Exporter/Heavy.pm,

In reply to File::Temp painfully slow under Cygwin by dds

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.