Re: PHP console script vs C/C++/C#

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, 2008-04-20 at 14:41 -0400, Nathan Nobbe wrote:
> On Sun, Apr 20, 2008 at 2:34 PM, Robert Cummings <robert@xxxxxxxxxxxxx>
> wrote:
> 
> >
> > On Sun, 2008-04-20 at 14:17 -0400, Nathan Nobbe wrote:
> > > On Sun, Apr 20, 2008 at 6:50 AM, Per Jessen <per@xxxxxxxxxxxx> wrote:
> > >
> > > > Nathan Nobbe wrote:
> > > >
> > > > > umm, so whats going on here is the implicit component of the
> > statement
> > > > > that incorporates relative or absolute performance.  in terms of
> > > > > relative performance the statement is accurate; in terms of absolute
> > > > > performance, its quite inaccurate.
> > > > >
> > > >
> > > > Nathan, I think we're disagreeing about the meaning of "algorithm" -
> > an
> > > > algorithm does not have an absolute performance until it's been
> > > > implemented - in some of other language and machine.
> > > >
> > >
> > > i thought about that too..  i looked it up on wikipedia before i posted
> > just
> > > to be sure of myself.  the way i view it, there are 2 things an
> > algorithm
> > > could mean.  there are for instance well known algorithms like bubble
> > sort
> > > or quick sort, but basically any function written in any language is an
> > > algorithm.  and wikipedia agrees w/ that statement.
> >
> > "Algorithm" is just a fancy word for recipe. In fact, you should ask a
> > someone sometime what algorithm they're using to bake a cake ;)
> 
> 
> great, so you agree, and my previous posts are right.

I'm not going to agree with a blanket statement like that *lol* and I
don't feel like going back to check for specific examples of
incorrectness. This isn't U.S. politics... you don't get to add riders.

> > > (according to you) in c or php then at that point it will have an
> > absolute
> > > performance.  and the likelihood its faster in c, absolutely, is very
> > very
> > > high :)
> >
> > > but either way i dont see why it matters, if you implement an algorithm
> >
> > If something written in C is slower than something in PHP, or slower
> > even than something written in C++, then it's a problem with the
> > implementation, not the language. The best C++ can do is match the speed
> > of C. C++ has overhead, that overhead can't be squashed to be more
> > efficient than C, it can only be removed when not necessary. Unless of
> > course, for some odd, odd, odd reason, an optimization for C++ compiled
> > code was not also added to C. Since any optimization that can make C++
> > faster can also make C faster where appropriate. The same is true of
> > memory consumption in C++ versus C.
> >
> 
> ya; conceptually c should always be faster than c++, for the same reason c
> should be faster than php.  i think the compiler optimizations is why c++ is
> currently listed as 'faster' on the great computer language shootout, but i
> havent looked at the tests.

No, no, no... C should not always be faster than C++, not even
conceptually. Only C++ should never be faster than C. In other words
(and in a perfect world):

    C <= C++  (with respect to speed/memory)

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux