Re: I released the refactoring tool

Eric Ludlam <[email protected]> Sat, 14 Feb 2015 08:24:58 -0500
Newsgroups gmane.emacs.cedet
Message-ID <[email protected]>
On 02/12/2015 11:30 PM, Tu Do wrote:
> Hi Eric,
>
> Thanks for informing me about the function. I did not know about it.
> However, after doing some tests, I found it not feasible to use for the
> following reasons:
>
> - Performance: Here is the benchmark result from
> elp-instrustment-function after running tag generation using
> srecode-semantic-insert-tag:
>
>     srecode-semantic-insert-tag  40          101.46572211  2.5366430528
>
>
> It took too long to run.

This is interesting.  I've typically seen it go pretty fast filling in 
entire buffers from a tag list in the test suite.

In general I am not surprised.  A generalized template engine will 
always be slower that more direct coding practices.  I'll guess that 
code that needs to translate a tag into dictionary entries is a complex 
step gets in the way, but it is also the piece that allows core 
templates to be overriden by applications or users to customize, which 
is an important feature for users with requirements about what their 
code looks like.

I'll look at your example to see what I can dig up.

> - Correctness: I tested it with the class ColoringSolver used in the
> demo gifs. I store its Semantic tag in a variable than inserting the tag
> using srecode-semantic-insert-tag in another buffer. The result is, the
> class is generated twice, and one outside and one inside itself. The
> insert function also does not handle template correctly. For example, it
> cannot insert the template specifiers for this simple map:
>
> std::map<int, int> color_statistics;
>
> In the class, I have a more complicated variable:
>
> std::set<std::set<std::map<int,int>>> *color_repo;
>
> srecode-semantic-insert-tag can only retrieve the outter most container.
>
> You can try with the class above: http://pastebin.com/niV0TcQt

Thanks.  I'll look into that.  I am not surprised about the correctness. 
  I only drove the srecode templates so far as I am not a C++ template 
expert.  My assumption is that getting that to work is just a matter of 
working through the details.

The different templates for inserting tags have a way of positioning so 
you can do nested tags, such as adding bodies to functions or slots to a 
class.

My hope would be we can get this technique working to your satisfaction. 
  That would enable your tool to then be used for more languages with 
minimal fuss.  I've always had a goal of trying to make great tools like 
yours work seamlessly for new languages with minimal effort, or have 
them just work out of the box if a language is already supported by the 
parser and templates.

Eric

------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/