Skip to content
This repository has been archived by the owner on Nov 24, 2022. It is now read-only.

[WIP] NFData Instance for AsteriusModule #624

Merged
merged 11 commits into from
Apr 28, 2020
Merged

Conversation

gkaracha
Copy link
Member

@gkaracha gkaracha commented Apr 28, 2020

  • Add NFData instances for most datatypes in Asterius.Types, and
  • Utilize the new NFData instances to fully evaluate the shrinked AsteriusModule produced by Asterius.Resolve.linkStart.

After this PR is merged, we should be able to do a little better, by parallelizing AsteriusModules evaluation (see #621).

It appears we have some trouble already, because FastString and
IntMap do not have Generic instances (FastString does not even
have an NFData instance) so this cannot work well with Generic.
I think we'll end up writing TH by hand for this; we'll see.
@gkaracha gkaracha marked this pull request as ready for review April 28, 2020 16:09
@gkaracha gkaracha requested a review from TerrorJack April 28, 2020 16:09
@gkaracha
Copy link
Member Author

Currently ticks seem to go slightly down:
diff master/ahc-ld.prof HEAD/ahc-ld.prof gives

<       total time  =        9.94 secs   (9943 ticks @ 1000 us, 1 processor)
<       total alloc = 111,163,851,456 bytes  (excludes profiling overheads)
---
>       total time  =        9.39 secs   (9389 ticks @ 1000 us, 1 processor)
>       total alloc = 111,165,996,664 bytes  (excludes profiling overheads)

diff master/ahc-link.prof HEAD/ahc-link.prof gives

<       total time  =       45.82 secs   (45824 ticks @ 1000 us, 1 processor)
<       total alloc = 3,321,046,968 bytes  (excludes profiling overheads)
---
>       total time  =       45.49 secs   (45491 ticks @ 1000 us, 1 processor)
>       total alloc = 3,321,054,200 bytes  (excludes profiling overheads)

diff master/ahc.prof HEAD/ahc.prof gives

<       total time  =        0.28 secs   (282 ticks @ 1000 us, 1 processor)
<       total alloc = 132,290,048 bytes  (excludes profiling overheads)
---
>       total time  =        0.25 secs   (249 ticks @ 1000 us, 1 processor)
>       total alloc = 132,291,976 bytes  (excludes profiling overheads)

asterius/src/Asterius/NFData/TH.hs Outdated Show resolved Hide resolved
asterius/src/Asterius/Types/EntitySymbol.hs Outdated Show resolved Hide resolved
asterius/src/Asterius/Types/SymbolMap.hs Outdated Show resolved Hide resolved
asterius/src/Asterius/Types/SymbolSet.hs Outdated Show resolved Hide resolved
asterius/src/Asterius/Resolve.hs Outdated Show resolved Hide resolved
asterius/src/Asterius/Resolve.hs Outdated Show resolved Hide resolved
@TerrorJack TerrorJack merged commit 8f0bce1 into master Apr 28, 2020
@TerrorJack TerrorJack deleted the wip-nfdata-asterius-types branch April 28, 2020 19:01
TerrorJack added a commit that referenced this pull request Apr 28, 2020
@gkaracha
Copy link
Member Author

Since we are monitoring performance more closely these days, here is a quick comparison:

  • ahc (before: 282 ticks, after: 253 ticks)
  • ahc-ld (before: 9943 ticks, after: 10307 ticks)
  • ahc-link (before: 45824 ticks, after: 45389 ticks)

@TerrorJack
Copy link
Member

The small cost in ahc-ld is acceptable, since the profile report now contains the cost center of evaluating the post gc-sections module.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants