Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > My little contribution, C-Profiler

Reply
Thread Tools

My little contribution, C-Profiler

 
 
H Vlems
Guest
Posts: n/a
 
      11-29-2010
On 26 nov, 20:17, Eyegor <(E-Mail Removed)> wrote:
> Hi all,
> I am going through my old code files and found a parser I wrote couple
> years back for LCC-win32.
>
> I made a web page listing it here:http://magicmrv.com/codes/ACP/
>
> The parser itself is a work in progress, the executable works well,
> but for some reason if i recompile the code for the parser using MSVS
> the parser crashes. Anyhow, I would like to revisit this project and
> improve it by adding native compatibility with MSVS and not just LCC.
> Different header files and real time clock is used by MSVS than LCC.
>
> Let me know what you all think, and may be someone can spot a problem
> with the parsers code which causes parser to crash if i compile parser
> with MSVS. The parser uses comments, like shown in my input code to
> determine which chunks of core are to be profiled. Profiler output is
> only generated if the profiled program completes execution.
>
> This code is 100% open source GPL, do with it as you please, All I
> want is to know if you made an improvement on it, this way I can use
> that improved code myself.


Try a formatter for your code, it's virtually unreadable the way it is
written.
Just scanning the code I saw examples of "while (i<strlen(mumble))",
which might indicate
poor performance. If possible I'd suggest x=strlen(mumble) and while
(i<x) instead.
Hans
 
Reply With Quote
 
 
 
 
Eyegor
Guest
Posts: n/a
 
      11-29-2010
On Nov 29, 3:33*am, H Vlems <(E-Mail Removed)> wrote:
> On 26 nov, 20:17, Eyegor <(E-Mail Removed)> wrote:
>
>
>
> > Hi all,
> > I am going through my old code files and found a parser I wrote couple
> > years back for LCC-win32.

>
> > I made a web page listing it here:http://magicmrv.com/codes/ACP/

>
> > The parser itself is a work in progress, the executable works well,
> > but for some reason if i recompile the code for the parser using MSVS
> > the parser crashes. Anyhow, I would like to revisit this project and
> > improve it by adding native compatibility with MSVS and not just LCC.
> > Different header files and real time clock is used by MSVS than LCC.

>
> > Let me know what you all think, and may be someone can spot a problem
> > with the parsers code which causes parser to crash if i compile parser
> > with MSVS. The parser uses comments, like shown in my input code to
> > determine which chunks of core are to be profiled. Profiler output is
> > only generated if the profiled program completes execution.

>
> > This code is 100% open source GPL, do with it as you please, All I
> > want is to know if you made an improvement on it, this way I can use
> > that improved code myself.

>
> Try a formatter for your code, it's virtually unreadable the way it is
> written.
> Just scanning the code I saw examples of "while (i<strlen(mumble))",
> which might indicate
> poor performance. If possible I'd suggest *x=strlen(mumble) and while
> (i<x) instead.
> Hans


you are also 100% correct, the executioner of strlen is very
inefficient on every iteration of the loop. It is rare that I write
clean code from the start, unless i know it will be computationally
intense, bad habit. This code was meant to parse couple KB of text so
taking 3 seconds to do it, rather than 0.0001 second for this
particular code is acceptable for me.

I use lcc-win32 which auto formats code for me, i'll try to re-post
spaced code in html format, i just assumed that every one will copy it
to their ide... bad assumption i guess.

What do you all use for performance profiling? I don't mean just
branching diagrams and number of calls to every function, but i mean
full line by line profiling. With tracking of number of calls, average
execution time per call and total time.
 
Reply With Quote
 
 
 
 
H Vlems
Guest
Posts: n/a
 
      11-29-2010
On Nov 29, 6:09*pm, Eyegor <(E-Mail Removed)> wrote:
> On Nov 29, 3:33*am, H Vlems <(E-Mail Removed)> wrote:
>
>
>
>
>
> > On 26 nov, 20:17, Eyegor <(E-Mail Removed)> wrote:

>
> > > Hi all,
> > > I am going through my old code files and found a parser I wrote couple
> > > years back for LCC-win32.

>
> > > I made a web page listing it here:http://magicmrv.com/codes/ACP/

>
> > > The parser itself is a work in progress, the executable works well,
> > > but for some reason if i recompile the code for the parser using MSVS
> > > the parser crashes. Anyhow, I would like to revisit this project and
> > > improve it by adding native compatibility with MSVS and not just LCC.
> > > Different header files and real time clock is used by MSVS than LCC.

