[轉載] Optimize your Internet speed – relocate the cache

Decent Pocket PC browsers have a so-called ‘cache’ of the downloaded Web resources (Web pages, images, other files) on the local device so that subsequent requests for the same resources (if they haven’t changed on the Web server) may result in quickly reloading them from the local file system instead of getting them from the Web server again. This may result in great bandwidth/time savings.

Browsers that do have a local cache are Pocket Internet Explorer (PIE for short) and NetFront (NF) from version 3.2. (Note that you should switch off local caching in pre-3.2 NF versions entirely because it’s buggy and generally useless for non-offline browsing purposes.) Note that Thunderhawk, Minimo and Opera Mini don’t use any kind of local cache – if you only use them, as opposed to PIE/NF, you don’t need to read this article.

What do you gain by relocating the cache?

First, precious RAM memory, which is extremely important with devices with (comparatively) less memory (even including 64M RAM devices). You may gain a lot of memory with the relocation; especially on WM2003SE devices, where the maximal
size of the cache is virtually unlimited in practice.

Second, generic (not just in PIE, but also in everything) speed and responsiveness. The more files in RAM (independent of their size), the more the Pocket PC/Windows Mobile operating system slows down. Therefore, it’s the best, also system speed/responsiveness-wise, to try to move out files out of RAM – including cache files.

How come the cache speed can actually be faster when relocated to a “slow” memory card??

Many people think the cache of PIE or NF should be in the main RAM for optimal performance because the built-in RAM is about two orders of magnitude faster than flash ROM-based storage cards. This is true if you don’t fine-tune your memory card(s) for optimal performance, as can be seen for example here.
(Those tests were done with unoptimized memory cards.) (Note that the same stands for built-in File Stores (where applicable): they are very slow to write to and, therefore, slow down the browsing considerably if you relocate the PIE cache in there. Therefore, you should never try to relocate your PIE/NF cache to any kind of built-in Flash ROM (File Store). Not just because it’ll be really slow, but also you can actually kill your File Store with devices that have faulty File Store controllers like the iPAQ rx3715).

If you, however, do optimize your cards (note that you can’t optimize built-in File Stores – they will always remain extremely slow!), they can actually be better for storing the cache files than the RAM because it’s not the RAM write speed that counts when creating and storing a lot of cache files but also additional, RAM-only overheads like the Object Store management overhead, which can very easily render the RAM access speed advantage non-existing if you need to create tons of new files. Then, the Object Store management overhead may even result in slower operation than with flash cards. Note that this only refers to pages that have dozens or even hundreds of resources. Pages that don’t contain any related resources or if you always browse without displaying images, RAM-based cache will always be at least 30-60% faster than a relocated one because, then, it’s only the pure
transfer (write) speed that counts and not the overhead caused by creating tons of files. That is, if you always switch off images while browsing the Web, you will not encounter any PIE speed increase if you switch to using external cards. You will, however, notice overall operating system speed increase even then because of the fewer files in RAM. There is a tradeoff here – you need to decide yourself. For example, some benchmark results with optimized cards, based on this article:


the same iPAQ 2210 that loaded the same test Web page (full of different image files that were then stored in the cache) in 1:25; it
spent 1:27 in doing the same while storing the files on a hi-speed Ridata card and 1:40 while storing the files on a cheapo SanDisk card.

the same Pocket Loox 720 that loaded this test page in 1:34 while using the RAM as the cache storage only spent 1:23 while using the Ridata. On the other hand, it spent 4:40 with an unoptimized, low-end Kingston card. With the same Kingston card, but with optimized file system, this time has decreased to 1:30.

It can clearly be seen that if you optimize your cards, even the cheapest and slowest ones (mostly Kingston, but also low-end SanDisk cards) can be used for storing the PIE / NF cache with even better speed than the built-in RAM.

How do you optimize your storage card speed?

Please read this article – it contains all the necessary information. Please also note that you should not try relocating your cache without optimizing your card(s) – this may result in slowdowns of even 3-4 times!

After optimizing your storage card speed, how do you relocate the PIE/NF cache to the card?

(Please note that this section will only contain PIE-related relocation techniques. Therefore, if you want to relocate your NF 3.2 cache, skip the rest of this section and go straight to section Relocate the NF 3.2 cache. You, however, may still want to read the following subsection on choosing the right Registry Editor because you will need one for relocating the NF 3.2 cache.)

