Re: Windows vs Linux Performance, windows host 4-6x slower than linux guest vm

2021-09-09 Thread Mark Fisher
Thanks Mario, these are very useful points.

I took a benchmark that would easily compile on both from
https://benchmarksgame-team.pages.debian.net/benchmarksgame/program/fasta-gcc-9.html

Both windows and linux compiling with:

> gcc -pipe -O3 -fomit-frame-pointer fasta.c -o fasta
> time ./fasta 1 > /dev/null

Running times for 100M iterations were:

Linux (VM): 2.014, 2.028, 2.016, 2.028
Windows (Host): 2.992, 2.964, 2.980, 2.965

so slower, but not 4-6x, only 1.5x

I'll have a think about your other points after I've tried Peter's
suggestion of trying with __fastcall.

I did try dropping back to 5.2.0 as I have a custom 5.3.0 that is
patched for chicken-install, but it gave the same results under
windows.





On Wed, 8 Sept 2021 at 17:48, Mario Domenech Goulart
 wrote:
>
> On Mon, 6 Sep 2021 21:25:48 +0100 Mark Fisher  wrote:
>
> >  The compilation options enable instrumentation-based profiling. There's
> >  statistical profiling available when running executables with -:p which
> >  might give you more useful data (see
> >  https://www.more-magic.net/posts/statistical-profiling.html for more
> >  infomation). Could you please try that one as well?
> >
> > I had found that article, didn't realise it was as easy as adding the 
> > switch when running.
> >
> > Here's the output for windows:
> > reading `PROFILE.15844' ...
> >
> > procedure   
> >calls  seconds  average  percent
> > ---
> > ../advents/2015/aoc2015day04.scm:35: 
> > message-digest-byte-vector#message-digest-string1498.2690.055   
> > 69.671
> > ../advents/2015/aoc2015day04.scm:35: chicken.string#conc
> >  1121.3200.011   11.120
> > ##sys#substring=?   
> >   721.0500.0148.845
> > ../advents/aoc-files.scm:43: streams.primitive#$make-stream-eager$  
> >   100.1400.0141.179
> > ##sys#profile-exit  
> >   110.1200.0101.010
> > ../advents/2015/aoc2015day04.scm:35: loop240
> >90.0900.0100.758
> > comparators/default.scm:115: make-comparator
> >90.0900.0100.758
> > comparators/default.scm:111: object-type
> >80.0900.0110.758
> > ../advents/aoc-files.scm:47: streams.utils#stream-fold-right
> >20.0600.0300.505
> > ../advents/2015/aoc2015day03.scm:110: streams.primitive#stream-null?
> >50.0500.0100.421
> > ../advents/aoc-files.scm:44: streams.primitive#stream-cdr   
> >40.0400.0100.336
> > ../advents/2015/aoc2015day03.scm:110: streams.primitive#$make-stream-eager$ 
> >30.0400.0130.336
> > comparators/comparators-impl.scm:235: acc   
> >30.0300.0100.252
> > ../advents/2015/aoc2015day03.scm:113: streams.primitive#stream-null?
> >30.0300.0100.252
> > comparators/comparators-impl.scm:236: acc   
> >30.0300.0100.252
> > ../advents/aoc-files.scm:43: streams.primitive#stream-car   
> >30.0300.0100.252
> > ../advents/2015/aoc2015day01.scm:70: streams.derived#stream-fold
> >10.0300.0300.252
> > ../advents/2015/aoc2015day01.scm:95: streams.utils#stream-find  
> >10.0300.0300.252
> > ##sys#profile-entry 
> >20.0200.0100.168
> > ../advents/aoc-files.scm:41: streams.derived#stream-append  
> >20.0200.0100.168
> > comparators/comparators-impl.scm:234: acc   
> >20.0200.0100.168
> > ../advents/2015/aoc2015day03.scm:72: srfi-113#set-adjoin!   
> >20.0200.0100.168
> > comparators/default.scm:87: object-type 
> >20.0200.0100.168
> > comparators/default.scm:110: object-type
> >20.0200.0100.168
> > comparators/comparators-impl.scm:200: %salt%
> >20.0200.0100.168
> > ../advents/2015/aoc2015day03.scm:113: streams.primitive#$make-stream-eager$ 
> >20.0200.0100.168
> > 

Re: Windows vs Linux Performance, windows host 4-6x slower than linux guest vm

2021-09-09 Thread Peter Bex
On Mon, Sep 06, 2021 at 01:26:26PM +0100, Mark Fisher wrote:
> I'm seeing quite a difference in performance between the two; windows host
> is running about ~4-6x slower than a VM that's running on the same machine.

hm, that's odd indeed.  Perhaps it's something to do with the different C
calling conventions the two OSes use?

I remembered that we used to define C_fcall as __fastcall under Windows
with MSVC back when we still supported it.  That's when x86 was still
very common.  It looks like Mingw also supports it nowadays (or maybe it
always has?)

See also https://docs.microsoft.com/en-us/cpp/cpp/fastcall?view=msvc-160
I don't know if it makes a big difference - that page says it's ignored
by compilers targeting arm or x64 architecture, so maybe it won't buy you
anything.

But if you feel like trying it out, you can add something like the
following to the top of chicken.h (or chicken-config.h):

#define C_fcall __fastcall

and then recompile CHICKEN itself and your code, and see if that makes
a noticable difference.

Cheers,
Peter


signature.asc
Description: PGP signature


Re: Windows vs Linux Performance, windows host 4-6x slower than linux guest vm

2021-09-08 Thread Mario Domenech Goulart
On Mon, 6 Sep 2021 21:25:48 +0100 Mark Fisher  wrote:

>  The compilation options enable instrumentation-based profiling. There's
>  statistical profiling available when running executables with -:p which
>  might give you more useful data (see
>  https://www.more-magic.net/posts/statistical-profiling.html for more
>  infomation). Could you please try that one as well?
>
> I had found that article, didn't realise it was as easy as adding the switch 
> when running.
>
> Here's the output for windows:
> reading `PROFILE.15844' ...
>
> procedure 
>  calls  seconds  average  percent
> ---
> ../advents/2015/aoc2015day04.scm:35: 
> message-digest-byte-vector#message-digest-string1498.2690.055   
> 69.671
> ../advents/2015/aoc2015day04.scm:35: chicken.string#conc  
>1121.3200.011   11.120
> ##sys#substring=? 
> 721.0500.0148.845
> ../advents/aoc-files.scm:43: streams.primitive#$make-stream-eager$
> 100.1400.0141.179
> ##sys#profile-exit
> 110.1200.0101.010
> ../advents/2015/aoc2015day04.scm:35: loop240  
>  90.0900.0100.758
> comparators/default.scm:115: make-comparator  
>  90.0900.0100.758
> comparators/default.scm:111: object-type  
>  80.0900.0110.758
> ../advents/aoc-files.scm:47: streams.utils#stream-fold-right  
>  20.0600.0300.505
> ../advents/2015/aoc2015day03.scm:110: streams.primitive#stream-null?  
>  50.0500.0100.421
> ../advents/aoc-files.scm:44: streams.primitive#stream-cdr 
>  40.0400.0100.336
> ../advents/2015/aoc2015day03.scm:110: streams.primitive#$make-stream-eager$   
>  30.0400.0130.336
> comparators/comparators-impl.scm:235: acc 
>  30.0300.0100.252
> ../advents/2015/aoc2015day03.scm:113: streams.primitive#stream-null?  
>  30.0300.0100.252
> comparators/comparators-impl.scm:236: acc 
>  30.0300.0100.252
> ../advents/aoc-files.scm:43: streams.primitive#stream-car 
>  30.0300.0100.252
> ../advents/2015/aoc2015day01.scm:70: streams.derived#stream-fold  
>  10.0300.0300.252
> ../advents/2015/aoc2015day01.scm:95: streams.utils#stream-find
>  10.0300.0300.252
> ##sys#profile-entry   
>  20.0200.0100.168
> ../advents/aoc-files.scm:41: streams.derived#stream-append
>  20.0200.0100.168
> comparators/comparators-impl.scm:234: acc 
>  20.0200.0100.168
> ../advents/2015/aoc2015day03.scm:72: srfi-113#set-adjoin! 
>  20.0200.0100.168
> comparators/default.scm:87: object-type   
>  20.0200.0100.168
> comparators/default.scm:110: object-type  
>  20.0200.0100.168
> comparators/comparators-impl.scm:200: %salt%  
>  20.0200.0100.168
> ../advents/2015/aoc2015day03.scm:113: streams.primitive#$make-stream-eager$   
>  20.0200.0100.168
> ../advents/2015/aoc2015day03.scm:113: streams.primitive#stream-car
>  10.0200.0200.168
> ../advents/aoc-files.scm:40: streams.derived#stream-append
>  10.0100.0100.084
> comparators/comparators-impl.scm:166: exact   
>  10.0100.0100.084
> ../advents/2015/advent2015.scm:38: scheme#display 
>  10.0100.0100.084
> ../advents/2015/aoc2015day03.scm:110: streams.primitive#$make-stream-lazy$
>  10.0100.0100.084
> ../advents/2015/aoc2015day02.scm:86: g194 
>  10.0100.0100.084
> ../advents/2015/aoc2015day03.scm:71: streams.derived#stream-fold  
>  10.0100.0100.084
> comparators/comparators-impl.scm:95: g307 
> 

Re: Windows vs Linux Performance, windows host 4-6x slower than linux guest vm

2021-09-08 Thread Mark Fisher
Actually, this is slightly incorrect, the libchicken is coming from a
different place, it should be the windows version I built, ldd found
the wrong one as I was running it with msys2/mingw64 chicken build on
the path instead of the one being used in my windows env, but that's
still the only non-windows library being used.

libchicken.dll => /c/chicken/bin/libchicken.dll (0x7ff8094d)

On Wed, 8 Sept 2021 at 08:10, Mark Fisher  wrote:
>
> > But to what libraries is Chicken linked in each case? That could be the
> > source of the discrepancy (does Chicken link to Windows-specific libs
> > when compiled for Windows? Or different versions of libraries?)
>
> $ ldd /c/Users/markj/dev/lisp/chicken/aoc-chicken/build/advent2015.exe
> ntdll.dll => /c/Windows/SYSTEM32/ntdll.dll (0x7ff8519b)
> KERNEL32.DLL => /c/Windows/System32/KERNEL32.DLL (0x7ff8507a)
> KERNELBASE.dll => /c/Windows/System32/KERNELBASE.dll (0x7ff84f64)
> msvcrt.dll => /c/Windows/System32/msvcrt.dll (0x7ff850a3)
> libchicken.dll => /usr/local/bin/libchicken.dll (0x7ff803b4)
> ADVAPI32.dll => /c/Windows/System32/ADVAPI32.dll (0x7ff850e3)
> sechost.dll => /c/Windows/System32/sechost.dll (0x7ff85175)
> RPCRT4.dll => /c/Windows/System32/RPCRT4.dll (0x7ff85086)
> USER32.dll => /c/Windows/System32/USER32.dll (0x7ff84ffa)
> win32u.dll => /c/Windows/System32/win32u.dll (0x7ff84f18)
> GDI32.dll => /c/Windows/System32/GDI32.dll (0x7ff850a0)
> gdi32full.dll => /c/Windows/System32/gdi32full.dll (0x7ff84f4e)
> msvcp_win.dll => /c/Windows/System32/msvcp_win.dll (0x7ff84f0e)
> ucrtbase.dll => /c/Windows/System32/ucrtbase.dll (0x7ff84f91)
> WS2_32.dll => /c/Windows/System32/WS2_32.dll (0x7ff85099)



Re: Windows vs Linux Performance, windows host 4-6x slower than linux guest vm

2021-09-08 Thread Mark Fisher
> But to what libraries is Chicken linked in each case? That could be the
> source of the discrepancy (does Chicken link to Windows-specific libs
> when compiled for Windows? Or different versions of libraries?)

$ ldd /c/Users/markj/dev/lisp/chicken/aoc-chicken/build/advent2015.exe
ntdll.dll => /c/Windows/SYSTEM32/ntdll.dll (0x7ff8519b)
KERNEL32.DLL => /c/Windows/System32/KERNEL32.DLL (0x7ff8507a)
KERNELBASE.dll => /c/Windows/System32/KERNELBASE.dll (0x7ff84f64)
msvcrt.dll => /c/Windows/System32/msvcrt.dll (0x7ff850a3)
libchicken.dll => /usr/local/bin/libchicken.dll (0x7ff803b4)
ADVAPI32.dll => /c/Windows/System32/ADVAPI32.dll (0x7ff850e3)
sechost.dll => /c/Windows/System32/sechost.dll (0x7ff85175)
RPCRT4.dll => /c/Windows/System32/RPCRT4.dll (0x7ff85086)
USER32.dll => /c/Windows/System32/USER32.dll (0x7ff84ffa)
win32u.dll => /c/Windows/System32/win32u.dll (0x7ff84f18)
GDI32.dll => /c/Windows/System32/GDI32.dll (0x7ff850a0)
gdi32full.dll => /c/Windows/System32/gdi32full.dll (0x7ff84f4e)
msvcp_win.dll => /c/Windows/System32/msvcp_win.dll (0x7ff84f0e)
ucrtbase.dll => /c/Windows/System32/ucrtbase.dll (0x7ff84f91)
WS2_32.dll => /c/Windows/System32/WS2_32.dll (0x7ff85099)



Re: Windows vs Linux Performance, windows host 4-6x slower than linux guest vm

2021-09-06 Thread Mark Fisher
>
>
> The compilation options enable instrumentation-based profiling. There's
> statistical profiling available when running executables with -:p which
> might give you more useful data (see
> https://www.more-magic.net/posts/statistical-profiling.html for more
> infomation). Could you please try that one as well?
>

I had found that article, didn't realise it was as easy as adding the
switch when running.

Here's the output for windows:
reading `PROFILE.15844' ...

procedure
   calls  seconds  average  percent
---
../advents/2015/aoc2015day04.scm:35:
message-digest-byte-vector#message-digest-string1498.2690.055
69.671
../advents/2015/aoc2015day04.scm:35: chicken.string#conc
  1121.3200.011   11.120
##sys#substring=?
  721.0500.0148.845
../advents/aoc-files.scm:43: streams.primitive#$make-stream-eager$
   100.1400.0141.179
##sys#profile-exit
   110.1200.0101.010
../advents/2015/aoc2015day04.scm:35: loop240
90.0900.0100.758
comparators/default.scm:115: make-comparator
90.0900.0100.758
comparators/default.scm:111: object-type
80.0900.0110.758
../advents/aoc-files.scm:47: streams.utils#stream-fold-right
20.0600.0300.505
../advents/2015/aoc2015day03.scm:110: streams.primitive#stream-null?
50.0500.0100.421
../advents/aoc-files.scm:44: streams.primitive#stream-cdr
   40.0400.0100.336
../advents/2015/aoc2015day03.scm:110: streams.primitive#$make-stream-eager$
   30.0400.0130.336
comparators/comparators-impl.scm:235: acc
   30.0300.0100.252
../advents/2015/aoc2015day03.scm:113: streams.primitive#stream-null?
30.0300.0100.252
comparators/comparators-impl.scm:236: acc
   30.0300.0100.252
../advents/aoc-files.scm:43: streams.primitive#stream-car
   30.0300.0100.252
../advents/2015/aoc2015day01.scm:70: streams.derived#stream-fold
10.0300.0300.252
../advents/2015/aoc2015day01.scm:95: streams.utils#stream-find
10.0300.0300.252
##sys#profile-entry
   20.0200.0100.168
../advents/aoc-files.scm:41: streams.derived#stream-append
20.0200.0100.168
comparators/comparators-impl.scm:234: acc
   20.0200.0100.168
../advents/2015/aoc2015day03.scm:72: srfi-113#set-adjoin!
   20.0200.0100.168
comparators/default.scm:87: object-type
   20.0200.0100.168
comparators/default.scm:110: object-type
20.0200.0100.168
comparators/comparators-impl.scm:200: %salt%
20.0200.0100.168
../advents/2015/aoc2015day03.scm:113: streams.primitive#$make-stream-eager$
   20.0200.0100.168
../advents/2015/aoc2015day03.scm:113: streams.primitive#stream-car
10.0200.0200.168
../advents/aoc-files.scm:40: streams.derived#stream-append
10.0100.0100.084
comparators/comparators-impl.scm:166: exact
   10.0100.0100.084
../advents/2015/advent2015.scm:38: scheme#display
   10.0100.0100.084
../advents/2015/aoc2015day03.scm:110: streams.primitive#$make-stream-lazy$
10.0100.0100.084
../advents/2015/aoc2015day02.scm:86: g194
   10.0100.0100.084
../advents/2015/aoc2015day03.scm:71: streams.derived#stream-fold
10.0100.0100.084
comparators/comparators-impl.scm:95: g307
   10.0100.0100.084
comparators/comparators-impl.scm:222: g450
10.0100.0100.084
comparators/default.scm:56: g721
10.0100.0100.084
../advents/2015/aoc2015day04.scm:8: chicken.load#load-extension
   10.0100.0100.084
comparators/comparators-impl.scm:166: scheme#round
10.0100.0100.084
../advents/2015/advent2015.scm:26: format#format
10.0100.0100.084
../advents/2015/aoc2015day03.scm:110: streams.primitive#stream-cdr
10.0100.0100.084
../advents/2015/aoc2015day03.scm:110: streams.primitive#stream-car
10.0100.0100.084
../advents/2015/aoc2015day01.scm:46: chicken.load#load-extension
10.0100.0100.084

Under linux:
reading `PROFILE.220771' ...

procedure
   calls  seconds  average  percent
