Can compiler optimization introduce bugs?

Compiler optimizations can introduce bugs or undesirable behaviour. That’s why you can turn them off. One example: a compiler can optimize the read/write access to a memory location, doing things like eliminating duplicate reads or duplicate writes, or re-ordering certain operations. If the memory location in question is only used by a single thread and … Read more

Deflate compression browser compatibility and advantages over GZIP

UPDATE: Browsers have been dropping support for raw deflate. zOompf has completed some very thorough research on this very topic here. Unfortunately, it appears that raw deflate is NOT safe to use. Check http://www.vervestudios.co/projects/compression-tests/results for more results. Here are the browsers that have been tested: /* Browser DEFLATE ZLIB */ XP Internet Explorer 6 PASS … Read more

How can I rank observations in-group faster?

The answer from Marek in this question has proven very useful in the past. I wrote it down and use it almost daily since it was fast and efficient. We’ll use ave() and seq_along(). foo <-data.frame(person=c(rep(“pers1”,3),rep(“pers2”,2)),year=c(1999,2000,2003,1998,2011)) foo <- transform(foo, obs = ave(rep(NA, nrow(foo)), person, FUN = seq_along)) foo person year obs 1 pers1 1999 1 … Read more

What is copy-on-write?

I was going to write up my own explanation but this Wikipedia article pretty much sums it up. Here is the basic concept: Copy-on-write (sometimes referred to as “COW”) is an optimization strategy used in computer programming. The fundamental idea is that if multiple callers ask for resources which are initially indistinguishable, you can give … Read more