Field of Science

  • in The Biology Files
  • in inkfish
  • in Life of a Lab Rat
  • in The Greenhouse
  • in PLEKTIX
  • in Chinleana
  • in RRResearch
  • in The Culture of Chemistry
  • in Disease Prone
  • in The Phytophactor
  • in The Astronomist
  • in Epiphenom
  • in Sex, Genes & Evolution
  • in Skeptic Wonder
  • in The Large Picture Blog
  • in Memoirs of a Defective Brain
  • in C6-H12-O6
  • in The View from a Microbiologist
  • in Labs
  • in Doc Madhattan
  • in The Allotrope
  • in The Curious Wavefunction
  • in A is for Aspirin
  • in Variety of Life
  • in Pleiotropy
  • in Catalogue of Organisms
  • in Rule of 6ix
  • in Genomics, Evolution, and Pseudoscience
  • in History of Geology
  • in Moss Plants and More
  • in Protein Evolution and Other Musings
  • in Games with Words
  • in Angry by Choice

Thank you for the comments!

The profiling I did yesterday, using DProf as suggested in a comment from Keith, showed that most of the runtime was spent in the Switch statements that are the heart of the sliding-window scoring algorithm. In new comments, Keith and Conrad explained that 'Switch' is not the fastest way to do the scoring, and that replacing it with a cascade of if/else statements could be a lot faster. (Faithful commenter Neil had also pointed out that Switch is buggy, but it wasn't setting off any alarms.)

So I've just replaced all three of the switch scoring steps with if/else cascades, and here's the spectacular results. Thanks, guys!

2 comments:

  1. Wow! I did mention that using Switch was a bad idea in your original post; but would not have guessed that its performance was so poor as used here.

    ReplyDelete
  2. Yes, I think Neil deserves the prize for the most foresight.

    ReplyDelete

Markup Key:
- <b>bold</b> = bold
- <i>italic</i> = italic
- <a href="http://www.fieldofscience.com/">FoS</a> = FoS