---

Re: Windows vs Linux Performance, windows host 4-6x slower than linux guest vm

2021-09-06 Thread Vasilij Schneidermann
Hello Mark,

> You'll have to bear with me here, as I haven't tried adding profiling
> before.
> 
> I think I've got it done, but it only outputs at the function level, and
> the profile between the two platforms just seems to mirror a general
> difference in being slower on one platform.

The compilation options enable instrumentation-based profiling. There's
statistical profiling available when running executables with -:p which
might give you more useful data (see
https://www.more-magic.net/posts/statistical-profiling.html for more
infomation). Could you please try that one as well?

Vasilij


signature.asc
Description: PGP signature


Re: Windows vs Linux Performance, windows host 4-6x slower than linux guest vm

2021-09-06 Thread Mark Fisher
>
> That performance discrepancy is kinda surprising, specially considering
> that Linux is running as a guest on a VM on Windows.
>
> Maybe profiling can help spot what is causing the performance
> difference?
>

You'll have to bear with me here, as I haven't tried adding profiling
before.

I think I've got it done, but it only outputs at the function level, and
the profile between the two platforms just seems to mirror a general
difference in being slower on one platform.

In the output, the top function is the main run method, then everything
goes through "time-op" to grab timings.
Then the biggest time after that is just the one that takes the longest,
day4 part2, which is doing md5 of lots of strings through the method
"direct-hashing":

  (define (direct-hashing match length)
(let ([n 0]
  [prim (md5-primitive)])
  (do-until (substring=? (message-digest-string prim (conc secret n))
match 0 0 length)
(set! n (add1 n)))
  n))

And scanning down the other functions, they're all invoked the same number
of times between both platforms, but just slower in windows.

Is it possible to get the profiling to tell me more than this?

Here's the output from Windows:
reading `PROFILE.18380' ...

procedure  calls  seconds  average  percent
---
advent2015::run1   11.862   11.862  100.000
time-op8   11.8501.481   99.898
aoc2015day04#direct-hashing2   10.7165.358   90.338
aoc2015day04#aoc2015day04::part2   18.5618.561   72.171
aoc2015day04#aoc2015day04::part1   12.1552.155   18.167
aoc2015day03#stream-to-location-set30.5790.1934.881
aoc2015day03#aoc2015day03::part2   10.4900.4904.130
aoc2015day03#aoc2015day03::part1   10.1990.1991.677
aoc2015day02#aoc2015day02::part1   10.1930.1931.627
aoc2015day02#aoc2015day02::part2   10.1870.1871.576
aoc2015day01#aoc2015day01::part1   10.0340.0340.286
aoc2015day01#floor-level   10.0340.0340.286
aoc2015day01#aoc2015day01::part2   10.0310.0310.261
aoc2015day01#floor-level-matched   10.0310.0310.261
aoc2015day02#paper  10000.0060.0000.050
aoc2015day03#negate 81930.0040.0000.033
aoc2015day03#loc-east   41840.0040.0000.033
aoc2015day03#loc-north  39620.0030.0000.025
aoc2015day03#loc-south  41360.0020.0000.016
aoc2015day03#loc-west   41020.0020.0000.016
aoc2015day02#ribbon 10000.0010.0000.008
aoc-files#aoc-resource-stream  60.0000.0000.000
aoc2015day03#direction-to-location-stream  30.0000.0000.000
aoc2015day02#lwh-stream-transformer20.0000.0000.000
aoc-files#lines20.0000.0000.000
aoc-files#aoc-resource-stream-lines20.0000.0000.000
aoc-files#breakon  20.0000.0000.000
aoc2015day03#stream-unzip  10.0000.0000.000
aoc2015day01#floor-levels  10.0000.0000.000


Here's the output from Linux:
reading `PROFILE.220061' ...

procedure  calls  seconds  average  percent
---
advent2015::run13.0333.033  100.000
time-op83.0300.378   99.901
aoc2015day04#direct-hashing22.7581.379   90.933
aoc2015day04#aoc2015day04::part2   12.2472.247   74.085
aoc2015day04#aoc2015day04::part1   10.5110.511   16.848
aoc2015day03#stream-to-location-set30.1680.0565.539
aoc2015day03#aoc2015day03::part2   10.1510.1514.978
aoc2015day03#aoc2015day03::part1   10.0490.0491.615
aoc2015day02#aoc2015day02::part1   10.0330.0331.088
aoc2015day02#aoc2015day02::part2   10.0270.0270.890
aoc-files#aoc-resource-stream  70.0060.0000.197
aoc-files#aoc-resource-stream-lines30.0060.0020.197
aoc2015day03#loc-west   41020.0040.0000.131
aoc2015day03#loc-south  41360.0030.0000.098
aoc2015day03#loc-east   41840.0020.0000.065
aoc2015day02#ribbon 

