Skip to main content

Home/ Coders/ Group items tagged algorithm-analysis

Rss Feed Group items tagged

Joel Bennett

Reservoir Sampling - Gregable - 0 views

  •  
    A description of the reservoir sampling algorithm for randomly selecting N items from a collection of unknown size in a single iteration ... including a discussion of how to deal with weighted inputs.
Fabien Cadet

Programming as if Performance Mattered, by James Hague [2004-04-04] - 3 views

  • I frequently see bare queries from programmers in discussion forums, especially from new programmers, who are worried about performance. These worries often stem from popular notions about what operations are "slow." Division. Square roots. Mispredicted branches. Cache unfriendly data structures.
  • Inevitably someone chimes in that making out-of-context assumptions, especially without profiling, is a bad idea. And they're right.
  • The golden rule of programming has always been that clarity and correctness matter much more than the utmost speed. Very few people will argue with that. And yet do we really believe it? If we did, then 99% of all programs would be written in something like Python. Or Erlang.
  • ...5 more annotations...
  • At the same time, such concerns and advice seem to remain constant despite rapid advances in hardware.
  • That tempting, enticing, puzzle-solving activity called "optimization," it hasn't gone away either.
  • Only now the process is on a different level. It isn't machine level twiddling and cycle counting, but it isn't simply mathematical analysis of algorithms either.
  • The big difference is that the code changes I made are substantially safer than running a program and having it silently hang the system. All array accesses are bounds-checked. There's no way to accidentally overwrite a data structure. There's no way to create a memory leak.
  • Really, this is what those cycle-counting programmers from 1985 dreamed of.
  •  
    « I frequently see bare queries from programmers in discussion forums, especially from new programmers, who are worried about performance. These worries often stem from popular notions about what operations are "slow." Division. Square roots. Mispredicted branches. Cache unfriendly data structures. »
1 - 2 of 2
Showing 20 items per page