How are the memory and speed of a program related in a web browser like chrome? How are the memory and speed of a program related in a web browser like chrome? google-chrome google-chrome

How are the memory and speed of a program related in a web browser like chrome?


Memory and speed of a program are not closely interrelated.

Simple examples:

  • Computer with almost no ram but lotsof hard drive space is going to bethrashing the hard drive for virtualmemory. This will slow things downas hard drives are significantlyslower than ram.
  • A computer built outof all ram is not going to do thesame thing. It won't have to go to the hard drive so will stay quicker.
  • Caching usually takes up a lot ofram. It also significantly increasesthe speed of an application. This ishow memcache works.
  • An algorithm may take a long time butuse very little ram. Think of aprogram that attempts calculating PI.It will never finish, but needs verylittle ram.

In general, the less ram you use (minus caching) the better for speed because there's less chance you're going to run into constraints imposed by other processes.

If you have a program that takes considerable time to calculate items that are going to be referenced again. It makes sense to cache them memory so you don't need to recalculate them.

You can mix the two by adding timeouts to the cached items. Every time you add another item to the cache, you check the items there and remove any that haven't been accessed in a while. "A while" is determined by your need.