[Cocci] 0079-netdev-destructor.cocci very slow

Johannes Berg johannes at sipsolutions.net
Wed Sep 19 11:02:09 CEST 2018


On Wed, 2018-09-19 at 10:49 +0200, Julia Lawall wrote:

> > > It looks like coccinelle already does such a grep when I remove the <--
> > > --> from the patch, because this is about 100 times faster.
> > 
> > Good point, not sure why it doesn't do that with the <... ...>?
> 
> Because <... ...> means 0 or more of what is inside.

Oops, right.

> <+... ...+> looks for one or more and may be faster.

Indeed, it's two orders of magnitude faster (running it on just
drivers/net/wireless goes from ~500 to ~2s for me) as it can throw away
almost all files immediately.

> On the other hand, it ensures that
> there is one or more, which can also be expensive.

That doesn't really matter all that much for us - the (really) expensive
part is running it on all files that don't even contain it at all.

> It could be better to just have a rule:
> 
> @worthwhile@
> @@
> 
> (
> functions(...)
> > 
> 
> you(...)
> > 
> 
> like(...)
> )
> 
> and then have the <... ...> rule depend on worthwhile.

Good idea too.

Thanks!

johannes


More information about the Cocci mailing list