Re: recursive GetEnumerator()
- From: "colin" <colin.rowe1@xxxxxxxxxxxxxxxxxx>
- Date: Wed, 27 Jun 2007 13:13:55 GMT
"Jon Skeet [C# MVP]" <skeet@xxxxxxxxx> wrote in message
news:MPG.20ea1b5e3993d38c275@xxxxxxxxxxxxxxxxxxxxxxx
colin <colin.rowe1@xxxxxxxxxxxxxxxxxx> wrote:
although I had assumed it just put the code inline or something,
and put the code inside the foreach block at each yeild statement.
No, it couldn't do that - don't forget that foreach could be in one
type, and the iterator in a completely different one.
The way I implemented it before in c was to pass a function to the iterator,
it might of been simpler to use if the iterator was like a macro.
I had hoped it would expand the iterator in the code where the foreach
was used, but obviously this isnt so... too much to hope for ;)
I gues if the type isnt completly fixed at compile time this isnt possible
anyway.
Ive not tried using reflection or looking at the code directly,
im not sure I want to atm lol, I might not understand or like what I see.
There's a big difference between Reflector and reflection... if you
haven't used Reflector before, it's well worth downloading (just Google
for it).
thanks, Il have a look sometime, I think the important thing is that the
binary searching is fast and I havnt heard anything yet to think otherwise.
Ive not realy had any problems where I realy needed to see what was going on
underneath the code.
although I had to do a bit of work to get memory usage down to <2gb.
maybe its not as fast as I would like if its actually storing the stack
info,
but then this isnt a method that will be used intensivly to access the
list.
my original implementation was written partly in assembler many years ago
when CPU power wasnt so plentifull.
before that I also had a microcode version for a bit slice processor,
before content addressable ram made it obsolete.
Indeed - I wouldn't worry about speed until you've definitely got a
problem. It's not likely to be particularly slow, although using it
recursively can be a bit more of a hit than might be ideal:
http://blogs.msdn.com/toub/archive/2004/10/29/249858.aspx
thanks thats quite interesting read, ofc a tree is very good for searches,
and isnt so likely to be used like this often,
but it might be worth considering dumping it to an array,
wich could be quite quick and easy,
and iterating that, this might be quicker if the whole list was iterated.
in fact this might lead to an easy way of balancing the tree.
Colin =^.^=
.
- Follow-Ups:
- Re: recursive GetEnumerator()
- From: Jon Skeet [C# MVP]
- Re: recursive GetEnumerator()
- References:
- recursive GetEnumerator()
- From: colin
- Re: recursive GetEnumerator()
- From: Göran Andersson
- Re: recursive GetEnumerator()
- From: colin
- Re: recursive GetEnumerator()
- From: Göran Andersson
- Re: recursive GetEnumerator()
- From: colin
- Re: recursive GetEnumerator()
- From: Jon Skeet [C# MVP]
- Re: recursive GetEnumerator()
- From: colin
- Re: recursive GetEnumerator()
- From: Jon Skeet [C# MVP]
- Re: recursive GetEnumerator()
- From: colin
- Re: recursive GetEnumerator()
- From: Jon Skeet [C# MVP]
- Re: recursive GetEnumerator()
- From: colin
- Re: recursive GetEnumerator()
- From: Jon Skeet [C# MVP]
- recursive GetEnumerator()
- Prev by Date: How to make a safe HTTP stream reading?
- Next by Date: Re: (combobox) how to ... or how to ...
- Previous by thread: Re: recursive GetEnumerator()
- Next by thread: Re: recursive GetEnumerator()
- Index(es):
Relevant Pages
|