develooper Front page | perl.perl5.porters | Postings from July 2011

Reducing code in pp_prototype

Thread Next
Father Chrysostomos
July 24, 2011 14:35
Reducing code in pp_prototype
Message ID:
pp_prototype generates prototypes for core functions based on information in PL_opargs.  But for 16 ops, it has exceptions, as PL_opargs is not sufficent.

I see how I could modify the prototype-generation code to work for 5 of the exceptional cases, reducing the amount of code. I’ve been told recently that less code = faster (because RAM is the new avian carrier). But will it really be faster in this case? The prototype-generation code is preceded by this loop that searches for the op number:

		while (i < MAXO) {	/* The slow way. */
		    if (strEQ(s + 6, PL_op_name[i])
			|| strEQ(s + 6, PL_op_desc[i]))
			goto found;

So my thought is, why reduce the amount of code, only to slow things down?

Is this type of code reduction worth it?

(Also, the modification I have in mind would require the use of a static function in op.c, so I could put the prototype generation code in a function in that file. Then my &CORE::keyword code can share that. Currently, in my working copy the pp_prototype code is duplicated.)

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About