Email or username:

Password:

Forgot your password?
13 comments
Luci for dyeing

@arnelson i am saying these strategies are good and we should do them. reject arbitrary notions of programming morality

Luci for dyeing

@arnelson we might have a different notion of what makes a “good” program- but these notions are irrelevant to the process of creating a program in the first place. it is easier to correct a wrong program than to create a program perfectly from blank canvas

Josh Jersild

@zens @arnelson I am definitely team "the naive implementation is probably fast enough"

MarjorieR

@JoshJers @zens @arnelson "the naive implementation is probably fast enough" - not when it's bubble sort it isn't.

Josh Jersild

@marjolica @zens @arnelson bubble sort is great if you only have like 20 items, or the list is nearly sorted already 😃

Josh Jersild

@marjolica @zens @arnelson also if it's not fast enough it'll show up on the profiler and you'll fix it

MarjorieR

@JoshJers @zens @arnelson Correct: I found that the bubble sort was the reason it took so long by profiling the program.

MarjorieR

@JoshJers @zens @arnelson back in 1974 I inherited a large Fortran program (about 2000 punch cards) that ran on IBM370 mainframes. The purpose was to calculate the UK power stations fuel use. It used to take 2 minutes of CPU time to run the entire program. It included a bubble sort to put the list of the power stations into 'merit order'. There were about 3000 items in the list. When I replaced bubble sort by quick sort I reduced the total run time to 2 seconds with big savings to our budget.

Josh Jersild

@marjolica @zens @arnelson Yeah, 3000 is definitely the wrong number of elements for bubble sort to be a good choice, *especially* in 1974 😁

MarjorieR

@JoshJers @zens @arnelson the program used to run in a 150kb partition. 2 minutes CPU cost about £100 (1974 prices) for each run.

Luci for dyeing

@marjolica @JoshJers @arnelson well, the rule of thumb is “probably” not “definitely”. sometimes we work ourselves up about scaling problems that just never happen

Josh Jersild

@zens @marjolica @arnelson exactly! The ultimate point is "write it the most straightforward way you can to start, then fix performance problems when they become apparent"

Luci for dyeing replied to Josh

@JoshJers @marjolica @arnelson and also, once again, these are strategies for when you get stuck, not general rules of thumb

Go Up