Performance of pattern synonyms

Simon Peyton Jones simonpj at microsoft.com
Mon Feb 11 13:55:31 UTC 2019


Are you as convinced as you were of the semantics of pattern synonyms?  I can see they are the right semantics given a run-time implementation but the alternative compile-time implementation has a lot to recommend it.

What exactly is "the alternative compile-time implementation"?

Remember, although pattern synonyms are set up to call a matching function, that matching function is often inlined, which reduces the overhead to zero.

I say "often" inlined.  An INLINE pragma for pattern synonyms would be a good feature.

Widening to ghc-devs.

Simon


From: Matthew Roberts <matthew.roberts at mq.edu.au>
Sent: 11 February 2019 00:10
To: matthew.pickering at cs.ox.ac.uk; gergo at erdi.hu; Simon Peyton Jones <simonpj at microsoft.com>; rae at cs.brynmawr.edu
Subject: Performance of pattern synonyms

Hi all,

I am working with someone on a compile-time pattern matching extension and the most important prior work is pattern synonyms in Haskell.  I hope you might indulge a couple of questions I have not been able to answer myself from the literature:

  * [In my testing](http://pattern-benchmarks.herokuapp.com/posts/2019-02-09-peano.html<https://nam06.safelinks.protection.outlook.com/?url=http%3A%2F%2Fpattern-benchmarks.herokuapp.com%2Fposts%2F2019-02-09-peano.html&data=02%7C01%7Csimonpj%40microsoft.com%7Cf4d58b9dd66c476d591a08d68fb549cd%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636854406149018023&sdata=uehvVhVMCpNiYWp7Lr2pRLGqVSqt3gQTACl2kvS9crg%3D&reserved=0>), pattern synonyms have remarkable performance, has anyone ever benchmarked them before?
  * Do you have - on hand - the hackage data you used in investigating uses of pattern synonyms?  I am looking for real-world usage of pattern matching extensions.
  * Are you as convinced as you were of the semantics of pattern synonyms?  I can see they are the right semantics given a run-time implementation but the alternative compile-time implementation has a lot to recommend it.

Thanks for your time,

Matt Roberts
Department of Computing, Macquarie University


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20190211/ee2058a2/attachment.html>


More information about the ghc-devs mailing list