From: karthikbalaguru on
Hi,
There are certain editors that highlight
the syntax/color for datatypes/variables
or comments etc.

Similarly,
Is there a tool for C language that
could suggest an optimized/alternate
programming logic for the function that
is written ?

The optimized/alternate logic can be
suggested as soon as we finish coding
for one function or it can be suggested
as soon as the code is compiled/parsed
by that tool.

It will be even more helpful if that tool
also provides the cycle counts, cache
usage, cache misses and lines of code
also.

It would be better if that tool has an
option to enable / disable this feature
either through compile time or some
other configurations.

Any ideas ?

Thx in advans,
Karthik Balaguru
From: acd on
On 11 Jan., 21:07, karthikbalaguru <karthikbalagur...(a)gmail.com>
wrote:
> Hi,
> There are certain editors that highlight
> the syntax/color for datatypes/variables
> or comments etc.
>
> Similarly,
> Is there a tool for C language that
> could suggest an optimized/alternate
> programming logic for the function that
> is written ?
>
> The optimized/alternate logic can be
> suggested as soon as we finish coding
> for one function or it can be suggested
> as soon as the code is compiled/parsed
> by that tool.
>
> It will be even more helpful if that tool
> also provides the cycle counts, cache
> usage, cache misses and lines of code
> also.
>
> It would be better if that tool has an
> option to enable / disable this feature
> either through compile time or some
> other configurations.
>
> Any ideas ?
>
> Thx in advans,
> Karthik Balaguru

Brain?

Seriously, I think this is impossible.
What I can recommend to you are some good books, including
(More) Programming Perls
and
Hacker's delight.

Andreas
From: scattered on
On Jan 12, 11:04 am, acd <acd4use...(a)lycos.de> wrote:
> On 11 Jan., 21:07, karthikbalaguru <karthikbalagur...(a)gmail.com>
> wrote:
>
>
>
>
>
> > Hi,
> > There are certain editors that highlight
> > the syntax/color for datatypes/variables
> > or comments etc.
>
> > Similarly,
> > Is there a tool for C language that
> > could suggest an optimized/alternate
> > programming logic for the function that
> > is written ?
>
> > The optimized/alternate logic can be
> > suggested as soon as we finish coding
> > for one function or it can be suggested
> > as soon as the code is compiled/parsed
> > by that tool.
>
> > It will be even more helpful if that tool
> > also provides the cycle counts, cache
> > usage, cache misses and lines of code
> > also.
>
> > It would be better if that tool has an
> > option to enable / disable this feature
> > either through compile time or some
> > other configurations.
>
> > Any ideas ?
>
> > Thx in advans,
> > Karthik Balaguru
>
> Brain?
>
> Seriously, I think this is impossible.
> What I can recommend to you are some good books, including
> (More) Programming Perls
> and
> Hacker's delight.
>
> Andreas- Hide quoted text -
>
> - Show quoted text -

I don't see why it would be impossible. Optimizing compilers exist and
by using similar techniques it should be possible to write a compiler
that uses C as both the source and target language. How useful this
would be is another question. The resulting code would need to be
humanly readable if the tool would be of any use and the would
probably place severe restrictions on the sorts of optimizations that
can be done. I would be surprised if no work along these lines has
been done.

-scattered
From: Walter Banks on


scattered wrote:

> On Jan 12, 11:04 am, acd <acd4use...(a)lycos.de> wrote:
>
> > (More) Programming Perls
> > and
> > Hacker's delight.

---------------------------------------

>

> I don't see why it would be impossible. Optimizing compilers exist and
> by using similar techniques it should be possible to write a compiler
> that uses C as both the source and target language. How useful this
> would be is another question. The resulting code would need to be
> humanly readable if the tool would be of any use and the would
> probably place severe restrictions on the sorts of optimizations that
> can be done. I would be surprised if no work along these lines has
> been done.

Programming Pearls and Hacker's delight are both must haves
even if you are only remotely interested programming algorithms.

There has been quite a bit of work done in compilers at the
expression level to optimize algorithms and statements
implementing functionally equivalent statements in the
generated code.

The problem in the bigger scale suggested by the op is the
ability to recognize the larger overview of the programming
objective at the scale of turning a bubble sort into a quick
sort.

At the statement level recognizing functionality is generally
a simple task. At the function level this a significantly larger
problem.

The solution may be mostly hard work and processing
cycles. A start may be to catalog common functions
and implementations and create a significant tool
to recognize these functions from source code extracting
out key function parameters and then using these to select
alternative implementations.

As well as the data base of common functions a significant
piece of expert system software would need to be written
to extract knowledge out of the source.

Do-able probably.

Regards,

--
Walter Banks
Byte Craft Limited
http://www.bytecraft.com







From: Walter Banks on


karthikbalaguru wrote:

> Is there a tool for C language that
> could suggest an optimized/alternate
> programming logic for the function that
> is written ?
>
> The optimized/alternate logic can be
> suggested as soon as we finish coding
> for one function or it can be suggested
> as soon as the code is compiled/parsed
> by that tool.
>
> It will be even more helpful if that tool
> also provides the cycle counts, cache
> usage, cache misses and lines of code
> also.
>
> It would be better if that tool has an
> option to enable / disable this feature
> either through compile time or some
> other configurations.

Metrics are available in many (especially embedded system)
compilers as part of the listing and report files. Better
compilers do a good job of instruction scheduling and
cache management in their code generation.

The issue is the larger one of function rewriting where
the problem is larger and less work has been done
looking for solutions.


Regards,

--
Walter Banks
Byte Craft Limited
http://www.bytecraft.com