Quantcast

Best practices for linting wrt performance

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Best practices for linting wrt performance

Adam Bergmark-2
I'd like to make aeson hlint clean. aeson contains a lot of performance optimizations which made me wonder; Which linting refactorings should you think twice about when it comes to performance?

The best way to find an answer to this for aeson is of course to run the benchmarks, but are there any rules-of-thumb that you take into account when linting?

Here's the default hlint output for the current aeson master: https://gist.github.com/bergmark/5dd63c24fe6bdcf67eae0e88495a24e7

Cheers,
Adam


_______________________________________________
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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Best practices for linting wrt performance

Joachim Breitner-2
Hi,

Am Sonntag, den 19.03.2017, 16:19 +0000 schrieb Adam Bergmark:
> The best way to find an answer to this for aeson is of course to run
> the benchmarks, but are there any rules-of-thumb that you take into
> account when linting?

eta-reduction can increase sharing but can also increase the cost of a
function call, so that’s something to be careful about.

Greetings,
Joachim
--
Joachim Breitner
  [hidden email]
  http://www.joachim-breitner.de/

_______________________________________________
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.

signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Best practices for linting wrt performance

Adam Bergmark-2
Thanks Joachim! I actually found a note about that in the aeson sources so I'm using

ignore "Avoid lambda"
ignore "Eta reduce"

Cheers,
Adam


On Sun, 19 Mar 2017 at 17:34 Joachim Breitner <[hidden email]> wrote:
Hi,

Am Sonntag, den 19.03.2017, 16:19 +0000 schrieb Adam Bergmark:
> The best way to find an answer to this for aeson is of course to run
> the benchmarks, but are there any rules-of-thumb that you take into
> account when linting?

eta-reduction can increase sharing but can also increase the cost of a
function call, so that’s something to be careful about.

Greetings,
Joachim
--
Joachim Breitner
  [hidden email]
  http://www.joachim-breitner.de/
_______________________________________________
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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Best practices for linting wrt performance

Oliver Charles-3
Is that "redundant case" actually acting like seq?

On Sun, Mar 19, 2017 at 7:39 PM Adam Bergmark <[hidden email]> wrote:
Thanks Joachim! I actually found a note about that in the aeson sources so I'm using

ignore "Avoid lambda"
ignore "Eta reduce"

Cheers,
Adam


On Sun, 19 Mar 2017 at 17:34 Joachim Breitner <[hidden email]> wrote:
Hi,

Am Sonntag, den 19.03.2017, 16:19 +0000 schrieb Adam Bergmark:
> The best way to find an answer to this for aeson is of course to run
> the benchmarks, but are there any rules-of-thumb that you take into
> account when linting?

eta-reduction can increase sharing but can also increase the cost of a
function call, so that’s something to be careful about.

Greetings,
Joachim
--
Joachim Breitner
  [hidden email]
  http://www.joachim-breitner.de/
_______________________________________________
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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Best practices for linting wrt performance

Adam Bergmark-2
It was part of some CPP so I guessed that was the only reason. There's no indication that this code should act like seq https://github.com/bos/aeson/commit/f25ac48afd3534f3b951140e448061bea83b7d28#diff-eedba5bbe31b1a9bc142d620e77614edL2397


On Sun, 19 Mar 2017 at 21:24 Oliver Charles <[hidden email]> wrote:
Is that "redundant case" actually acting like seq?

On Sun, Mar 19, 2017 at 7:39 PM Adam Bergmark <[hidden email]> wrote:
Thanks Joachim! I actually found a note about that in the aeson sources so I'm using

ignore "Avoid lambda"
ignore "Eta reduce"

Cheers,
Adam


On Sun, 19 Mar 2017 at 17:34 Joachim Breitner <[hidden email]> wrote:
Hi,

Am Sonntag, den 19.03.2017, 16:19 +0000 schrieb Adam Bergmark:
> The best way to find an answer to this for aeson is of course to run
> the benchmarks, but are there any rules-of-thumb that you take into
> account when linting?

eta-reduction can increase sharing but can also increase the cost of a
function call, so that’s something to be careful about.

Greetings,
Joachim
--
Joachim Breitner
  [hidden email]
  http://www.joachim-breitner.de/
_______________________________________________
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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Best practices for linting wrt performance

Joachim Breitner-2
In reply to this post by Oliver Charles-3
Hi,

no. A case in Haskell does not necessary force evaluation (in contrast to a case in Core).

Greetings,
Joachim

Am 19. März 2017 16:24:18 EDT schrieb Oliver Charles <[hidden email]>:

>Is that "redundant case" actually acting like seq?
>
>On Sun, Mar 19, 2017 at 7:39 PM Adam Bergmark <[hidden email]> wrote:
>
>> Thanks Joachim! I actually found a note about that in the aeson
>sources so
>> I'm using
>>
>> ignore "Avoid lambda"
>> ignore "Eta reduce"
>>
>> Cheers,
>> Adam
>>
>>
>> On Sun, 19 Mar 2017 at 17:34 Joachim Breitner
><[hidden email]>
>> wrote:
>>
>> Hi,
>>
>> Am Sonntag, den 19.03.2017, 16:19 +0000 schrieb Adam Bergmark:
>> > The best way to find an answer to this for aeson is of course to
>run
>> > the benchmarks, but are there any rules-of-thumb that you take into
>> > account when linting?
>>
>> eta-reduction can increase sharing but can also increase the cost of
>a
>> function call, so that’s something to be careful about.
>>
>> Greetings,
>> Joachim
>> --
>> Joachim Breitner
>>   [hidden email]
>>   http://www.joachim-breitner.de/
>> _______________________________________________
>> 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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Best practices for linting wrt performance

Oliver Charles-3
Ah, I stand corrected. Thanks!

On Sun, Mar 19, 2017 at 10:46 PM Joachim Breitner <[hidden email]> wrote:
Hi,

no. A case in Haskell does not necessary force evaluation (in contrast to a case in Core).

Greetings,
Joachim

Am 19. März 2017 16:24:18 EDT schrieb Oliver Charles <[hidden email]>:
>Is that "redundant case" actually acting like seq?
>
>On Sun, Mar 19, 2017 at 7:39 PM Adam Bergmark <[hidden email]> wrote:
>
>> Thanks Joachim! I actually found a note about that in the aeson
>sources so
>> I'm using
>>
>> ignore "Avoid lambda"
>> ignore "Eta reduce"
>>
>> Cheers,
>> Adam
>>
>>
>> On Sun, 19 Mar 2017 at 17:34 Joachim Breitner
><[hidden email]>
>> wrote:
>>
>> Hi,
>>
>> Am Sonntag, den 19.03.2017, 16:19 +0000 schrieb Adam Bergmark:
>> > The best way to find an answer to this for aeson is of course to
>run
>> > the benchmarks, but are there any rules-of-thumb that you take into
>> > account when linting?
>>
>> eta-reduction can increase sharing but can also increase the cost of
>a
>> function call, so that’s something to be careful about.
>>
>> Greetings,
>> Joachim
>> --
>> Joachim Breitner
>>   [hidden email]
>>   http://www.joachim-breitner.de/
>> _______________________________________________
>> 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.

_______________________________________________
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.
Loading...