The MASM Forum

General => The Workshop => Topic started by: jj2007 on April 27, 2018, 05:29:24 PM

Title: Shlemiel the painter’s algorithm
Post by: jj2007 on April 27, 2018, 05:29:24 PM
QuoteShlemiel gets a job as a street painter, painting the dotted lines down the middle of the road. On the first day he takes a can of paint out to the road and finishes 300 yards of the road. "That's pretty good!" says his boss, "you're a fast worker!" and pays him a kopeck.

The next day Shlemiel only gets 150 yards done. "Well, that's not nearly as good as yesterday, but you're still a fast worker. 150 yards is respectable," and pays him a kopeck.

The next day Shlemiel paints 30 yards of the road. "Only 30!" shouts his boss. "That's unacceptable! On the first day you did ten times that much work! What's going on?"

"I can't help it," says Shlemiel. "Every day I get farther and farther away from the paint can!"

Credits to Joel CEO of SOF (https://www.joelonsoftware.com/2001/12/11/back-to-basics/). Also a nice read: a cardinal, fundamental law of programming: It's harder to read code than to write it (https://www.joelonsoftware.com/2000/04/06/things-you-should-never-do-part-i/)

I've searched the old and new forums, but it seems we never had a thread on optimising string concatenation... strange ::)
Title: Re: Shlemiel the painter’s algorithm
Post by: K_F on April 28, 2018, 08:59:56 AM
Shlemiel has never heard of Binary Trees,  or Sorting and Searching algorithms  ;)
Title: Re: Shlemiel the painter’s algorithm
Post by: hutch-- on April 28, 2018, 10:48:55 AM
> we never had a thread on optimising string concatenation

Hmmmm, I may be able to help you here as I have just finished a technique in 32 bit code.