public inbox for cygwin-apps@cygwin.com
 help / color / mirror / Atom feed
From: Christian Franke <Christian.Franke@t-online.de>
To: cygwin-apps@cygwin.com
Subject: Re: Optimising cygwin fork performance
Date: Wed, 16 Dec 2020 19:47:02 +0100	[thread overview]
Message-ID: <8a998cb8-b662-b736-dcd8-7de9ca316552@t-online.de> (raw)
In-Reply-To: <f953d417-b148-5df3-4f57-ba96e258eb83@gmail.com>

Marco Atzeri via Cygwin-apps wrote:
>
> On 16.12.2020 13:13, Hamish McIntyre-Bhatty via Cygwin-apps wrote:
>> Hi,
>>
>> So I know it's been mentioned a lot that fork is slow on Cygwin, but
>> compared to other people's machines, eg when building, it seems way
>> slower for me.
>>
>> First I'd like to know if there's a good way to measure this that anyone
>> has found, because I'm not sure how to measure it. If I print multiple
>> lines with echo in a script, I can see it printing maybe 2-3 a second -
>> it's very slow.
>>
>> I think this might be because I'm using a Virtual Machine with
>> VirtualBox, and QEMU/KVM might be quicker. I'm using Avira Antivurus,
>> with exceptions for the cygwin install folders (C:\cygwin64, C:\cygwin).
>>
>> It might be nice if we could so some comparisons so I can figure out
>> what's wrong.
>>
>> Hamish
>
> Same AV here, W10 64bit (no VM), 2 year old Laptop
>
> model name      : Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz
> 4 cores
>
> https://github.com/mondalaci/fork-benchmark
> it seems there is a aging effect

Result of power management? Could possibly be prevented if another minor 
cpu load is run in parallel.


>
> $ ./fork-benchmark.exe 1000
> Forked, executed and destroyed 1000 processes in 39.928576 seconds.
>
> $ ./fork-benchmark.exe 1000
> Forked, executed and destroyed 1000 processes in 42.701295 seconds.
>
> $ ./fork-benchmark.exe 1000
> Forked, executed and destroyed 1000 processes in 49.890909 seconds.
>
> $ ./fork-benchmark.exe 1000
> Forked, executed and destroyed 1000 processes in 61.657031 seconds.
>
>


9 year old PC, W10 64bit, no VM, Intel i7-2600K CPU @ 3.4GHz, 4 cores / 
8 threads

AV: Windows Defender
Cygwin x86_64

Protection on:

$ ./fork-benchmark-64 1000
Forked, executed and destroyed 1000 processes in 16.651101 seconds.

$ ./fork-benchmark-64 1000
Forked, executed and destroyed 1000 processes in 16.674107 seconds.

Protection off:

$ ./fork-benchmark-64 1000
Forked, executed and destroyed 1000 processes in 14.281071 seconds.

$ ./fork-benchmark-64 1000
Forked, executed and destroyed 1000 processes in 14.426482 seconds.


An alternative which could be run out-of-the-box is the good old 
'date(s) per second' benchmark. Its results are comparable:

$ while true; do date; done | uniq -c
...
      53 Wed Dec 16 19:23:26 CET 2020   <== Protection on
      54 Wed Dec 16 19:23:27 CET 2020
      56 Wed Dec 16 19:23:28 CET 2020
      55 Wed Dec 16 19:23:29 CET 2020
      56 Wed Dec 16 19:23:30 CET 2020
...
      52 Wed Dec 16 19:23:37 CET 2020
      54 Wed Dec 16 19:23:38 CET 2020
      56 Wed Dec 16 19:23:39 CET 2020
      63 Wed Dec 16 19:23:40 CET 2020   <== Protection off
      63 Wed Dec 16 19:23:41 CET 2020
      62 Wed Dec 16 19:23:42 CET 2020
      64 Wed Dec 16 19:23:43 CET 2020
...
      63 Wed Dec 16 19:23:51 CET 2020
      64 Wed Dec 16 19:23:52 CET 2020
      63 Wed Dec 16 19:23:53 CET 2020
      55 Wed Dec 16 19:23:54 CET 2020   <== Protection on
      48 Wed Dec 16 19:23:55 CET 2020
      53 Wed Dec 16 19:23:56 CET 2020
      54 Wed Dec 16 19:23:57 CET 2020
      54 Wed Dec 16 19:23:58 CET 2020
...


Cygwin x86 is somewhat slower:

Protection on:

$ ./fork-benchmark-32.exe 1000
Forked, executed and destroyed 1000 processes in 19.231766 seconds.

Protection off:

$ ./fork-benchmark-32.exe 1000
Forked, executed and destroyed 1000 processes in 17.107739 seconds.

Regards,
Christian


  reply	other threads:[~2020-12-16 18:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-16 12:13 Hamish McIntyre-Bhatty
2020-12-16 17:36 ` Marco Atzeri
2020-12-16 18:47   ` Christian Franke [this message]
2020-12-16 20:37   ` Brian Inglis
2021-01-08 15:24     ` Hamish McIntyre-Bhatty

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8a998cb8-b662-b736-dcd8-7de9ca316552@t-online.de \
    --to=christian.franke@t-online.de \
    --cc=cygwin-apps@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).