How Fast is Running Perl in Cygwin or Using NTFS on Linux? (The Price You Pay for Layers and Emulations)
Here is a speed comparison of running a Perl script on Microsoft Windows vs Linux, using native vs non-native port, and using native vs non-native file system.
- on Microsoft Windows, running Cygwin Perl in Cygwin terminal, using Microsoft Windows style input dir path (
C:/
) → 1080 seconds. - on Microsoft Windows, running Cygwin Perl in Cygwin terminal, using Unix style input dir path (
/cygdrive/c/
). → 55 seconds. - on Microsoft Windows, using Strawberry Perl (that's native Windows port of Perl) → 35 seconds.
- on Linux, running it over files on Microsoft Windows file system NTFS → 300 seconds.
- on Linux, running on Linux default file system (ext4) → 6 seconds.
Moral:
- when running in Cygwin, using Windows style path can slow you down significantly.
- running native port of Perl on Windows is almost twice faster than in Cygwin.
- running NTSF on Linux may be 50 times slower than using Linux's native file system.
Don't Use Window Style Path in Cygwin
![cygwin window path 2020-05-10 s8y43](i/cygwin_window_path_2020-05-10_s8y43.png)
Tech Detail
The Perl script validates local links of HTML files is at Perl: Validate Local Links
The script goes over 8.2k HTML files. Files that don't end in “.html” are skipped by regex. (there are a total of 23.3k files. 3.1 Giga bytes (lots image files))
---------- linux, everything native. real 0m6.608s user 0m5.844s sys 0m0.448s ---------- Linux, over NTFS real 8m11.333s user 0m44.507s sys 0m50.135s ---------- Strawberry Perl. real 35s ---------- Cygwin Perl, using unix style dir path. For example, $inDirPath = "/cygdrive/c/Users/h3/web/"; real 0m55.175s user 0m10.686s sys 0m15.896s ---------- Cygwin Perl, using Windows style dir path. For example, $inDirPath = "c:/Users/h3/web"; real 18m34.533s user 0m27.721s sys 1m10.060s
My system info:
◆ uname -a
Linux xah-p6813w 3.2.0-37-generic-pae #58-Ubuntu SMP Thu Jan 24 15:51:02 UTC 2013 i686 athlon i386 GNU/Linux
◆ xah@xah-p6813w◆ 2013-02-05 19:42 ◆ ~/web/xahlee_info/comp
◆ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=12.04
DISTRIB_CODENAME=precise
DISTRIB_DESCRIPTION="Ubuntu 12.04.2 LTS"