Hi,
this report has also been posted to the OCaml bug tracker, but since it
is a surprising observation, it may be good if people on the list know
that it exists without having to search the bug tracker archive.
Maybe some assembler guru can repeat this result and explain to us
what's going on...
----------
It seems that changes to signal handling between OCaml 3.08.4 and
3.09.1 can lead to a very significant loss of performance (up to
several orders of magnitude!) in code that uses threads and performs
I/O (tested on Linux).
The attached file (slow.ml) demonstrates this: it prints a character to
stdout in a for-loop. The uploaded version will take approximately
600ms in native code to complete this test when redirecting output to
/dev/null. If you comment out the line containing "module X = Thread"
and compile without thread support, then the test suddenly only takes
around 1.5ms, i.e. it runs 400 times faster.
Profiling using oprofile revealed that the function
"caml_process_pending_signals" seems to be responsible for that.
Annotated assembler output showed that the code was sampled an
astonishing number of times in the instruction "test %eax,%eax" as
obviously generated for "if (async_action != NULL)" in this function.
This is really weird, because everything else seems to be sampled a
sensible number of times, but it would surely explain the timings.
OCaml-3.08.4 does not exhibit any problems of that kind.
----------
Best regards,
Markus
--
Markus
Mottl http://www.ocaml.info markus.mottl@gmail.com