Opened 21 months ago

Closed 11 months ago

Last modified 11 months ago

#7382 closed bug (fixed)

Evaluating GHCi expressions is slow following the dynamic-by-default change

Reported by: parcs Owned by: Austin Seipp <aseipp@…>
Priority: highest Milestone: 7.8.1
Component: GHCi Version: 7.7
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Runtime performance bug Difficulty: Unknown
Test Case: Blocked By:
Blocking: Related Tickets:

Description

In GHC 7.7.20121101 it takes at least half a second for any GHCi expression to get evaluated. This seems to be caused by the system linker redundantly running during the evaluation of an expression.

Change History (15)

comment:1 Changed 21 months ago by parcs

  • Status changed from new to patch

I have attached a series of patches that seems to fix this issue.

comment:2 Changed 21 months ago by igloo

  • Difficulty set to Unknown
  • Milestone set to 7.8.1
  • Owner set to igloo
  • Priority changed from normal to high

Thanks for the patches. It looks like they cause a few failures related to object unloading; I'll take a look.

comment:3 follow-up: Changed 21 months ago by simonmar

Half a second? What platform is this? GHCi seems pretty responsive here.

comment:4 in reply to: ↑ 3 Changed 21 months ago by parcs

Replying to simonmar:

Half a second? What platform is this? GHCi seems pretty responsive here.

The platform is GNU/Linux. I probably overestimated the delay, but the feedback is definitely not instantaneous like in GHC 7.6.

comment:5 follow-up: Changed 21 months ago by igloo

If you have dynamic-by-default and run "ghci -v" then you'll see it linking a .so with no content every time you evaluate anything.

comment:6 in reply to: ↑ 5 Changed 20 months ago by simonmar

Replying to igloo:

If you have dynamic-by-default and run "ghci -v" then you'll see it linking a .so with no content every time you evaluate anything.

Sure, that needs fixing.

If there are cases where the new dynamic-by-default GHCi is less responsive than a static GHCi then I think that needs investigating - in the small experiments I've done on x86_64/Linux it seems to be faster.

comment:7 Changed 20 months ago by igloo

  • Owner igloo deleted
  • Priority changed from high to highest
  • Status changed from patch to new

comment:8 Changed 11 months ago by parcs

  • Status changed from new to patch

Here's a consolidated patch that contains the previous two patches and a final fix to the unload function.

comment:9 Changed 11 months ago by parcs

The patch seems to make the test ghci.debugger/scripts print035 successfully pass again. It's currently marked as broken on dynamic GHCi.

comment:10 Changed 11 months ago by Austin Seipp <aseipp@…>

  • Owner set to Austin Seipp <aseipp@…>
  • Resolution set to fixed
  • Status changed from patch to closed

In 333273792479695cf79a72cffa4c579d0c9deb21/ghc:

Don't run the system linker unncessarily.

This wastes time when evaluating expressions in GHCi. We also
disable object unloading when using the dynamic linker, too.

Fixes #7382. Fixes #7326.

Signed-off-by: Austin Seipp <aseipp@pobox.com>

comment:11 Changed 11 months ago by Austin Seipp <aseipp@…>

In 22eccb7edb86e0ad4e7a6e8c2064cd0632df96a3/testsuite:

print035 now passes (see #7382)

Signed-off-by: Austin Seipp <aseipp@pobox.com>
Note: See TracTickets for help on using tickets.