From: michelemartone@users.sourceforge.net (Michele Martone)
To: cocci@systeme.lip6.fr
Subject: [Cocci] coccinelle computes patch very slowly
Date: Tue, 26 Jun 2018 17:27:55 +0200 [thread overview]
Message-ID: <20180626152755.GH14796@localhost> (raw)
In-Reply-To: <alpine.DEB.2.20.1806261257580.3957@hadrien>
On 20180626 at 13:03, Julia Lawall wrote:
> On Mon, 25 Jun 2018, Michele Martone wrote:
> > Dear Coccinelle Team,
> >
> > While patching source files of a few thousand lines long, I
> > noticed prohibitively long patch compute times (seemed hanged).
> >
> > This effectively prevented spatch from being usable.
> >
> > I attach a minimalistic program and patch replicating the problem.
> >
> > It seems like presence of uninitialized variables and/or
> > a loops body might slow down spatch computation extremely.
> >
> > I will be grateful of any support!
Hi Julia,
> Loops can cause the matching process to become very expensive.
With your suggeston below (thanks!) I was able to go around
the problem (see comments) !
However, I hope that this behaviour is unintended.
I mean: to practical means, loop presence, or a growing amount of
uninitialized variables leading to supra-linear patch compute
times is a game-stopper: it can IMHO severely scare users...
I hope it is some algorithmic limitation that can be overcome..
> I was about to propose various solutionsto get around the loop problem,
> but I think you don't care.
I do care --- I am open to further techniques --- they might very likel
y come in handy soon ;-).
So you may send them, please.
> You just want to know the type of I. Hence:
>
> @@
> type T;
> idexpression T I;
> identifier f;
> @@
>
> I =
> + (T)
> f(...)
Now the POC code gets patched in a fraction of a second.
And a 1.2KLOC source with 17 occurrences of 'f' in just <1s.
So my practical problem here is solved: thanks!
I have an extra question.
I observed that applying:
spatch --sp-file <patch above> <120 files totalling 140 KLOC>
seems to take >4 minutes time and consuming > 5.5 GB of memory;
I reran on each file separately, concatenating the patches.
Then it finishes in ~40s, computing the same exact patch.
Given such a simple patch, was this expected to be so ?
Cheers,
Michele
next prev parent reply other threads:[~2018-06-26 15:27 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-25 15:44 [Cocci] coccinelle computes patch very slowly Michele Martone
[not found] ` <ff255650-b3d6-c1dc-53ef-8e6e715c5077@users.sourceforge.net>
[not found] ` <20180626102638.GD14796@localhost>
2018-06-26 10:32 ` Michele Martone
2018-06-26 10:56 ` Julia Lawall
2018-06-26 11:03 ` Julia Lawall
2018-06-26 15:27 ` Michele Martone [this message]
2018-06-26 15:40 ` Julia Lawall
2018-06-27 22:23 ` Michele Martone
2018-06-27 22:52 ` Julia Lawall
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180626152755.GH14796@localhost \
--to=michelemartone@users.sourceforge.net \
--cc=cocci@systeme.lip6.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.