Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #19477
| From | anton@mips.complang.tuwien.ac.at (Anton Ertl) |
|---|---|
| Newsgroups | comp.lang.forth |
| Subject | Re: Opinions on googl's go language? |
| Date | 2013-02-05 17:59 +0000 |
| Organization | Institut fuer Computersprachen, Technische Universitaet Wien |
| Message-ID | <2013Feb5.185900@mips.complang.tuwien.ac.at> (permalink) |
| References | (5 earlier) <B82dnbaWzYobgp3MnZ2dnUVZ_rKdnZ2d@supernews.com> <2013Jan24.134605@mips.complang.tuwien.ac.at> <vbydnedsQLMBzZzMnZ2dnUVZ_qGdnZ2d@supernews.com> <2013Jan24.182343@mips.complang.tuwien.ac.at> <yI-dnbVA2KA-FZzMnZ2dnUVZ_tOdnZ2d@supernews.com> |
Andrew Haley <andrew29@littlepinkcloud.invalid> writes:
>Anton Ertl <anton@mips.complang.tuwien.ac.at> wrote:
>> Andrew Haley <andrew29@littlepinkcloud.invalid> writes:
>>>Anton Ertl <anton@mips.complang.tuwien.ac.at> wrote:
>>>>>Perhaps, but to do so you'd have to convert each C expression into a
>>>>>sequence of instructions. It's easier to see what is going on in
>>>>>assembly.
>>>>
>>>> For algorithms?
>>>
>>>No, for exact timing.
>>
>> There's no exact timing with assembly language on modern CPUs, either,
>> and even if Knuth defines one for MMIX, it does not transfer any
>> better to real machines than a performance model based on C (or what C
>> used to be).
>
>But when discussing algorithms you need something better than big-O
>notation when talking about efficiency, so you need to be able to talk
>about the the time taken by specific operations, and to do that you
>need to be able to talk about instructions.
Or one might just talk about operations: x additions, y loads, z
stores, w branches, v cache misses, u branch mispredictions etc.
And if you want instructions and accurate timing, show the assembly
code (on some real architecture) and present timings from an
implementation of that architecture, or maybe several; and performance
counter results for various operations.
>And of course, this won't correspond exactly to any particular
>modern CPU, but some people's mental machinery needs something
>concrete.
What I suggest would be just as concrete and corresponds to at least
one modern CPU.
>>>>>> However, that is contrary to my mental model of C performance, which
>>>>>> says that function calls have a much higher cost than a memory access
>>>>>> through a pointer.
>>>>>
>>>>>Your mental model of C performance is wrong.
>>>>
>>>> It is? You mean, that every version of every C compiler with any
>>>> optimization options will compile this memcpy() to a simple unaligned
>>>> memory-to-register load?
>>>
>>>No, I mean that on some processors unaligned loads are hard, and on
>>>some they're not.
>>
>> I knew beforehand that on some architectures unaligned loads take a
>> few instructions (three on Alpha IIRC). I expected beforehand that
>> my code would cause an exception on such machines (I even documented
>> that dependency), so I did not expect that code to perform on such
>> machines at all. Why did you say that my mental model of C
>> performance is wrong?
>
>Because that model does not correspond with reality. What other test
>of a model is there?
Is there any performance model that always corresponds to reality?
No. So if you wanted to state a truism, you succeeded. I just
thought that there was something more substantial to your statement.
>> In a real low-level language (like the GNU C compiled by gcc 2.x) the
>> mapping is not 1:1, but it's relatively simple. The kind of
>> unpredictable performance that you get with stuff like the memcpy()
>> trick is removing this important feature of C, which leads me to the
>> "intersection" assessment above.
>
>I guess the difference here is our expectations. I've never really
>thought of C as being like that. One programmer's bug is another
>programmer's feature.
You consider unpredictable performance a feature? In a low-level
language?
>>>> No, it's only fast with memcpy() if the compiler can perform this
>>>> optimization in general and if if succeeds in performing this
>>>> optimization in this particular case. If it does not, not only will
>>>> the call to memcpy() be slow, but other accesses to this local will be
>>>> slow, too, because the local is forced into memory.
>>>
>>>Well, yes, but that's true of everything a compiler does.
>>
>> No, that's not true of proper language features. Show me a compiler
>> for, say, AMD64 that compiles a function call for *p, where p points
>> to an unsigned long.
>
>Ah, OK. :-) Of course, you can argue reductio ad absurdum if you
>want.
How does "reductio ad absurdum" come into play here?
> But this is an entirely circular argument, defining a "proper
>language feature" to suit yourself.
What is circular here? And of course I use suitable terms, and if I
had to define them, I would define them in a suitable way. Would you
prefer if I used unsuitable terms in an argument?
>>>I think you're making this up as you go along. memcpy() to a local is
>>>a language feature.
>>
>> K&R (2nd Ed.) never mentioned it, and I also never saw it in any other
>> books about C.
>
>It's there, though.
Where is it?
- anton
--
M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
New standard: http://www.forth200x.org/forth200x.html
EuroForth 2013: http://www.euroforth.org/ef13/
Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Opinions on googl's go language? the_gavino_himself <visphatesjava@gmail.com> - 2012-12-26 02:13 -0800
Re: Opinions on googl's go language? Hugh Aguilar <hughaguilar96@yahoo.com> - 2012-12-27 16:53 -0800
Re: Opinions on googl's go language? The Beez <the.beez.speaks@gmail.com> - 2012-12-28 02:49 -0800
Re: Opinions on googl's go language? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-12-28 07:59 -0600
Re: Opinions on googl's go language? "A. K." <akk@nospam.org> - 2012-12-28 16:26 +0100
Re: Opinions on googl's go language? Richard Owlett <rowlett@pcnetinc.com> - 2012-12-28 11:21 -0600
Re: Opinions on googl's go language? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-12-28 17:23 +0000
Re: Opinions on googl's go language? Richard Owlett <rowlett@pcnetinc.com> - 2012-12-28 16:20 -0600
Re: Opinions on googl's go language? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-01-08 17:55 +0000
Re: Opinions on googl's go language? mhx@iae.nl (Marcel Hendrix) - 2012-12-28 23:48 +0200
Re: Opinions on googl's go language? Bernd Paysan <bernd.paysan@gmx.de> - 2012-12-28 23:56 +0100
Re: Opinions on googl's go language? gavino_himself <visploveslisp@gmail.com> - 2013-01-06 03:53 -0800
Re: Opinions on googl's go language? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-01-08 16:22 +0000
Re: Opinions on googl's go language? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-01-08 12:34 -0600
Re: Opinions on googl's go language? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-01-23 16:40 +0000
Re: Opinions on googl's go language? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-01-23 11:36 -0600
Re: Opinions on googl's go language? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-01-24 12:46 +0000
Re: Opinions on googl's go language? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-01-24 09:17 -0600
Re: Opinions on googl's go language? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-01-24 17:23 +0000
Re: Opinions on googl's go language? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-01-24 13:16 -0600
Re: Opinions on googl's go language? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-02-05 17:59 +0000
Re: Opinions on googl's go language? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-02-05 12:38 -0600
Re: Opinions on googl's go language? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-12-30 03:24 -0600
Re: Opinions on googl's go language? Richard Owlett <rowlett@pcnetinc.com> - 2012-12-30 12:14 -0600
Re: Opinions on googl's go language? Bernd Paysan <bernd.paysan@gmx.de> - 2012-12-30 22:17 +0100
Re: Opinions on googl's go language? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-12-30 03:22 -0600
Re: Opinions on googl's go language? Bernd Paysan <bernd.paysan@gmx.de> - 2012-12-30 14:25 +0100
Re: Opinions on googl's go language? Hugh Aguilar <hughaguilar96@yahoo.com> - 2012-12-28 20:55 -0800
Re: Opinions on googl's go language? The Beez <the.beez.speaks@gmail.com> - 2012-12-29 03:35 -0800
Re: Opinions on googl's go language? Doug Hoffman <glidedog@gmail.com> - 2012-12-29 11:49 -0500
Re: Opinions on googl's go language? The Beez <the.beez.speaks@gmail.com> - 2012-12-30 01:57 -0800
Re: Opinions on googl's go language? Doug Hoffman <glidedog@gmail.com> - 2012-12-30 07:01 -0500
Re: Opinions on googl's go language? The Beez <the.beez.speaks@gmail.com> - 2012-12-31 00:29 -0800
Re: Opinions on googl's go language? Doug Hoffman <glidedog@gmail.com> - 2013-01-02 09:18 -0500
Re: Opinions on googl's go language? Hugh Aguilar <hughaguilar96@yahoo.com> - 2013-01-02 20:32 -0800
Re: Opinions on googl's go language? Doug Hoffman <glidedog@gmail.com> - 2013-01-03 06:56 -0500
Re: Opinions on googl's go language? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-01-08 15:50 +0000
Re: Opinions on googl's go language? Doug Hoffman <glidedog@gmail.com> - 2013-01-08 21:41 -0500
Re: Opinions on googl's go language? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-01-23 16:55 +0000
Re: Opinions on googl's go language? Bernd Paysan <bernd.paysan@gmx.de> - 2013-01-23 20:23 +0100
Re: Opinions on googl's go language? Doug Hoffman <glidedog@gmail.com> - 2013-01-24 09:46 -0500
Re: Opinions on googl's go language? Alex McDonald <blog@rivadpm.com> - 2012-12-29 07:41 -0800
Re: Opinions on googl's go language? gavino_himself <visploveslisp@gmail.com> - 2012-12-29 19:29 -0800
Re: Opinions on googl's go language? tcholoka@gmail.com - 2013-01-03 09:36 -0800
Re: Opinions on googl's go language? Hugh Aguilar <hughaguilar96@yahoo.com> - 2013-01-06 00:32 -0800
Re: Opinions on googl's go language? Mark Wills <forthfreak@gmail.com> - 2013-01-06 01:26 -0800
Re: Opinions on googl's go language? gavino_himself <visploveslisp@gmail.com> - 2013-01-06 03:57 -0800
Re: Opinions on googl's go language? tcholoka@gmail.com - 2013-01-06 06:02 -0800
Re: Opinions on googl's go language? Hugh Aguilar <hughaguilar96@yahoo.com> - 2013-01-07 23:41 -0800
Re: Opinions on googl's go language? tcholoka@gmail.com - 2013-01-08 00:15 -0800
Re: Opinions on googl's go language? gavino_himself <visploveslisp@gmail.com> - 2013-01-06 03:56 -0800
csiph-web