Re: PHP console script vs C/C++/C#
| From: | Nathan Nobbe | Date: | Sun, 20 Apr 2008 18:41:30 +0000 |
| Subject: | Re: PHP console script vs C/C++/C# | ||
| References: | 1 2 3 4 5 6 7 8 9 10 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-273330@lists.php.net to get a copy of this message | ||
On Sun, Apr 20, 2008 at 2:34 PM, Robert Cummings <robert@interjinn.com>
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@computer.org> 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.
> > (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.
-nathan