Q:

`tar` slow  performance through `xargs`

Please consider this snippet:
tar -Oxvf archive.tgz | grep something
or this:
tar tf archive.tgz > /tmp/x && tar -Oxvf archive.tgz -T /tmp/x | grep something
versus this:
tar tf archive.tgz | xargs -I{} tar -Oxvf archive.tgz {} | grep something
First two snippets are very fast and similar, while third is ~40 times slower (this index is relative to archive contents I guess).  Why is that? 

A:

The key here is your use of -I{} in xargs.  The man page says:
   -I replace-str

Replace  occurrences  of replace-str in the initial-arguments  with names read from standard input.   Also, unquoted blanks do not
  terminate input items; instead the separator is the newline character. 
  Implies -x and -L 1. 

The implied -L 1 makes xargs run your tar -Oxvf archive.tgz {} once per file in the archive, rather than running tar once to extract all the files listed on xargs' stdin. 
Simplified example of the difference:
$ (echo foo; echo bar)|xargs -I{} echo {}
foo
bar

$ (echo foo; echo bar)|xargs echo 
foo bar

Fixed:
tar tf archive.tgz | xargs tar -Oxvf archive.tgz | grep something

Note however that the output of this will not be the same as what you get using xargs -I{} if the file names given to xargs are not in tar file order (i.e. the same order that tar t lists them in).  The xargs -I{} version will ouptut the files in the order you provided to xargs, whereas this version will output them in tar file order.