Re: Windows vs Linux Performance, windows host 4-6x slower than linux guest vm

2021-09-06 Thread Jeronimo Pellegrini via
Mario Domenech Goulart  writes:

> That performance discrepancy is kinda surprising, specially considering
> that Linux is running as a guest on a VM on Windows.

But to what libraries is Chicken linked in each case? That could be the
source of the discrepancy (does Chicken link to Windows-specific libs
when compiled for Windows? Or different versions of libraries?)

J.




Re: Windows vs Linux Performance, windows host 4-6x slower than linux guest vm

2021-09-06 Thread Mario Domenech Goulart
Hi Mark,

On Mon, 6 Sep 2021 13:26:26 +0100 Mark Fisher  wrote:

> I've got a windows and linux environment for Chicken on the same machine.
> linux is running in VMWare Workstation, the host is Windows 10.
>
> I'm seeing quite a difference in performance between the two; windows host is 
> running about ~4-6x slower than a VM that's running on the same machine.
>
> The code I'm running is some of the 2015 advent of code challenges I'm 
> writing to learn scheme.
> My codebase is: https://github.com/markjfisher/aoc-chicken
>
> All times below (last 3 columns) are in millis, they show Total time, then 
> times for the 2 parts that are run to make that total.
>
> building:
> $ cd build; RELEASE=1 make clean all
>
> On my linux VM
> $ ./advent2015
> Day: Part 1   Part 2   Time  P1   P2  
> 01 : 232  1783 1165
> 02 : 1606483  3842356  6234   28  
> 03 : 2565 2639 9727   70  
> 04 : 254575   1038736  2713  490  2223
>
> On my Windows Host
>> advent2015.exe
> Day: Part 1   Part 2   Time  P1   P2
> 01 : 232  1783 6332   31
> 02 : 1606483  3842356  375   187  188
> 03 : 2565 2639 656   187  469
> 04 : 254575   1038736  10735 2156 8579
>
> Both are using 5.3.0rc2, both using "-O3" flags for release mode. All eggs 
> (listed in the docs/setup.md) were installed with same version of chicken.
> gcc is 10.3.0 from chocolatey in windows, and same version in linux.
>
> Is windows performance a known thing? Is there anything else I can do to make 
> the windows build more performant?
>
> - - - 8< - - -
> The compilation output for linux:
> csc -I ../ -s -d3 -O3 ../advents/2015/aoc2015day01.scm -j aoc2015day01 
> -emit-types-file aoc2015day01.types -o aoc2015day01.so
> csc -I ../ -s -d0 aoc2015day01.import.scm
> csc -I ../ -s -d3 -O3 ../advents/2015/aoc2015day02.scm -j aoc2015day02 
> -emit-types-file aoc2015day02.types -o aoc2015day02.so
> csc -I ../ -s -d0 aoc2015day02.import.scm
> csc -I ../ -s -d3 -O3 ../advents/2015/aoc2015day03.scm -j aoc2015day03 
> -emit-types-file aoc2015day03.types -o aoc2015day03.so
> csc -I ../ -s -d0 aoc2015day03.import.scm
> csc -I ../ -s -d3 -O3 ../advents/2015/aoc2015day04.scm -j aoc2015day04 
> -emit-types-file aoc2015day04.types -o aoc2015day04.so
> csc -I ../ -s -d0 aoc2015day04.import.scm
> csc -I ../ ../advents/2015/advent2015.scm -d3 -O2 -compile-syntax -o 
> advent2015
>
> For windows:
> csc -I ..\\ -s -d3 -O3 ..\\advents\\2015\\aoc2015day01.scm -j aoc2015day01 
> -emit-types-file aoc2015day01.types -o aoc2015day01.so
> csc -I ..\\ -s -d0 aoc2015day01.import.scm
> csc -I ..\\ -s -d3 -O3 ..\\advents\\2015\\aoc2015day02.scm -j aoc2015day02 
> -emit-types-file aoc2015day02.types -o aoc2015day02.so
> csc -I ..\\ -s -d0 aoc2015day02.import.scm
> csc -I ..\\ -s -d3 -O3 ..\\advents\\2015\\aoc2015day03.scm -j aoc2015day03 
> -emit-types-file aoc2015day03.types -o aoc2015day03.so
> csc -I ..\\ -s -d0 aoc2015day03.import.scm
> csc -I ..\\ -s -d3 -O3 ..\\advents\\2015\\aoc2015day04.scm -j aoc2015day04 
> -emit-types-file aoc2015day04.types -o aoc2015day04.so
> csc -I ..\\ -s -d0 aoc2015day04.import.scm
> csc -I ..\\ ..\\advents\\2015\\advent2015.scm -d3 -O2 -compile-syntax -o 
> advent2015
> - - - -

Thanks for the detailed information.

That performance discrepancy is kinda surprising, specially considering
that Linux is running as a guest on a VM on Windows.

Maybe profiling can help spot what is causing the performance
difference?

All the best.
Mario
-- 
http://parenteses.org/mario



Re: Windows vs Linux Performance, windows host 4-6x slower than linux guest vm

2021-09-06 Thread Jordan Henderson
I have a question related to this.  Wasn't there a Chicken-Scheme once that
used the Microsoft language tool chain?

I could be mistaken.

On Mon, Sep 6, 2021 at 8:29 AM Mark Fisher  wrote:

> I've got a windows and linux environment for Chicken on the same machine.
> linux is running in VMWare Workstation, the host is Windows 10.
>
> I'm seeing quite a difference in performance between the two; windows host
> is running about ~4-6x slower than a VM that's running on the same machine.
>
> The code I'm running is some of the 2015 advent of code challenges I'm
> writing to learn scheme.
> My codebase is: https://github.com/markjfisher/aoc-chicken
>
> All times below (last 3 columns) are in millis, they show Total time, then
> times for the 2 parts that are run to make that total.
>
> building:
> $ cd build; RELEASE=1 make clean all
>
> On my linux VM
> $ ./advent2015
> Day: Part 1   Part 2   Time  P1   P2
> 01 : 232  1783 1165
> 02 : 1606483  3842356  6234   28
> 03 : 2565 2639 9727   70
> 04 : 254575   1038736  2713  490  2223
>
> On my Windows Host
> > advent2015.exe
> Day: Part 1   Part 2   Time  P1   P2
> 01 : 232  1783 6332   31
> 02 : 1606483  3842356  375   187  188
> 03 : 2565 2639 656   187  469
> 04 : 254575   1038736  10735 2156 8579
>
> Both are using 5.3.0rc2, both using "-O3" flags for release mode. All eggs
> (listed in the docs/setup.md) were installed with same version of chicken.
> gcc is 10.3.0 from chocolatey in windows, and same version in linux.
>
> Is windows performance a known thing? Is there anything else I can do to
> make the windows build more performant?
>
>
> - - - 8< - - -
> The compilation output for linux:
> csc -I ../ -s -d3 -O3 ../advents/2015/aoc2015day01.scm -j aoc2015day01
> -emit-types-file aoc2015day01.types -o aoc2015day01.so
> csc -I ../ -s -d0 aoc2015day01.import.scm
> csc -I ../ -s -d3 -O3 ../advents/2015/aoc2015day02.scm -j aoc2015day02
> -emit-types-file aoc2015day02.types -o aoc2015day02.so
> csc -I ../ -s -d0 aoc2015day02.import.scm
> csc -I ../ -s -d3 -O3 ../advents/2015/aoc2015day03.scm -j aoc2015day03
> -emit-types-file aoc2015day03.types -o aoc2015day03.so
> csc -I ../ -s -d0 aoc2015day03.import.scm
> csc -I ../ -s -d3 -O3 ../advents/2015/aoc2015day04.scm -j aoc2015day04
> -emit-types-file aoc2015day04.types -o aoc2015day04.so
> csc -I ../ -s -d0 aoc2015day04.import.scm
> csc -I ../ ../advents/2015/advent2015.scm -d3 -O2 -compile-syntax -o
> advent2015
>
> For windows:
> csc -I ..\\ -s -d3 -O3 ..\\advents\\2015\\aoc2015day01.scm -j aoc2015day01
> -emit-types-file aoc2015day01.types -o aoc2015day01.so
> csc -I ..\\ -s -d0 aoc2015day01.import.scm
> csc -I ..\\ -s -d3 -O3 ..\\advents\\2015\\aoc2015day02.scm -j aoc2015day02
> -emit-types-file aoc2015day02.types -o aoc2015day02.so
> csc -I ..\\ -s -d0 aoc2015day02.import.scm
> csc -I ..\\ -s -d3 -O3 ..\\advents\\2015\\aoc2015day03.scm -j aoc2015day03
> -emit-types-file aoc2015day03.types -o aoc2015day03.so
> csc -I ..\\ -s -d0 aoc2015day03.import.scm
> csc -I ..\\ -s -d3 -O3 ..\\advents\\2015\\aoc2015day04.scm -j aoc2015day04
> -emit-types-file aoc2015day04.types -o aoc2015day04.so
> csc -I ..\\ -s -d0 aoc2015day04.import.scm
> csc -I ..\\ ..\\advents\\2015\\advent2015.scm -d3 -O2 -compile-syntax -o
> advent2015
> - - - -
>
>
>

-- 
Jordan Henderson
jordan.hender...@gmail.com


Windows vs Linux Performance, windows host 4-6x slower than linux guest vm

2021-09-06 Thread Mark Fisher
I've got a windows and linux environment for Chicken on the same machine.
linux is running in VMWare Workstation, the host is Windows 10.

I'm seeing quite a difference in performance between the two; windows host
is running about ~4-6x slower than a VM that's running on the same machine.

The code I'm running is some of the 2015 advent of code challenges I'm
writing to learn scheme.
My codebase is: https://github.com/markjfisher/aoc-chicken

All times below (last 3 columns) are in millis, they show Total time, then
times for the 2 parts that are run to make that total.

building:
$ cd build; RELEASE=1 make clean all

On my linux VM
$ ./advent2015
Day: Part 1   Part 2   Time  P1   P2
01 : 232  1783 1165
02 : 1606483  3842356  6234   28
03 : 2565 2639 9727   70
04 : 254575   1038736  2713  490  2223

On my Windows Host
> advent2015.exe
Day: Part 1   Part 2   Time  P1   P2
01 : 232  1783 6332   31
02 : 1606483  3842356  375   187  188
03 : 2565 2639 656   187  469
04 : 254575   1038736  10735 2156 8579

Both are using 5.3.0rc2, both using "-O3" flags for release mode. All eggs
(listed in the docs/setup.md) were installed with same version of chicken.
gcc is 10.3.0 from chocolatey in windows, and same version in linux.

Is windows performance a known thing? Is there anything else I can do to
make the windows build more performant?


- - - 8< - - -
The compilation output for linux:
csc -I ../ -s -d3 -O3 ../advents/2015/aoc2015day01.scm -j aoc2015day01
-emit-types-file aoc2015day01.types -o aoc2015day01.so
csc -I ../ -s -d0 aoc2015day01.import.scm
csc -I ../ -s -d3 -O3 ../advents/2015/aoc2015day02.scm -j aoc2015day02
-emit-types-file aoc2015day02.types -o aoc2015day02.so
csc -I ../ -s -d0 aoc2015day02.import.scm
csc -I ../ -s -d3 -O3 ../advents/2015/aoc2015day03.scm -j aoc2015day03
-emit-types-file aoc2015day03.types -o aoc2015day03.so
csc -I ../ -s -d0 aoc2015day03.import.scm
csc -I ../ -s -d3 -O3 ../advents/2015/aoc2015day04.scm -j aoc2015day04
-emit-types-file aoc2015day04.types -o aoc2015day04.so
csc -I ../ -s -d0 aoc2015day04.import.scm
csc -I ../ ../advents/2015/advent2015.scm -d3 -O2 -compile-syntax -o
advent2015

For windows:
csc -I ..\\ -s -d3 -O3 ..\\advents\\2015\\aoc2015day01.scm -j aoc2015day01
-emit-types-file aoc2015day01.types -o aoc2015day01.so
csc -I ..\\ -s -d0 aoc2015day01.import.scm
csc -I ..\\ -s -d3 -O3 ..\\advents\\2015\\aoc2015day02.scm -j aoc2015day02
-emit-types-file aoc2015day02.types -o aoc2015day02.so
csc -I ..\\ -s -d0 aoc2015day02.import.scm
csc -I ..\\ -s -d3 -O3 ..\\advents\\2015\\aoc2015day03.scm -j aoc2015day03
-emit-types-file aoc2015day03.types -o aoc2015day03.so
csc -I ..\\ -s -d0 aoc2015day03.import.scm
csc -I ..\\ -s -d3 -O3 ..\\advents\\2015\\aoc2015day04.scm -j aoc2015day04
-emit-types-file aoc2015day04.types -o aoc2015day04.so
csc -I ..\\ -s -d0 aoc2015day04.import.scm
csc -I ..\\ ..\\advents\\2015\\advent2015.scm -d3 -O2 -compile-syntax -o
advent2015
- - - -