
#8027: Adding one call to getNumCapabilities triggers performance nose dive (6X
slowdown)
------------------------------------+---------------------------------------
Reporter: rrnewton | Owner:
Type: bug | Status: new
Priority: normal | Component: Runtime System
Version: 7.6.3 | Keywords:
Os: Unknown/Multiple | Architecture: Unknown/Multiple
Failure: Runtime performance bug | Blockedby:
Blocking: | Related:
------------------------------------+---------------------------------------
This is a strange one.
I'm in the process of writing an efficient routine for reading large
files of decimal/ASCII numbers, in order to make reasonable Haskell
versions of the PBBS benchmarks.
The following reproducer reads a file and parses the numbers inside
it. Simply calling "getNumCapabilities" BEFORE reading the file makes
it leap from taking 4.5 seconds to 25-30 seconds:
https://github.com/iu-
parfunc/lvars/blob/cfb5110eb172b9a9dd10e9863b2f87420d1dadf6/haskell-
prototype/Util/PBBS.hs#L30
The file is a standalone reproducer and there's a Makefile in that
directory that will build and run it in the bugged and unbugged modes.
When you run "make" you should see output as in the following Gist:
https://gist.github.com/rrnewton/5901965
......
time ./unbugged.exe
Using parReadNats + readFile
Time to read file sequentially: 0.311108s
SKIPPING read of num capabilities...
Now this is getting ridiculous...
Result: 1 segments of output