Both PIE and NF (I only refer to version 3.2 of NF because, as has already been pointed out, older versions have a totally faulty cache engine and, therefore, their caching should be disabled unless you want to explicitly browse them) store the path of the cache in the Registry. You can freely overwrite this value with both a so-called ‘Registry Editor’ or, with PIE, with a specialized program. The former is better in that you don’t end up installing another system tweaker application (particularly if you
already have a Registry editor on your PPC); the latter is a bit safer, especially for non-Pocket PC-gurus.

If you aren’t afraid of manually editing the registry – in most cases, it’s much more instructive – and prefer it to using pre-made programs, grab a registry editor (if you don’t already have one) and manually edit [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\Cache] .

1. Make a cache directory on your (optimized) memory card. Let’s call it, for example, ‘cache‘ (its name is really irrevelant).
2. go to [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders]
3. click Cache in the pane below (if you use any registry editor except Total Commander 2.0); it’s highlighted in the following screenshot:

Registry Editor Shell Folders

4. enter the new path instead of the old (\Windows\Profiles\guest\Temporary Internet Files); for example, \CF-Card\cache:

Registry Editor Cache value

5. now, the updated value should be shown in the Cache value:

Registry Editor Cache value changed

(Please
note that you don’t need to reset your device after modifying this
value, contrary to what some people say. The same stands for
stand-alone cache path modification utilities – they reset the PPC
totally unnecessarily.)

If you go the safer/easier way (instead of manually editing the Registry), you have several choices:

Tweaks2k2.NET

Go to Tweaks/Internet Tricks and, on the PIE tab, choose the right storage card in the ‘Temp. Files saved in‘ drop-down list:

Pocket IE Cache settings

SKTools

SKTools is an all-in-one tool with extremely good price/performance ratio for the Pocket PC.
I really recommend it – not only for relocating the cache, but also for
a lot of other tasks (for example, optimizing your storage cards.)

Click System Tweaks:

SKTools system tweaks

and, after clicking ‘PIE cache location’, choose the right directory by clicking the button in the top right corner and choose the target. After this, the new path will already be visible:

SKTools PIE cache location

After this, just click OK and you may exit the application.

MemMaid

Go to the fourth tab (Memory Tweaks), choose the right storage card from the “IE Cache Folder” drop-down list and click Apply (which will be followed by a reset):

MemMaid memory tweaks

A bit of warning

Please note that, with PIE, you should never remove the memory card that has the cache on it during you browse the net
(or just start PIE – PIE will recreate the cache directory structure when it’s started). This is because if PIE doesn’t find the directory
that your card is mapped (mounted) into the file system (\SD Card, \Storage Card, \SD-MMCard, \CF Card etc.) because you’ve removed the card, it just creates one. However, when you reinsert your storage card in the PDA, the operating system won’t be able to mount the storage card under the same directory name because it already exists. Therefore, it’ll append a number ‘2’ to the
directory name; for example, it becomes \CF Card2. This also means 1, all your existing links will be dead 2, the cache
will physically also be relocated to the RAM and will, therefore, decrease the overall responsiveness of your PDA and also waste precious RAM memory.

Note that this is also explained in my article here and here, referring to relocating the Messaging/Pocket Inbox attachments to a
storage card. It describes exactly the same problems (with the additional problem of the Messaging Today plug-in).

As an example of such a problematic re-mapping, see the following screenshot. The two directories (one is a bogus directory created by PIE, the other is the real memory card mounted) in the root directory are highlighted:

File Explorer

If you pay special attention to the icons of the two directories, you’ll notice that \CF Card is a non-mounted (that is, RAM) directory because it doesn’t have the ‘memory card’ icon in front of its name, while \CF Card2 is where the real CF card is mounted – this is why it has the ‘memory card’ icon in front of it.

NF doesn’t cause problems like this – that is, you can safely remove the card containing the NF cache during using the application, it won’t create a bogus directory resulting in remapping problems.

Relocate the NF 3.2 cache

You can only do this with a registry editor. Navigate to HKEY_CURRENT_USER\Software\access.co.jp\NetFront32\BrowserPref and edit L2CacheDir (highlighted below) exactly the same way as with the PIE registry entry:

Registry Editor BrowserPref

Registry Editor L2CacheDir value

That’s all, folks !

Please leave your comment on the topic