All of lore.kernel.org
 help / color / mirror / Atom feed
* [Cocci] coccinelle computes patch very slowly
@ 2018-06-25 15:44 Michele Martone
       [not found] ` <ff255650-b3d6-c1dc-53ef-8e6e715c5077@users.sourceforge.net>
  2018-06-26 11:03 ` Julia Lawall
  0 siblings, 2 replies; 8+ messages in thread
From: Michele Martone @ 2018-06-25 15:44 UTC (permalink / raw)
  To: cocci

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!
Michele
-------------- next part --------------
/*
// A semantic patch introducing casting on function return:
@@
type T;
identifier I;
symbol f;
@@

T I;
...

-I = 
+I = (T) 
 f(...);
*/
// Unfortunately, the above semantic patch takes 44s to run `spatch --sp-file <patch above> <snippet below>` !
// By using initializing declarators, or deleting the loop, it takes a fraction of a second.
// Tested with a coccinelle version 04d390a4414e626a0ca83f65f1ec08390c378cd1 (Sat May 26 07:43:36 2018 +0200).
// spatch version 1.0.6-00440-ga4532f08 compiled with OCaml version 4.08.0+dev0-2018-04-09
void * f(){return 0;}
void g(void)
{
  int v1=0, v2=0;
  int *a1, *a2;
  int presence, of, these, slows, down, patch, computing, extremely, y1, y2, y3, y4, y5;//each new uninitialized variable can cost seconds!
  //int presence=0, of=0, these=0, slows=0, down=0, patch=0, computing=0, extremely=0, y1=0, y2=0, y3=0, y4=0, y5=0;//inizialized ones are fine
  //undefined_t status;// presence of this (if uncommented) slows down a lot
  a1 = f();
  for(v1 = 0; v1 < v2; v1++) { } // presence of this loop here, too! delete it to have a huge speedup ?!
  a2 = f();
}

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-06-27 22:52 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2018-06-26 15:40     ` Julia Lawall
2018-06-27 22:23       ` Michele Martone
2018-06-27 22:52         ` Julia Lawall

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.