
Hello, Over the holidays I wrote a small GHC plugin to help me do some low-level optimizations of Haskell code. I thought it might be of use to other people too, so please try it out! When enabled, the plugin will save the Core generated by GHC in JSON format, and also render it in HTML for human inspection. The plugin is available on Hackage: http://hackage.haskell.org/package/dump-core The instructions on how to use it are in the README file. You may also read about it at the github page: http://hackage.haskell.org/package/dump-core There are many things that could probably be improved, just let me know. Also, if you are good at design, I could use some help making things look prettier :) Happy hacking, -Iavor

On January 12, 2017 1:36:12 PM EST, Iavor Diatchki
Hello,
Over the holidays I wrote a small GHC plugin to help me do some low-level optimizations of Haskell code. I thought it might be of use to other people too, so please try it out!
When enabled, the plugin will save the Core generated by GHC in JSON format, and also render it in HTML for human inspection.
The plugin is available on Hackage: http://hackage.haskell.org/package/dump-core
The instructions on how to use it are in the README file. You may also read about it at the github page: http://hackage.haskell.org/package/dump-core
There are many things that could probably be improved, just let me know. Also, if you are good at design, I could use some help making things look prettier :)
Happy hacking, -Iavor
------------------------------------------------------------------------
_______________________________________________ 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.
This looks fantastic, Iavor. I have often wanted something like this. It would be nice if the package would also expose a library providing the types along with FromJson instances so one can load a dump into ghci for further inspection. I've also long wanted a tool to easily fuzzily compare pairs of core dumps. This could be a great tool for enabling this. Cheers, - Ben

Hi Iavor, This sounds like a great idea, but it's not clear from the package description *how* the output is improved over -ddump-simpl. An example of the html output would be a great addition! Thanks! Eric On Thu, Jan 12, 2017, at 10:36, Iavor Diatchki wrote:
Hello,
Over the holidays I wrote a small GHC plugin to help me do some low-level optimizations of Haskell code. I thought it might be of use to other people too, so please try it out!
When enabled, the plugin will save the Core generated by GHC in JSON format, and also render it in HTML for human inspection.
The plugin is available on Hackage: http://hackage.haskell.org/package/dump-core
The instructions on how to use it are in the README file. You may also read about it at the github page: http://hackage.haskell.org/package/dump-core
There are many things that could probably be improved, just let me know. Also, if you are good at design, I could use some help making things look prettier :)
Happy hacking, -Iavor _______________________________________________ ghc-devs mailing list ghc-devs@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs

Iavor
Sounds good…but there are no instructions on what it does, screen shots, why one might want it, how to install, how to use… Both URLs below are the same
Simon
From: ghc-devs [mailto:ghc-devs-bounces@haskell.org] On Behalf Of Iavor Diatchki
Sent: 12 January 2017 18:36
To: Haskell Cafe

Hello,
sorry about the link mix-up, the second one was supposed to be a link to
the GitHub:
https://github.com/yav/dump-core/
The README.md, which is rendered on GitHub, has instructions on how to use
the plugin, and I just updated it with some more information on how to use
the rendered HTML. You can have a look at a sample rendered module here:
http://yav.github.io/dump-core/example-output/Galua.OpcodeInterpreter.html
The most striking thing everyone seems to notice first is that there are
many variables that have the same name---this is because I am only
rendering the string part of the names, without the uniques. The hovering
behavior does use the uniques though, so that's what I usually use to
disambiguate the variables. It would be easy enough to show the numbers
if people would like that. I am sure that there are many other things that
can be improved---if you have ideas / suggestions, please file an issue on
github.
Cheers,
-Iavor
On Thu, Jan 12, 2017 at 1:23 PM, Simon Peyton Jones
Iavor
Sounds good…but there are no instructions on what it does, screen shots, why one might want it, how to install, how to use… Both URLs below are the same
Simon
*From:* ghc-devs [mailto:ghc-devs-bounces@haskell.org] *On Behalf Of *Iavor Diatchki *Sent:* 12 January 2017 18:36 *To:* Haskell Cafe
; ghc-devs@haskell.org *Subject:* ANN: `dump-core` a prettier GHC core viewer Hello,
Over the holidays I wrote a small GHC plugin to help me do some low-level optimizations of Haskell code. I thought it might be of use to other people too, so please try it out!
When enabled, the plugin will save the Core generated by GHC in JSON format, and also render it in HTML for human inspection.
The plugin is available on Hackage:
http://hackage.haskell.org/package/dump-core https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fhackage.haskell.org%2Fpackage%2Fdump-core&data=02%7C01%7Csimonpj%40microsoft.com%7C6924b842575e4f63218308d43b19f45e%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636198430040472262&sdata=u5N0HOqiy38bvX%2FOC%2BKaEdtdJTYtbQAyxL%2Fvkk2wZ4M%3D&reserved=0
The instructions on how to use it are in the README file.
You may also read about it at the github page:
http://hackage.haskell.org/package/dump-core https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fhackage.haskell.org%2Fpackage%2Fdump-core&data=02%7C01%7Csimonpj%40microsoft.com%7C6924b842575e4f63218308d43b19f45e%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636198430040472262&sdata=u5N0HOqiy38bvX%2FOC%2BKaEdtdJTYtbQAyxL%2Fvkk2wZ4M%3D&reserved=0
There are many things that could probably be improved, just let me know. Also, if you are good at design, I could use some help making things look prettier :)
Happy hacking,
-Iavor

Hi, Am Donnerstag, den 12.01.2017, 14:18 -0800 schrieb Iavor Diatchki:
http://yav.github.io/dump-core/example-output/Galua.OpcodeInterpreter .html
this is amazing! It should in no way sound diminishing if I say that I always wanted to create something like that (and I am sure I am not the online one who will say that :-)). Can your tool step forward and backward between dumps from different phases, correlating the corresponding entries? Thanks, Joachim -- Joachim “nomeata” Breitner mail@joachim-breitner.de • https://www.joachim-breitner.de/ XMPP: nomeata@joachim-breitner.de • OpenPGP-Key: 0xF0FBF51F Debian Developer: nomeata@debian.org

Hello,
not really, the plugin does not do anything clever---it simply walks over
the GHC core and renders whatever it deems necessary to JSON. The only
extra bits it does is to make the unique names globally unique (I thought
GHC already did that, but apparently not, perhaps that happens during
tidying?).
I was thinking of trying to do something like this across compilations
(i.e., where you keep a history of all the files to compare how your
changes to the source affected the core), but it hadn't occurred to me to
try to do it for each phase. Please file a ticket, or even better if you
have the time please feel free to hack on it. I was just finding myself
staring at a lot of core, and wanted something a little easier to read, but
with all/most of the information still available.
It would be awesome to have a more clever tool that helps further with
these sorts of low level optimizations---at present I find it to be a
rather unpleasant task and so avoid it when I can :-)
-Iavor
On Thu, Jan 12, 2017 at 2:58 PM, Joachim Breitner
Hi,
Am Donnerstag, den 12.01.2017, 14:18 -0800 schrieb Iavor Diatchki:
http://yav.github.io/dump-core/example-output/Galua.OpcodeInterpreter .html
this is amazing! It should in no way sound diminishing if I say that I always wanted to create something like that (and I am sure I am not the online one who will say that :-)).
Can your tool step forward and backward between dumps from different phases, correlating the corresponding entries?
Thanks, Joachim
-- Joachim “nomeata” Breitner mail@joachim-breitner.de • https://www.joachim-breitner.de/ XMPP: nomeata@joachim-breitner.de • OpenPGP-Key: 0xF0FBF51F Debian Developer: nomeata@debian.org _______________________________________________ ghc-devs mailing list ghc-devs@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs

Hi,
It would be awesome to have a more clever tool that helps further with these sorts of low level optimizations---at present I find it to be a rather unpleasant task and so avoid it when I can :-) A few weeks ago I worked on a similar tool. I have just uploaded a demo: https://www.youtube.com/watch?v=sPu5UOYPKUw (it still needs a lot of work).
It would be great to have a better core renderer like you did at some point (currently it just highlights it). Sylvain On 13/01/2017 00:30, Iavor Diatchki wrote:
Hello,
not really, the plugin does not do anything clever---it simply walks over the GHC core and renders whatever it deems necessary to JSON. The only extra bits it does is to make the unique names globally unique (I thought GHC already did that, but apparently not, perhaps that happens during tidying?).
I was thinking of trying to do something like this across compilations (i.e., where you keep a history of all the files to compare how your changes to the source affected the core), but it hadn't occurred to me to try to do it for each phase. Please file a ticket, or even better if you have the time please feel free to hack on it. I was just finding myself staring at a lot of core, and wanted something a little easier to read, but with all/most of the information still available.
It would be awesome to have a more clever tool that helps further with these sorts of low level optimizations---at present I find it to be a rather unpleasant task and so avoid it when I can :-)
-Iavor
On Thu, Jan 12, 2017 at 2:58 PM, Joachim Breitner
mailto:mail@joachim-breitner.de> wrote: Hi,
Am Donnerstag, den 12.01.2017, 14:18 -0800 schrieb Iavor Diatchki: > http://yav.github.io/dump-core/example-output/Galua.OpcodeInterpreter http://yav.github.io/dump-core/example-output/Galua.OpcodeInterpreter > .html
this is amazing! It should in no way sound diminishing if I say that I always wanted to create something like that (and I am sure I am not the online one who will say that :-)).
Can your tool step forward and backward between dumps from different phases, correlating the corresponding entries?
Thanks, Joachim
-- Joachim “nomeata” Breitner mail@joachim-breitner.de mailto:mail@joachim-breitner.de • https://www.joachim-breitner.de/ https://www.joachim-breitner.de/ XMPP: nomeata@joachim-breitner.de mailto:nomeata@joachim-breitner.de • OpenPGP-Key: 0xF0FBF51F Debian Developer: nomeata@debian.org mailto:nomeata@debian.org _______________________________________________ ghc-devs mailing list ghc-devs@haskell.org mailto:ghc-devs@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
_______________________________________________ ghc-devs mailing list ghc-devs@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
participants (6)
-
Ben Gamari
-
Eric Seidel
-
Iavor Diatchki
-
Joachim Breitner
-
Simon Peyton Jones
-
Sylvain Henry