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::run 1 11.862 11.862 100.000
time-op 8 11.850 1.481 99.898
aoc2015day04#direct-hashing 2 10.716 5.358 90.338
aoc2015day04#aoc2015day04::part2 1 8.561 8.561 72.171
aoc2015day04#aoc2015day04::part1 1 2.155 2.155 18.167
aoc2015day03#stream-to-location-set 3 0.579 0.193 4.881
aoc2015day03#aoc2015day03::part2 1 0.490 0.490 4.130
aoc2015day03#aoc2015day03::part1 1 0.199 0.199 1.677
aoc2015day02#aoc2015day02::part1 1 0.193 0.193 1.627
aoc2015day02#aoc2015day02::part2 1 0.187 0.187 1.576
aoc2015day01#aoc2015day01::part1 1 0.034 0.034 0.286
aoc2015day01#floor-level 1 0.034 0.034 0.286
aoc2015day01#aoc2015day01::part2 1 0.031 0.031 0.261
aoc2015day01#floor-level-matched 1 0.031 0.031 0.261
aoc2015day02#paper 1000 0.006 0.000 0.050
aoc2015day03#negate 8193 0.004 0.000 0.033
aoc2015day03#loc-east 4184 0.004 0.000 0.033
aoc2015day03#loc-north 3962 0.003 0.000 0.025
aoc2015day03#loc-south 4136 0.002 0.000 0.016
aoc2015day03#loc-west 4102 0.002 0.000 0.016
aoc2015day02#ribbon 1000 0.001 0.000 0.008
aoc-files#aoc-resource-stream 6 0.000 0.000 0.000
aoc2015day03#direction-to-location-stream 3 0.000 0.000 0.000
aoc2015day02#lwh-stream-transformer 2 0.000 0.000 0.000
aoc-files#lines 2 0.000 0.000 0.000
aoc-files#aoc-resource-stream-lines 2 0.000 0.000 0.000
aoc-files#breakon 2 0.000 0.000 0.000
aoc2015day03#stream-unzip 1 0.000 0.000 0.000
aoc2015day01#floor-levels 1 0.000 0.000 0.000
Here's the output from Linux:
reading `PROFILE.220061' ...
procedure calls seconds average percent
---------------------------------------------------------------------------
advent2015::run 1 3.033 3.033 100.000
time-op 8 3.030 0.378 99.901
aoc2015day04#direct-hashing 2 2.758 1.379 90.933
aoc2015day04#aoc2015day04::part2 1 2.247 2.247 74.085
aoc2015day04#aoc2015day04::part1 1 0.511 0.511 16.848
aoc2015day03#stream-to-location-set 3 0.168 0.056 5.539
aoc2015day03#aoc2015day03::part2 1 0.151 0.151 4.978
aoc2015day03#aoc2015day03::part1 1 0.049 0.049 1.615
aoc2015day02#aoc2015day02::part1 1 0.033 0.033 1.088
aoc2015day02#aoc2015day02::part2 1 0.027 0.027 0.890
aoc-files#aoc-resource-stream 7 0.006 0.000 0.197
aoc-files#aoc-resource-stream-lines 3 0.006 0.002 0.197
aoc2015day03#loc-west 4102 0.004 0.000 0.131
aoc2015day03#loc-south 4136 0.003 0.000 0.098
aoc2015day03#loc-east 4184 0.002 0.000 0.065
aoc2015day02#ribbon 1000 0.002 0.000 0.065
aoc2015day03#negate 8193 0.001 0.000 0.032
aoc2015day03#loc-north 3962 0.000 0.000 0.000
aoc2015day02#paper 1000 0.000 0.000 0.000
aoc2015day03#direction-to-location-stream 3 0.000 0.000 0.000
aoc-files#breakon 2 0.000 0.000 0.000
aoc2015day02#lwh-stream-transformer 2 0.000 0.000 0.000
aoc-files#lines 2 0.000 0.000 0.000
aoc2015day03#stream-unzip 1 0.000 0.000 0.000
aoc2015day01#floor-levels 0 0.000 0.000 0.000
aoc2015day01#floor-level-matched 0 0.000 0.000 0.000
aoc2015day01#floor-level 0 0.000 0.000 0.000
aoc2015day04#info 0 0.000 0.000 0.000
aoc2015day01#aoc2015day01::part2 0 0.000 0.000 0.000
aoc2015day01#aoc2015day01::part1 0 0.000 0.000 0.000
Compilation output for both were of the form:
csc -I ..\\ -s -d1 -profile -accumulate-profile ..\\advents\\2015\\aoc2015day01.scm -j aoc2015day01 -emit-types-file aoc2015day01.types -o aoc2015day01.so
csc -I ..\\ -s -d1 -profile -accumulate-profile aoc2015day01.import.scm
csc -I ..\\ -s -d1 -profile -accumulate-profile ..\\advents\\2015\\aoc2015day02.scm -j aoc2015day02 -emit-types-file aoc2015day02.types -o aoc2015day02.so
csc -I ..\\ -s -d1 -profile -accumulate-profile aoc2015day02.import.scm
csc -I ..\\ -s -d1 -profile -accumulate-profile ..\\advents\\2015\\aoc2015day03.scm -j aoc2015day03 -emit-types-file aoc2015day03.types -o aoc2015day03.so
csc -I ..\\ -s -d1 -profile -accumulate-profile aoc2015day03.import.scm
csc -I ..\\ -s -d1 -profile -accumulate-profile ..\\advents\\2015\\aoc2015day04.scm -j aoc2015day04 -emit-types-file aoc2015day04.types -o aoc2015day04.so
csc -I ..\\ -s -d1 -profile -accumulate-profile aoc2015day04.import.scm
csc -I ..\\ ..\\advents\\2015\\advent2015.scm -profile -accumulate-profile -o advent2015