Field of Science

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

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