>
> > > Let me know what you all think, and may be someone can spot a problem
> > > with the parsers code which causes parser to crash if i compile parser
> > > with MSVS. The parser uses comments, like shown in my input code to
> > > determine which chunks of core are to be profiled. Profiler output is
> > > only generated if the profiled program completes execution.

>
> > > This code is 100% open source GPL, do with it as you please, All I
> > > want is to know if you made an improvement on it, this way I can use
> > > that improved code myself.

>
> > Try a formatter for your code, it's virtually unreadable the way it is
> > written.
> > Just scanning the code I saw examples of "while (i<strlen(mumble))",
> > which might indicate
> > poor performance. If possible I'd suggest *x=strlen(mumble) and while
> > (i<x) instead.
> > Hans

>
> you are also 100% correct, the executioner of strlen is very
> inefficient on every iteration of the loop. It is rare that I write
> clean code from the start, unless i know it will be computationally
> intense, bad habit. This code was meant to parse couple KB of text so
> taking 3 seconds to do it, rather than 0.0001 second for this
> particular code is acceptable for me.
>
> I use lcc-win32 which auto formats code for me, i'll try to re-post
> spaced code in html format, i just assumed that every one will copy it
> to their ide... bad assumption i guess.
>
> What do you all use for performance profiling? I don't mean just
> branching diagrams and number of calls to every function, but i mean
> full line by line profiling. With tracking of number of calls, average
> execution time per call and total time.- Hide quoted text -
>
> - Show quoted text -


Performance issues for code like this probably doesn't hurt you. And
you learned to
program fairly recently which means that you have enough memory and
cpu power available to you.
Which just shows my age I guess. But I learned that function calls may
be expensive, so put
their output apart for further use, even though the language allowed
assignments in expressions, like C does.
So it is a matter of reviewing and getting used to a coding style. One
that will work in most languages.

Hans
 
Reply With Quote
 
Keith Thompson
Guest
Posts: n/a
 
      11-30-2010
Eyegor <(E-Mail Removed)> writes:
[...]
> I use lcc-win32 which auto formats code for me, i'll try to re-post
> spaced code in html format, i just assumed that every one will copy it
> to their ide... bad assumption i guess.

[...]

Please don't post HTML.

Just post plain text, indented with spaces, not tabs. (Whether you
think tabs or spaces are better for code indentation, some Usenet
software doesn't handle them well.)

--
Keith Thompson (The_Other_Keith) http://www.velocityreviews.com/forums/(E-Mail Removed) <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
 
Reply With Quote
 
Eyegor
Guest
Posts: n/a
 
      11-30-2010
On Nov 29, 7:53*pm, Keith Thompson <(E-Mail Removed)> wrote:
> Eyegor <(E-Mail Removed)> writes:
>
> [...]> I use lcc-win32 which auto formats code for me, i'll try to re-post
> > spaced code in html format, i just assumed that every one will copy it
> > to their ide... bad assumption i guess.

>
> [...]
>
> Please don't post HTML.
>
> Just post plain text, indented with spaces, not tabs. *(Whether you
> think tabs or spaces are better for code indentation, some Usenet
> software doesn't handle them well.)
>
> --
> Keith Thompson (The_Other_Keith) (E-Mail Removed) *<http://www.ghoti.net/~kst>
> Nokia
> "We must do something. *This is something. *Therefore, we must do this."
> * * -- Antony Jay and Jonathan Lynn, "Yes Minister"


Thanks, I'll keep it in mind when I post my Array Encoded Integer
library, i am working on it now, but its not yet ready for the
showcase yet.

Also, I actually find myself allot more "memory-worrier" than most now
day programmers. I have written code, just not in C which had to
reference 70MB data files back when PCs had 256 MB or ram, and those
were top of the line consumer ones, not the low end windows 95 with
64MB limit. The biggest memory hog app i ever wrote was for netflix
competition, i did not get any good predictions in, my best score was
1.01 with baseline being 0.95, lower is better... Anyhow I had 1.5GB
data sets to play with on a PC with 2GB of ram... was fun lol.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
1 little 2 little 3 little Kennedys dale Digital Photography 0 03-23-2008 01:03 PM
having a little problem with some code for a little game I am creating. ThaDoctor C++ 3 09-28-2007 03:28 PM
A little success but still problems =?Utf-8?B?TTc2?= Wireless Networking 14 01-18-2005 12:36 AM
little red X in little white box Puzzled Computer Support 8 12-13-2004 09:11 AM
Thunderbird 0.5 doesn't forward attachments + little issue with news carreg3|j'aime pas le spam| Firefox 5 04-04-2004 12:59 PM



Advertisments