Newsgroups: microsoft.public.dotnet.framework.clr
From: "Christopher Diggins" <cdigg...@gmail.com>
Date: 15 Apr 2007 09:40:14 -0700
Local: Sun, Apr 15 2007 12:40 pm
Subject: Re: Higher Order Instructions
[snip]
> > > Also, it needs to magically turn into machine code or stay as a I won't get into this here, but in many cases these are easily solved > > > graph, depending on whether it's going to be called or composed again. > > I don't see why you wouldn't just turn it into machine code right off > How would it allocate registers? How are arguments passed in? How does with a bit of compiler intelligence. > Efficient allocation of registers is probably the most important thing a I would say parallelization of instructions is more important now on > compiler does that relies on seeing as much of the source structure as > possible before doing stuff, and is also one of the more important > issues in efficient compilation. multi-core machines. > > > Turning it into machine code for calling isn't going to be totally No, not neccessarily. > > > trivially cheap, it's going to have to enter a compiler somewhere... > > Well yes, just like any byte code. > My point being though, that it will have to enter the compiler every > The alternative is to have a fast That's one approach. There are more sophistciated approaches as well. > interpreter, maybe using your self-described naive scheme where simple > cookie-cutter machine code blocks get pasted together. > I will say that I know much thought has gone into this kind of thing in Okay, but you have to realize that in typed functional languages like > the Lisp world, and I'm not deeply familiar with optimization techniques > that have been applied there, so I'm actually unqualified to object to > it. But I brought it up anyway, since no one else is reacting :) OCaml and Haskell there are new classes of optimization techniques, like higher order function fusion, and deforestation, which is very effective. Untyped languages like Lisp/Scheme, have their own set of problems which obfuscate the issues of compiling higher order functions. [snip] > Yes, I would say that interpreting would typically be faster than an That is simply not the case, but I'm not going to argue it anymore. > efficient compiler for less-complex inputs, i.e. dependent on a low 'n'. > But when I think about it now, it's like layering e.g. the Hotspot JIT > inside itself; that is, the JIT generates code that interprets yet falls > over to (re)compilation if enough reps are done... > You'll have to forgive me, I'm a little slow for new ideas :) Well I intended 100000, and 2 to be run-time values, but either way it > > What would you say, if I generated assembly code for the following > > int[] a = new array[1000000]; > > And it was over 20 times as fast as C#? Would you buy me a pint of > Well now, technically, a Lisp compiler could evaluate that at compile demonstrates the same thing: if we had higher-order isntructions in the byte-code we could pre- evaluate many instructions at compile-time. I think you are stuck with the assumption that higher-order > The main limiting factors on the speed of typical CLR & C# And delegates are black boxes because higher order code can't be > implementation of above snippet are the cost of calling through a > delegate, and the opaqueness of a delegate to optimization - that is, > when the compiler is processing the definitions of Map and Fold, it > can't use information about the actual arguments to optimize as much as > it could if things were coded as a loop. That isn't to say that Map & > Fold aka Reduce don't have interesting optimization strategies in their > own right, the point is that the extra indirection of delegates is a > black box for the compiler. expressed as byte-code. One of the points of higher-order instructiosn is to be able to apply I'm going to have to stop the conversation dead here thought because I Thanks for the stimulating discourse Barry, You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||