Announcement: New faster Common Subexpression Elimination (CSE) implementation

135 views
Skip to first unread message

Cristóvão Sousa

unread,
Sep 7, 2013, 8:55:12 PM9/7/13
to sy...@googlegroups.com
Hi all,

I just want to announce that a new implementation of Common Subexpression Elimination (CSE) routine has been merged into master (PR: https://github.com/sympy/sympy/pull/2355).

This new implementation is really faster, especially when no external optimizations are performed (the default now).
And there is a new option for even faster results: order='none'.

Here is a comparison example: http://nbviewer.ipython.org/5986996
As it can be seen, for the no optimizations case, there is a reduction from _1 minute and half_  to  _580 ms_,
from the previous to the new implementation.
With the order='none' option, the new implementation drops to _91 ms_!

For all of you who wasn't using CSE because of it being a bottleneck, CSE must be reconsidered again.

Thanks,
Happy code,
Cristóvão D. Sousa

Cristóvão Sousa

unread,
Sep 7, 2013, 9:06:04 PM9/7/13
to sy...@googlegroups.com
On Sunday, September 8, 2013 1:55:12 AM UTC+1, Cristóvão Sousa wrote:
Hi all,

I just want to announce that a new implementation of Common Subexpression Elimination (CSE) routine has been merged into master (PR: https://github.com/sympy/sympy/pull/2355).

This new implementation is really faster, especially when no external optimizations are performed (the default now).
And there is a new option for even faster results: order='none'.

Here is a comparison example: http://nbviewer.ipython.org/5986996
As it can be seen, for the no optimizations case, there is a reduction from _1 minute and half_  to  _580 ms_,
from the previous to the new implementation.

150x faster.
 
With the order='none' option, the new implementation drops to _91 ms_!

1000x faster.

Matthew Rocklin

unread,
Sep 7, 2013, 9:18:57 PM9/7/13
to sy...@googlegroups.com
That's awesome.  Can I suggest that you blog about this and push it to planet.sympy.org?


--
You received this message because you are subscribed to the Google Groups "sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sympy+un...@googlegroups.com.
To post to this group, send email to sy...@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy.
For more options, visit https://groups.google.com/groups/opt_out.

Ondřej Čertík

unread,
Sep 8, 2013, 1:16:51 PM9/8/13
to sympy
On Sat, Sep 7, 2013 at 7:06 PM, Cristóvão Sousa <cri...@gmail.com> wrote:
> On Sunday, September 8, 2013 1:55:12 AM UTC+1, Cristóvão Sousa wrote:
>>
>> Hi all,
>>
>> I just want to announce that a new implementation of Common Subexpression
>> Elimination (CSE) routine has been merged into master (PR:
>> https://github.com/sympy/sympy/pull/2355).
>>
>> This new implementation is really faster, especially when no external
>> optimizations are performed (the default now).
>> And there is a new option for even faster results: order='none'.
>>
>> Here is a comparison example: http://nbviewer.ipython.org/5986996
>> As it can be seen, for the no optimizations case, there is a reduction
>> from _1 minute and half_ to _580 ms_,
>> from the previous to the new implementation.
>
>
> 150x faster.
>
>>
>> With the order='none' option, the new implementation drops to _91 ms_!
>
>
> 1000x faster.

This is amazing. Thanks Cristóvão for your hard work. This will be
very very useful to a lot of people.

Ondrej

>
>>
>>
>> For all of you who wasn't using CSE because of it being a bottleneck, CSE
>> must be reconsidered again.
>>
>> Thanks,
>> Happy code,
>> Cristóvão D. Sousa
>>

Cristóvão Sousa

unread,
Sep 9, 2013, 8:02:52 AM9/9/13
to sy...@googlegroups.com

Matthew Rocklin

unread,
Sep 10, 2013, 12:30:20 AM9/10/13
to sy...@googlegroups.com
I think we need to add you to something in the planet.sympy repo.  Aaron, Ondrej, what file is appropriate here?

Aaron Meurer

unread,
Sep 10, 2013, 12:31:12 AM9/10/13
to sy...@googlegroups.com
planet.ini

Aaron Meurer

Ondřej Čertík

unread,
Sep 10, 2013, 2:21:45 AM9/10/13
to sympy
Just send a PR against this repo:

https://github.com/sympy/planet.sympy.org

once we merge it, the planet should automatically pick it up. This
assumes you don't make a syntax error. If you do, then I might need to
debug by hand on the server.

Cristóvão Sousa

unread,
Sep 10, 2013, 9:23:16 AM9/10/13
to sy...@googlegroups.com
I think adding this is enough:



You received this message because you are subscribed to a topic in the Google Groups "sympy" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sympy/cvMTVCNvl6Y/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sympy+un...@googlegroups.com.

Cristóvão Sousa

unread,
Sep 10, 2013, 9:31:17 AM9/10/13
to sy...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages