IWETHEY v. 0.3.0 | TODO
1,095 registered users | 0 active users | 0 LpH | Statistics
Login | Create New User
IWETHEY Banner

Welcome to IWETHEY!

New Why worry about that factor of 2?
The problem with this is you don't get a loop exit once you've found what you're looking for. So I use findLast which searches until found.

Sure, on average you will cut your search time by a factor of 2. But if you have enough buckets to care, then you really should use a binary search strategy instead.

So either I wouldn't care, or I would care and do a lot better.

So why worry about the factor of 2?

Cheers,
Ben
"good ideas and bad code build communities, the other three combinations do not"
- [link|http://archives.real-time.com/pipermail/cocoon-devel/2000-October/003023.html|Stefano Mazzocchi]
New Habit, I suppose
From working on powerflow simulators that ran simulations over long periods of time. A factor of 2 might be the difference between getting an answer Friday or late next week.

:-P

But I do see your point on the BSearch. I don't know if there's a handy one built in though. Don't have squeak handy on the work machine. I'll look later.



"I believe that many of the systems we build today in Java would be better built in Smalltalk and Gemstone."

     -- Martin Fowler, JAOO 2003
New It isn't just you though
I've seen a lot of people from Smalltalk environments who are perfectly happy to use an array with a detect method where something like a hash would make a lot more sense.

I have been left to wonder if they got in the habit of abstracting so far that they forgot the algorithm implications of their choices?

Cheers,
Ben
"good ideas and bad code build communities, the other three combinations do not"
- [link|http://archives.real-time.com/pipermail/cocoon-devel/2000-October/003023.html|Stefano Mazzocchi]
New I know what you mean
But you can't really just say something like SortedCollection should implement #detect: as binary search. Its a general purpose method and the aspect you are searching on may not have anything at all to do with the sort ordering.

I've found some find: methods that return the index. But again, because of the nature of the evaluation block, they do a linear search. I've spent a few minutes looking for a #binarySearch: or similar and haven't found one. Of course, you can add one without much effort.

Smalltalk culture is pretty much about efficiency of coding - with efficiency of implementation being seldom considered until its crucial.

Actually, there appear to be 2 cults - one dedicated to elegant simplicity of coding - which is nearly everybody - and the other dedicated to really clever (and transparent) optimizations - like the people working on croquet that are transparently offloading graphics operations to hardware as much as possible - or the people who work on the VMs.



"I believe that many of the systems we build today in Java would be better built in Smalltalk and Gemstone."

     -- Martin Fowler, JAOO 2003
     Smalltalk question - (Arkadiy) - (19)
         What's the unsolved part? -NT - (tuberculosis) - (1)
             The original problem - (Arkadiy)
         Why not solve it like you would in any language? - (ben_tilly) - (16)
             That is the problem I solved - (Arkadiy) - (15)
                 2 ways - (Simon_Jester) - (11)
                     Re: 2 ways - (Arkadiy) - (10)
                         The iterator doesn't change the algorithm (with assumption) - (Simon_Jester) - (3)
                             Smalltalk iterators are different - (Arkadiy) - (2)
                                 Okay...so your 'cheat' is the method - (Simon_Jester) - (1)
                                     see my answer to Ben below... -NT - (Arkadiy)
                         Some iterators do provide indexes - (tuberculosis) - (5)
                             Yay! - (Arkadiy)
                             Why worry about that factor of 2? - (ben_tilly) - (3)
                                 Habit, I suppose - (tuberculosis) - (2)
                                     It isn't just you though - (ben_tilly) - (1)
                                         I know what you mean - (tuberculosis)
                 Here is my second strategy in Ruby - (ben_tilly) - (2)
                     I realized that introducing a bucket class makes it easy - (Arkadiy) - (1)
                         Elegance is in the eye of the beholder - (ben_tilly)

Battling him is like wiping off puppy slobber.
171 ms