
I am stepping through a Haskell program using the GNU debugger GDB and see function calls to handle_tick, handleProfTick, stopTicker all over the place. It sounds like they would manage profiling, but I compiled the executable without profiling.

The timer isn't only used for profiling, it is used for scheduling too. You can disable it with `+RTS -V0` (cf https://ghc.gitlab.haskell.org/ghc/doc/users_guide/debug-info.html#tutorial) On 18/10/2021 12:47, Henning Thielemann wrote:
I am stepping through a Haskell program using the GNU debugger GDB and see function calls to handle_tick, handleProfTick, stopTicker all over the place. It sounds like they would manage profiling, but I compiled the executable without profiling. _______________________________________________ Haskell-Cafe mailing list To (un)subscribe, modify options or view archives go to: http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe Only members subscribed via the mailman list are allowed to post.

Oh, might it be why my pet roguelike game is running at 20% higher
frames per second without -threaded? Would these tick calls be removed
in non-threaded RTS?
On Mon, Oct 18, 2021 at 2:18 PM Sylvain Henry
The timer isn't only used for profiling, it is used for scheduling too. You can disable it with `+RTS -V0` (cf https://ghc.gitlab.haskell.org/ghc/doc/users_guide/debug-info.html#tutorial)
On 18/10/2021 12:47, Henning Thielemann wrote:
I am stepping through a Haskell program using the GNU debugger GDB and see function calls to handle_tick, handleProfTick, stopTicker all over the place. It sounds like they would manage profiling, but I compiled the executable without profiling. _______________________________________________ Haskell-Cafe mailing list To (un)subscribe, modify options or view archives go to: http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe Only members subscribed via the mailman list are allowed to post.
_______________________________________________ Haskell-Cafe mailing list To (un)subscribe, modify options or view archives go to: http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe Only members subscribed via the mailman list are allowed to post.

Probably not: the timer is also enabled in the non-threaded RTS. As a guess, you could try disabling the idle GC with `+RTS -I0` with the threaded RTS. On 18/10/2021 14:28, Mikolaj Konarski wrote:
Oh, might it be why my pet roguelike game is running at 20% higher frames per second without -threaded? Would these tick calls be removed in non-threaded RTS?
On Mon, Oct 18, 2021 at 2:18 PM Sylvain Henry
wrote: The timer isn't only used for profiling, it is used for scheduling too. You can disable it with `+RTS -V0` (cf https://ghc.gitlab.haskell.org/ghc/doc/users_guide/debug-info.html#tutorial)
On 18/10/2021 12:47, Henning Thielemann wrote:
I am stepping through a Haskell program using the GNU debugger GDB and see function calls to handle_tick, handleProfTick, stopTicker all over the place. It sounds like they would manage profiling, but I compiled the executable without profiling. _______________________________________________ Haskell-Cafe mailing list To (un)subscribe, modify options or view archives go to: http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe Only members subscribed via the mailman list are allowed to post.
Haskell-Cafe mailing list To (un)subscribe, modify options or view archives go to: http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe Only members subscribed via the mailman list are allowed to post.
Haskell-Cafe mailing list To (un)subscribe, modify options or view archives go to: http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe Only members subscribed via the mailman list are allowed to post.

On Mon, 18 Oct 2021, Sylvain Henry wrote:
The timer isn't only used for profiling, it is used for scheduling too. You can disable it with `+RTS -V0` (cf https://ghc.gitlab.haskell.org/ghc/doc/users_guide/debug-info.html#tutorial)
Cool, this works!

quoth Henning Thielemann
On Mon, 18 Oct 2021, Sylvain Henry wrote:
The timer isn't only used for profiling, it is used for scheduling too. You can disable it with `+RTS -V0` (cf https://ghc.gitlab.haskell.org/ghc/doc/users_guide/debug-info.html#tutorial)
Cool, this works!
What does it break? Just about anything I'd run that was written in Haskell must run this way, to avoid fatal interrupts in things like socket I/O, so it's essentially a default - everything must be built with -rtsopts, and run with GHCRTS=-V0 environment. Donn

Sadly, it also comes with a price: everything including GCs runs at every
context switch instead of waiting for an appropriate number of ticks to
pass. (That said, I've also been bitten by the interrupt issue.)
On Mon, Oct 18, 2021 at 10:28 AM Donn Cave
quoth Henning Thielemann
On Mon, 18 Oct 2021, Sylvain Henry wrote:
The timer isn't only used for profiling, it is used for scheduling too. You can disable it with `+RTS -V0` (cf
https://ghc.gitlab.haskell.org/ghc/doc/users_guide/debug-info.html#tutorial )
Cool, this works!
What does it break? Just about anything I'd run that was written in Haskell must run this way, to avoid fatal interrupts in things like socket I/O, so it's essentially a default - everything must be built with -rtsopts, and run with GHCRTS=-V0 environment.
Donn _______________________________________________ Haskell-Cafe mailing list To (un)subscribe, modify options or view archives go to: http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe Only members subscribed via the mailman list are allowed to post.
-- brandon s allbery kf8nh allbery.b@gmail.com

I've just done some non-scientific benchmarks that show that in code
with a lot of (I presume) unsafe FFI calls such as buffered `putStr`
on Linux, performance can drop by half and even more with `+RTS -V0`.
I can share if anybody is interested. BTW, this is orthogonal to
`-threaded` which in my benchmarks slows no-FFI code with a few
threads by 20%, safe FFI calls-heavy code (SDL2 graphics) by 50% and
speeds up unsafe FFI-heavy code (`putStr`).
On Mon, Oct 18, 2021 at 4:35 PM Brandon Allbery
Sadly, it also comes with a price: everything including GCs runs at every context switch instead of waiting for an appropriate number of ticks to pass. (That said, I've also been bitten by the interrupt issue.)
On Mon, Oct 18, 2021 at 10:28 AM Donn Cave
wrote: quoth Henning Thielemann
On Mon, 18 Oct 2021, Sylvain Henry wrote:
The timer isn't only used for profiling, it is used for scheduling too. You can disable it with `+RTS -V0` (cf https://ghc.gitlab.haskell.org/ghc/doc/users_guide/debug-info.html#tutorial)
Cool, this works!
What does it break? Just about anything I'd run that was written in Haskell must run this way, to avoid fatal interrupts in things like socket I/O, so it's essentially a default - everything must be built with -rtsopts, and run with GHCRTS=-V0 environment.
Donn _______________________________________________ Haskell-Cafe mailing list To (un)subscribe, modify options or view archives go to: http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe Only members subscribed via the mailman list are allowed to post.
-- brandon s allbery kf8nh allbery.b@gmail.com _______________________________________________ Haskell-Cafe mailing list To (un)subscribe, modify options or view archives go to: http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe Only members subscribed via the mailman list are allowed to post.

On 18/10/2021 16:27, Donn Cave wrote:
What does it break? Just about anything I'd run that was written in Haskell must run this way, to avoid fatal interrupts in things like socket I/O, so it's essentially a default - everything must be built with -rtsopts, and run with GHCRTS=-V0 environment.
It shouldn't be necessary on Linux: since 2016 [1] the RTS uses timerfd which doesn't use signals and avoids interrupting other I/O. Sylvain [1] https://github.com/ghc/ghc/commit/120b9cdb31878ecee442c0a4bb9532a9d30c0c64
participants (5)
-
Brandon Allbery
-
Donn Cave
-
Henning Thielemann
-
Mikolaj Konarski
-
Sylvain Henry