Question: I'm developing a long-running multi-threaded Python application for Windows, and I want the process to know the CPU time that each of its threads has taken. I can get the overall times for the entire process with [os.times()](http://docs.python.org/library/os.html#os.times) but I need to know the per-thread times.

I know that there are external tools such as the Sysinternals Process Explorer, but my program itself needs to have this information. If I were on Linux, I look in the `/proc` filesystem, [as described here](https://stackoverflow.com/questions/2040257/measuring-amount-of-cpu-time-taken-by-a-piece-of-code-in-c-on-unix-linux). If I were writing C code, I'd use the `GetThreadTimes` call, [as described here](https://stackoverflow.com/questions/1393006/how-to-get-the-cpu-usage-per-thread-on-windows-win32).

So how can I accomplish this on Windows using Python?

Answer: 
```
var n= 0;
for (var i in jQuery.cache)
    n++;

```

Now `n` holds the number of elements jQuery has ‘touched’ (added data to, such as event handlers).

Previously this used to be a whole lot, as it would ‘touch’ every element it was even *checking* for data. This unpleasantness is fixed in jQuery 1.4.

As for clearing content, yes, you can use `innerHTML= ''` to remove all the content without giving jQuery the chance to detach its data so very slowly. If you know there are no ‘touched’ elements inside the element that's a win, but otherwise it's a potential memory leak until the page is reloaded, as unused `jQuery.cache` data stays around.

Using `live()`/`delegate()` event binding avoids adding data to its target elements, which can allow you to use this short-cut more freely. However if you have a lot of events to bind and they're not selectors that are very easy to match quickly, this can make event handling slow.

(Because there is no browser-native speedup like `querySelectorAll` for matching elements against a particular selector as delegation needs to do; this is proposed for Selectors-API level 2.)
```
var elementCount = $('*').length;

```

This doesn't really have much to do with jQuery except insofar as it's a handy way to get the answer.