From e2ad0e63077cc08c14edebae54925c50828cde3a Mon Sep 17 00:00:00 2001 From: Tuncer Ayaz Date: Thu, 27 Jan 2011 11:49:57 +0100 Subject: Fix typos in efficiency guide --- system/doc/efficiency_guide/advanced.xml | 2 +- system/doc/efficiency_guide/binaryhandling.xml | 6 +++--- system/doc/efficiency_guide/drivers.xml | 2 +- system/doc/efficiency_guide/functions.xml | 2 +- system/doc/efficiency_guide/processes.xml | 8 ++++---- system/doc/efficiency_guide/profiling.xml | 16 ++++++++-------- system/doc/efficiency_guide/tablesDatabases.xml | 6 +++--- 7 files changed, 21 insertions(+), 21 deletions(-) (limited to 'system/doc') diff --git a/system/doc/efficiency_guide/advanced.xml b/system/doc/efficiency_guide/advanced.xml index 8126b93a2d..821175bb09 100644 --- a/system/doc/efficiency_guide/advanced.xml +++ b/system/doc/efficiency_guide/advanced.xml @@ -34,7 +34,7 @@

A good start when programming efficiently is to have knowledge about how much memory different data types and operations require. It is implementation-dependent how much memory the Erlang data types and - other items consume, but here are some figures for + other items consume, but here are some figures for the erts-5.2 system (OTP release R9B). (There have been no significant changes in R13.)

diff --git a/system/doc/efficiency_guide/binaryhandling.xml b/system/doc/efficiency_guide/binaryhandling.xml index 3628d7a232..425d6308cf 100644 --- a/system/doc/efficiency_guide/binaryhandling.xml +++ b/system/doc/efficiency_guide/binaryhandling.xml @@ -114,7 +114,7 @@ my_binary_to_list(<<>>) -> [].]]> data. For each field that is matched out of a binary, the position in the match context will be incremented.

-

In R11B, a match context was only using during a binary matching +

In R11B, a match context was only used during a binary matching operation.

In R12B, the compiler tries to avoid generating code that @@ -205,7 +205,7 @@ Bin4 = <>, %% 5 !!! ProcBin for the binary. The reason is that the binary object can be moved (reallocated) during an append operation, and when that happens the pointer in the ProcBin must be updated. If there would be more than - on ProcBin pointing to the binary object, it would not be possible to + one ProcBin pointing to the binary object, it would not be possible to find and update all of them.

Therefore, certain operations on a binary will mark it so that @@ -291,7 +291,7 @@ my_binary_to_list(<<>>) -> [].]]> that initializes the matching operation will basically do nothing when it sees that it was passed a match context instead of a binary.

-

When the end of the binary is reached and second clause matches, +

When the end of the binary is reached and the second clause matches, the match context will simply be discarded (removed in the next garbage collection, since there is no longer any reference to it).

diff --git a/system/doc/efficiency_guide/drivers.xml b/system/doc/efficiency_guide/drivers.xml index 9fe54fb19a..1967fd7ada 100644 --- a/system/doc/efficiency_guide/drivers.xml +++ b/system/doc/efficiency_guide/drivers.xml @@ -40,7 +40,7 @@ any code in a driver.

By default, that lock will be at the driver level, meaning that - if several ports has been opened to the same driver, only code for + if several ports have been opened to the same driver, only code for one port at the same time can be running.

A driver can be configured to instead have one lock for each port.

diff --git a/system/doc/efficiency_guide/functions.xml b/system/doc/efficiency_guide/functions.xml index fe14a4f000..6be49dd7c9 100644 --- a/system/doc/efficiency_guide/functions.xml +++ b/system/doc/efficiency_guide/functions.xml @@ -127,7 +127,7 @@ map_pairs2(_Map, [_|_]=Xs, [] ) -> map_pairs2(Map, [X|Xs], [Y|Ys]) -> [Map(X, Y)|map_pairs2(Map, Xs, Ys)].]]> -

the compiler is free rearrange the clauses. It will generate code +

the compiler is free to rearrange the clauses. It will generate code similar to this

DO NOT (already done by the compiler)

diff --git a/system/doc/efficiency_guide/processes.xml b/system/doc/efficiency_guide/processes.xml index a25ec53370..b75be7d531 100644 --- a/system/doc/efficiency_guide/processes.xml +++ b/system/doc/efficiency_guide/processes.xml @@ -105,7 +105,7 @@ loop() -> spawn_opt/4.

The gain is twofold: Firstly, although the garbage collector will - grow the heap, it will it grow it step by step, which will be more + grow the heap, it will grow it step by step, which will be more costly than directly establishing a larger heap when the process is spawned. Secondly, the garbage collector may also shrink the heap if it is much larger than the amount of data stored on it; @@ -172,7 +172,7 @@ days_in_month(M) ->

Shared sub-terms are not preserved when a term is sent to another process, passed as the initial process arguments in the spawn call, or stored in an ETS table. - That is an optimization. Most applications do not send message + That is an optimization. Most applications do not send messages with shared sub-terms.

Here is an example of how a shared sub-term can be created:

@@ -237,8 +237,8 @@ true
The SMP emulator -

The SMP emulator (introduced in R11B) will take advantage of - multi-core or multi-CPU computer by running several Erlang schedulers +

The SMP emulator (introduced in R11B) will take advantage of a + multi-core or multi-CPU computer by running several Erlang scheduler threads (typically, the same as the number of cores). Each scheduler thread schedules Erlang processes in the same way as the Erlang scheduler in the non-SMP emulator.

diff --git a/system/doc/efficiency_guide/profiling.xml b/system/doc/efficiency_guide/profiling.xml index 65d13408bc..8be1c7175d 100644 --- a/system/doc/efficiency_guide/profiling.xml +++ b/system/doc/efficiency_guide/profiling.xml @@ -74,7 +74,7 @@ What to look for

When analyzing the result file from the profiling activity you should look for functions that are called many - times and have a long "own" execution time (time excluded calls + times and have a long "own" execution time (time excluding calls to other functions). Functions that just are called very many times can also be interesting, as even small things can add up to quite a bit if they are repeated often. Then you need to @@ -87,7 +87,7 @@ Are there redundant tests that can be removed? Is there some expression calculated giving the same result each time? - Is there other ways of doing this that are equivalent and + Are there other ways of doing this that are equivalent and more efficient? Can I use another internal data representation to make things more efficient? @@ -138,7 +138,7 @@

cprof is something in between fprof and cover regarding features. It counts how many times each function is called when the program is run, on a per module - basis. cprof has a low performance degradation (versus + basis. cprof has a low performance degradation effect (versus fprof and eprof) and does not need to recompile any modules to profile (versus cover).

@@ -231,7 +231,7 @@ consistent from run to run. The disadvantage is that the time spent in the operating system kernel (such as swapping and I/O) are not included. Therefore, measuring CPU time is misleading if - any I/O (file or sockets) are involved.

+ any I/O (file or socket) is involved.

It is probably a good idea to do both wall-clock measurements and CPU time measurements.

@@ -239,18 +239,18 @@

Some additional advice:

- The granularity of both types measurement could be quite + The granularity of both types of measurement could be quite high so you should make sure that each individual measurement lasts for at least several seconds. To make the test fair, each new test run should run in its own, - newly created Erlang process. Otherwise, if all tests runs in the + newly created Erlang process. Otherwise, if all tests run in the same process, the later tests would start out with larger heap sizes - and therefore probably does less garbage collections. You could + and therefore probably do less garbage collections. You could also consider restarting the Erlang emulator between each test. Do not assume that the fastest implementation of a given algorithm - on computer architecture X also is the fast on computer architecture Y. + on computer architecture X also is the fastest on computer architecture Y. diff --git a/system/doc/efficiency_guide/tablesDatabases.xml b/system/doc/efficiency_guide/tablesDatabases.xml index 4b53348c4c..2f5103a08b 100644 --- a/system/doc/efficiency_guide/tablesDatabases.xml +++ b/system/doc/efficiency_guide/tablesDatabases.xml @@ -280,9 +280,9 @@ lists:filter(fun(X) -> X#person.name == "Bryan" end, TabList),

A simple solution would be to use the name field as the key instead of the idno field, but that would cause problems if the names were not unique. A more general solution - would be create a second table with name as key and idno as - data, i.e. to index (invert) the table with regards to the - name field. The second table would of course have to be + would be to create a second table with name as key and + idno as data, i.e. to index (invert) the table with regards + to the name field. The second table would of course have to be kept consistent with the master table. Mnesia could do this for you, but a home brew index table could be very efficient compared to the overhead involved in using Mnesia.

-- cgit v1.2.3