From 2fb83f9b723caedf9b6dab32839fa3fc9c892844 Mon Sep 17 00:00:00 2001 From: Tuncer Ayaz Date: Wed, 23 Feb 2011 18:53:51 +0100 Subject: Fix typos in zip manpage --- lib/stdlib/doc/src/zip.xml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/stdlib/doc/src/zip.xml b/lib/stdlib/doc/src/zip.xml index 4d98a20206..529a70a23d 100644 --- a/lib/stdlib/doc/src/zip.xml +++ b/lib/stdlib/doc/src/zip.xml @@ -34,11 +34,11 @@ zip Utility for reading and creating 'zip' archives. -

The zip module archives and extract files to and from a zip +

The zip module archives and extracts files to and from a zip archive. The zip format is specified by the "ZIP Appnote.txt" file available on PKWare's website www.pkware.com.

The zip module supports zip archive versions up to 6.1. However, - password-protection and Zip64 is not supported.

+ password-protection and Zip64 are not supported.

By convention, the name of a zip file should end in ".zip". To abide to the convention, you'll need to add ".zip" yourself to the name.

@@ -52,7 +52,7 @@ unzip/2 function. (They are also available as extract.)

To fold a function over all files in a zip archive, use the - foldl_3.

+ foldl_3 function.

To return a list of the files in a zip archive, use the list_dir/1 or the list_dir/2 function. (They @@ -155,13 +155,13 @@ zip_file()

Files will be compressed using the DEFLATE compression, as described in the Appnote.txt file. However, files will be stored without compression if they already are compressed. - The zip/2 and zip/3 checks the file extension + The zip/2 and zip/3 functions check the file extension to see whether the file should be stored without compression. Files with the following extensions are not compressed: .Z, .zip, .zoo, .arc, .lzh, .arj.

It is possible to override the default behavior and - explicitly control what types of files that should be + explicitly control what types of files should be compressed by using the {compress, What} and {uncompress, What} options. It is possible to have several compress and uncompress options. In @@ -208,7 +208,7 @@ zip_file() {compress, What} -

Controls what types of files that will be +

Controls what types of files will be compressed. It is by default set to all. The following values of What are allowed:

@@ -228,7 +228,7 @@ zip_file() {uncompress, What} -

Controls what types of files that will be uncompressed. It is by +

Controls what types of files will be uncompressed. It is by default set to [".Z",".zip",".zoo",".arc",".lzh",".arj"]. The following values of What are allowed:

@@ -292,7 +292,7 @@ zip_file()

By default, the open/2 function will open the zip file in raw mode, which is faster but does not allow a remote (erlang) file server to be used. Adding cooked - to the mode list will override the default and open zip file + to the mode list will override the default and open the zip file without the raw option. The same goes for the files extracted.

@@ -301,7 +301,7 @@ zip_file()

By default, all existing files with the same name as file in the zip archive will be overwritten. With the keep_old_files option, the unzip/2 function will not overwrite any existing - files. Not that even with the memory option given, which + files. Note that even with the memory option given, which means that no files will be overwritten, files existing will be excluded from the result.

@@ -418,7 +418,7 @@ zip_file()

By default, the open/2 function will open the zip file in raw mode, which is faster but does not allow a remote (erlang) file server to be used. Adding cooked - to the mode list will override the default and open zip file + to the mode list will override the default and open the zip file without the raw option.

-- cgit v1.2.3 From aeb8dc04fb03c98bc449319d799dc9cfc0a46e64 Mon Sep 17 00:00:00 2001 From: Tuncer Ayaz Date: Sun, 20 Feb 2011 19:19:15 +0100 Subject: Fix inet:port/1 doc to match implementation/spec --- lib/kernel/doc/src/inet.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/kernel/doc/src/inet.xml b/lib/kernel/doc/src/inet.xml index a22c0a8346..f05a224f33 100644 --- a/lib/kernel/doc/src/inet.xml +++ b/lib/kernel/doc/src/inet.xml @@ -432,7 +432,7 @@ fe80::204:acff:fe17:bf38 - port(Socket) -> {ok, Port} + port(Socket) -> {ok, Port} | {error, any()} Return the local port number for a socket Socket = socket() -- cgit v1.2.3 From b2f3b6b3b254015e0fd6540353b22ccb3df71bf7 Mon Sep 17 00:00:00 2001 From: Tuncer Ayaz Date: Tue, 1 Feb 2011 22:25:53 +0100 Subject: erts: Fix doc typos, duplication and readability --- erts/doc/src/driver.xml | 39 ++++++++++--------- erts/doc/src/erl_driver.xml | 94 +++++++++++++++++++++------------------------ erts/example/next_perm.cc | 2 +- 3 files changed, 64 insertions(+), 71 deletions(-) diff --git a/erts/doc/src/driver.xml b/erts/doc/src/driver.xml index db455312ec..2b1ed398ee 100644 --- a/erts/doc/src/driver.xml +++ b/erts/doc/src/driver.xml @@ -63,7 +63,8 @@

This is a simple driver for accessing a postgres database using the libpq C client library. Postgres is used because it's free and open source. For information - on postgres, refer to the website www.postgres.org.

+ on postgres, refer to the website + www.postgres.org.

The driver is synchronous, it uses the synchronous calls of the client library. This is only for simplicity, and is generally not good, since it will @@ -210,7 +211,7 @@ static void stop(ErlDrvData drv_data) input data is a string paramater for and . The returned data consists of Erlang terms.

The functions and are - utilities that is used to make the code shorter. + utilities that are used to make the code shorter. duplicates the string and zero-terminates it, since the postgres client library wants that. takes an buffer and allocates a binary and @@ -244,7 +245,7 @@ static int control(ErlDrvData drv_data, unsigned int command, char *buf, return r; } ]]> -

In is where we log in to the database. If the connection +

is where we log in to the database. If the connection was successful we store the connection handle in our driver data, and return ok. Otherwise, we return the error message from postgres, and store in the driver data.

@@ -264,7 +265,7 @@ static int do_connect(const char *s, our_data_t* data, ei_x_buff* x) } ]]>

If we are connected (if the connection handle is not ), - we log out from the database. We need to check if a we should + we log out from the database. We need to check if we should encode an ok, since we might get here from the function, which doesn't return data to the emulator.

-

We execute a query and encodes the result. Encoding is done +

We execute a query and encode the result. Encoding is done in another C module, which is also provided as sample code.

-

Here we simply checks the result from postgres, and +

Here we simply check the result from postgres, and if it's data we encode it as lists of lists with column data. Everything from postgres is C strings, so we just use to send @@ -392,7 +393,7 @@ disconnect(Port) -> select(Port, Query) -> binary_to_term(port_control(Port, ?DRV_SELECT, Query)). ]]> -

The api is simple: loads the driver, opens it +

The API is simple: loads the driver, opens it and logs on to the database, returning the Erlang port if successful, sends a query to the driver, and returns the result, closes the @@ -417,7 +418,7 @@ select(Port, Query) ->

Sometimes database queries can take long time to complete, in our driver, the emulator halts while the driver is doing its job. This is - often not acceptable, since no other Erlang processes + often not acceptable, since no other Erlang process gets a chance to do anything. To improve on our postgres driver, we reimplement it using the asynchronous calls in LibPQ.

@@ -472,7 +473,7 @@ typedef struct our_data_t { whether the driver is waiting for a connection or waiting for the result of a query. (This is needed since the entry will be called both when connecting and - when there is query result.)

+ when there is a query result.)

will be called again.

-

If we have result from a connect, indicated that we have data in +

If we have a result from a connect, indicated by having data in the buffer, we no longer need to select on output (), so we remove this by calling .

@@ -630,9 +631,9 @@ return_port_data(Port) -> message queue. The function above receives data from the port. Since the data is in binary format, we use to convert - it to Erlang term. Note that the driver is opened in - binary mode, is called with the option - . This means that data sent from the driver + it to an Erlang term. Note that the driver is opened in + binary mode ( is called with the option + ). This means that data sent from the driver to the emulator is sent as binaries. Without the option, they would have been lists of integers.

@@ -646,15 +647,15 @@ return_port_data(Port) -> of a list of integers. For large lists (more than 100000 elements), this will take some time, so we will perform this as an asynchronous task.

-

The asynchronous api for drivers are quite complicated. First +

The asynchronous API for drivers is quite complicated. First of all, the work must be prepared. In our example we do this in . We could have used just as well, but we want some variation in our examples. In our driver, we allocate - a structure that contains all needed for the asynchronous task + a structure that contains anything that's needed for the asynchronous task to do the work. This is done in the main emulator thread. Then the asynchronous function is called from a driver thread, - separate from the main emulator thread. Note that the driver- - functions are not reentrant, so they shouldn't be used. + separate from the main emulator thread. Note that the driver-functions + are not reentrant, so they shouldn't be used. Finally, after the function is completed, the driver callback is called from the main emulator thread, this is where we return the result to Erlang. (We can't @@ -692,7 +693,7 @@ static ErlDrvEntry next_perm_driver_entry = { be sent later from the call-back.

The will be passed to the function. We do not use a function (the last argument to - , it's only used if the task is cancelled + ), it's only used if the task is cancelled programmatically.

(drv_data); our_async_data* d = reinterpret_cast(async_data); int n = d->data.size(), result_n = n*2 + 3; - ErlDrvTermData* result = new ErlDrvTermData[result_n], * rp = result; + ErlDrvTermData *result = new ErlDrvTermData[result_n], *rp = result; for (vector::iterator i = d->data.begin(); i != d->data.end(); ++i) { *rp++ = ERL_DRV_INT; diff --git a/erts/doc/src/erl_driver.xml b/erts/doc/src/erl_driver.xml index 497a2fa01d..066a2a4b92 100644 --- a/erts/doc/src/erl_driver.xml +++ b/erts/doc/src/erl_driver.xml @@ -56,16 +56,16 @@ instance is connected to an Erlang port. Every port has a port owner process. Communication with the port is normally done through the port owner process.

-

Most of the functions takes the port handle as an +

Most of the functions take the port handle as an argument. This identifies the driver instance. Note that this port handle must be stored by the driver, it is not given when the driver is called from the emulator (see driver_entry).

-

Some of the functions takes a parameter of type +

Some of the functions take a parameter of type ErlDrvBinary, a driver binary. It should be both - allocated and freed by the caller. Using a binary directly avoid + allocated and freed by the caller. Using a binary directly avoids one extra copying of data.

-

Many of the output functions has a "header buffer", with +

Many of the output functions have a "header buffer", with hbuf and hlen parameters. This buffer is sent as a list before the binary (or list, depending on port mode) that is sent. This is convenient when matching on messages received from @@ -92,7 +92,7 @@ with SMP support without being rewritten if driver level locking is used.

-

It is assumed that drivers does not access other drivers. If +

It is assumed that drivers do not access other drivers. If drivers should access each other they have to provide their own mechanism for thread safe synchronization. Such "inter driver communication" is strongly discouraged.

@@ -113,12 +113,12 @@ call-backs may be made from different threads.

Most functions in this API are not thread-safe, i.e., - they may not be called from an arbitrary thread. Function + they may not be called from an arbitrary thread. Functions that are not documented as thread-safe may only be called from driver call-backs or function calls descending from a driver call-back call. Note that driver call-backs may be called from different threads. This, however, is not a problem for any - functions in this API, since the emulator have control over + function in this API, since the emulator has control over these threads.

Functions not explicitly documented as thread-safe are @@ -155,10 +155,10 @@ more information.

Output functions - With the output functions, the driver sends data back + With the output functions, the driver sends data back to the emulator. They will be received as messages by the port owner process, see open_port/2. The vector function and the - function taking a driver binary is faster, because that avoid + function taking a driver binary are faster, because they avoid copying the data buffer. There is also a fast way of sending terms from the driver, without going through the binary term format. @@ -193,14 +193,14 @@ use functionality from the POSIX thread API or the Windows native thread API.

-

The Erlang driver thread API only return error codes when it is +

The Erlang driver thread API only returns error codes when it is reasonable to recover from an error condition. If it isn't reasonable to recover from an error condition, the whole runtime system is terminated. For example, if a create mutex operation fails, an error code is returned, but if a lock operation on a mutex fails, the whole runtime system is terminated.

-

Note that there exist no "condition variable wait with timeout" in +

Note that there exists no "condition variable wait with timeout" in the Erlang driver thread API. This is due to issues with pthread_cond_timedwait(). When the system clock suddenly is changed, it isn't always guaranteed that you will wake up from @@ -241,7 +241,7 @@ to give you better error reports.

- Adding / remove drivers + Adding / removing drivers A driver can add and later remove drivers. Monitoring processes A driver can monitor a process that does not own a port. @@ -262,7 +262,7 @@ could, under rare circumstances, mean that drivers have to be slightly modified. If so, this will of course be documented. ERL_DRV_EXTENDED_MINOR_VERSION will be incremented when - new features are added. The runtime system use the minor version + new features are added. The runtime system uses the minor version of the driver to determine what features to use. The runtime system will refuse to load a driver if the major versions differ, or if the major versions are equal and the @@ -273,7 +273,7 @@ It can, however, not make sure that it isn't incompatible. Therefore, when loading a driver that doesn't use the extended driver interface, there is a risk that it will be loaded also when - the driver is incompatible. When the driver use the extended driver + the driver is incompatible. When the driver uses the extended driver interface, the emulator can verify that it isn't of an incompatible driver version. You are therefore advised to use the extended driver interface.

@@ -309,7 +309,7 @@ typedef struct ErlDrvSysInfo { driver_system_info() will write the system information when passed a reference to a ErlDrvSysInfo structure. A description of the - fields in the structure follow: + fields in the structure follows:

driver_major_version @@ -347,14 +347,6 @@ typedef struct ErlDrvSysInfo { A value != 0 if the runtime system has SMP support; otherwise, 0. - thread_support - A value != 0 if the runtime system has thread support; - otherwise, 0. - - smp_support - A value != 0 if the runtime system has SMP support; - otherwise, 0. - async_threads The number of async threads in the async thread pool used by driver_async() @@ -401,8 +393,8 @@ typedef struct ErlDrvBinary { driver_binary_dec_refc().

Some driver calls, such as driver_enq_binary, - increments the driver reference count, and others, such as - driver_deq decrements it.

+ increment the driver reference count, and others, such as + driver_deq decrement it.

Using a driver binary instead of a normal buffer, is often faster, since the emulator doesn't need to copy the data, only the pointer is used.

@@ -415,7 +407,7 @@ typedef struct ErlDrvBinary { driver_outputv calls, and in the queue. Also the driver call-back outputv uses driver binaries.

-

If the driver of some reason or another, wants to keep a +

If the driver for some reason or another, wants to keep a driver binary around, in a static variable for instance, the reference count should be incremented, and the binary can later be freed in the stop call-back, with @@ -423,7 +415,7 @@ typedef struct ErlDrvBinary {

Note that since a driver binary is shared by the driver and the emulator, a binary received from the emulator or sent to the emulator, must not be changed by the driver.

-

From erts version 5.5 (OTP release R11B), orig_bytes is +

Since erts version 5.5 (OTP release R11B), orig_bytes is guaranteed to be properly aligned for storage of an array of doubles (usually 8-byte aligned).

@@ -447,7 +439,7 @@ typedef struct ErlIOVec { int vsize; int size; SysIOVec* iov; - >ErlDrvBinary** binv; + ErlDrvBinary** binv; } ErlIOVec;

The I/O vector used by the emulator and drivers, is a list @@ -495,17 +487,17 @@ typedef struct ErlIOVec { Currently, the only port specific data that the emulator associates with the port data lock is the driver queue.

Normally a driver instance does not have a port data lock. If - the driver instance want to use a port data lock, it has to + the driver instance wants to use a port data lock, it has to create the port data lock by calling driver_pdl_create(). NOTE: Once the port data lock has been created, every - access to data associated with the port data lock have to be done + access to data associated with the port data lock has to be done while having the port data lock locked. The port data lock is locked, and unlocked, respectively, by use of driver_pdl_lock(), and driver_pdl_unlock().

A port data lock is reference counted, and when the reference - count reach zero, it will be destroyed. The emulator will at + count reaches zero, it will be destroyed. The emulator will at least increment the reference count once when the lock is created and decrement it once when the port associated with the lock terminates. The emulator will also increment the @@ -545,7 +537,7 @@ typedef struct ErlIOVec {

suggested_stack_size - A suggestion, in kilo-words, on how large stack to use. A value less + A suggestion, in kilo-words, on how large a stack to use. A value less than zero means default size. @@ -648,7 +640,7 @@ typedef struct ErlIOVec { opened.

The data is queued in the port owner process' message queue. Note that this does not yield to the emulator. (Since - the driver and the emulator runs in the same thread.)

+ the driver and the emulator run in the same thread.)

The parameter buf points to the data to send, and len is the number of bytes.

The return value for all output functions is 0. (Unless the @@ -749,7 +741,7 @@ typedef struct ErlIOVec { function timeout is called.

Note that there is only one timer on each driver instance; setting a new timer will replace an older one.

-

Return value i 0 (-1 only when the timeout driver +

Return value is 0 (-1 only when the timeout driver function is NULL).

@@ -799,20 +791,20 @@ typedef struct ErlIOVec { event object must be a socket or pipe (or other object that select/poll can use). On windows, the Win32 API function WaitForMultipleObjects - is used. This places other restriction on the event object. + is used. This places other restrictions on the event object. Refer to the Win32 SDK documentation.

The on parameter should be 1 for setting events and 0 for clearing them.

-

The mode argument is bitwise-or combination of +

The mode argument is a bitwise-or combination of ERL_DRV_READ, ERL_DRV_WRITE and ERL_DRV_USE. - The first two specifies whether to wait for read events and/or write + The first two specify whether to wait for read events and/or write events. A fired read event will call ready_input while a fired write event will call ready_output.

-

Some OS (Windows) does not differ between read and write events. +

Some OS (Windows) do not differentiate between read and write events. The call-back for a fired event then only depends on the value of mode.

ERL_DRV_USE specifies if we are using the event object or if we want to close it. @@ -834,9 +826,9 @@ typedef struct ErlIOVec { as before. But it is recommended to update them to use ERL_DRV_USE and stop_select to make sure that event objects are closed in a safe way.

-

The return value is 0 (Failure, -1, only if the +

The return value is 0 (failure, -1, only if the ready_input/ready_output is - NULL.

+ NULL).

@@ -1076,7 +1068,7 @@ typedef struct ErlIOVec { array of SysIOVecs. It also returns the number of elements in vlen. This is the only way to get data out of the queue.

-

Nothing is remove from the queue by this function, that must be done +

Nothing is removed from the queue by this function, that must be done with driver_deq.

The returned array is suitable to use with the Unix system call writev.

@@ -1209,7 +1201,7 @@ typedef struct ErlIOVec { Stop monitoring a process from a driver -

This function cancels an monitor created earlier.

+

This function cancels a monitor created earlier.

The function returns 0 if a monitor was removed and > 0 if the monitor did no longer exist.

@@ -1326,7 +1318,7 @@ typedef struct ErlIOVec {

This function signals to erlang that the driver has encountered an EOF and should be closed, unless the port was opened with the eof option, in that case eof is sent - to the port. Otherwise, the port is close and an + to the port. Otherwise, the port is closed and an 'EXIT' message is sent to the port owner process.

The return value is 0.

@@ -1349,8 +1341,8 @@ typedef struct ErlIOVec { (driver_failure).

The driver should fail only when in severe error situations, when the driver cannot possibly keep open, for instance - buffer allocation gets out of memory. Normal errors is more - appropriate to handle with sending error codes with + buffer allocation gets out of memory. For normal errors + it is more appropriate to send error codes with driver_output.

The return value is 0.

@@ -1371,7 +1363,7 @@ typedef struct ErlIOVec {

This function returns the process id of the process that made the current call to the driver. The process id can be used with driver_send_term to send back data to the - caller. driver_caller() only return valid data + caller. driver_caller() only returns valid data when currently executing in one of the following driver callbacks:

@@ -1409,7 +1401,7 @@ typedef struct ErlIOVec { tuple, the elements are given first, and then the tuple term, with a count. Likewise for lists.

A tuple must be specified with the number of elements. (The - elements precedes the ERL_DRV_TUPLE term.)

+ elements precede the ERL_DRV_TUPLE term.)

A list must be specified with the number of elements, including the tail, which is the last term preceding ERL_DRV_LIST.

@@ -1518,7 +1510,7 @@ ERL_DRV_EXT2TERM char *buf, ErlDrvUInt len }; driver_output_term(port, spec, sizeof(spec) / sizeof(spec[0])); ]]>
-

If you want to pass a binary and doesn't already have the content +

If you want to pass a binary and don't already have the content of the binary in an ErlDrvBinary, you can benefit from using ERL_DRV_BUF2BINARY instead of creating an ErlDrvBinary via driver_alloc_binary() and then pass the binary via @@ -1565,7 +1557,7 @@ ERL_DRV_EXT2TERM char *buf, ErlDrvUInt len other processes than the port owner process. The receiver parameter specifies the process to receive the data.

-

The parameters term and n does the same thing +

The parameters term and n do the same thing as in driver_output_term.

This function is only thread-safe when the emulator with SMP support is used.

@@ -1660,7 +1652,7 @@ ERL_DRV_EXT2TERM char *buf, ErlDrvUInt len

This function locks the driver used by the port port - in memory for the rest of the emulator process + in memory for the rest of the emulator process' lifetime. After this call, the driver behaves as one of Erlang's statically linked in drivers.

@@ -1904,7 +1896,7 @@ ERL_DRV_EXT2TERM char *buf, ErlDrvUInt len corresponding to one of the involved thread identifiers has terminated since the thread identifier was saved, the result of erl_drv_equal_tids() might not give - expected result. + the expected result.

This function is thread-safe.

diff --git a/erts/example/next_perm.cc b/erts/example/next_perm.cc index ee81cb0404..1427cd3979 100644 --- a/erts/example/next_perm.cc +++ b/erts/example/next_perm.cc @@ -120,7 +120,7 @@ static void ready_async(ErlDrvData drv_data, ErlDrvThreadData async_data) ErlDrvPort port = reinterpret_cast(drv_data); our_async_data* d = reinterpret_cast(async_data); int n = d->data.size(), result_n = n*2 + 5; - ErlDrvTermData* result = new ErlDrvTermData[result_n], * rp = result; + ErlDrvTermData *result = new ErlDrvTermData[result_n], *rp = result; *rp++ = ERL_DRV_PORT; *rp++ = driver_mk_port(port); for (vector::iterator i = d->data.begin(); -- cgit v1.2.3 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(-) 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 From 75bde02752be337a8d8d3ce3a4faaf4a55084178 Mon Sep 17 00:00:00 2001 From: Tuncer Ayaz Date: Sat, 22 Jan 2011 10:30:33 +0100 Subject: Fix typo in binary:part/2 example Reported-By: Pablo Platt --- lib/stdlib/doc/src/binary.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/stdlib/doc/src/binary.xml b/lib/stdlib/doc/src/binary.xml index c5eb81a86a..c81023862e 100644 --- a/lib/stdlib/doc/src/binary.xml +++ b/lib/stdlib/doc/src/binary.xml @@ -485,7 +485,7 @@ 1> Bin = <<1,2,3,4,5,6,7,8,9,10>>. -2> binary:part(Bin,{byte_size(Bin), -5)). +2> binary:part(Bin,{byte_size(Bin), -5}). <<6,7,8,9,10>> -- cgit v1.2.3 From 0094f959b941f7f2cfc35cd6c75f07493d86cc0b Mon Sep 17 00:00:00 2001 From: Tuncer Ayaz Date: Sun, 9 Jan 2011 17:41:05 +0100 Subject: Fix typo in epmd help --- erts/epmd/src/epmd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erts/epmd/src/epmd.c b/erts/epmd/src/epmd.c index 65ff0cd6b2..e94533f0ba 100644 --- a/erts/epmd/src/epmd.c +++ b/erts/epmd/src/epmd.c @@ -433,7 +433,7 @@ static void usage(EpmdVars *g) fprintf(stderr, " List names registered with the currently " "running epmd\n"); fprintf(stderr, " -kill\n"); - fprintf(stderr, " Kill the currently runniing epmd\n"); + fprintf(stderr, " Kill the currently running epmd\n"); fprintf(stderr, " (only allowed if -names show empty database or\n"); fprintf(stderr, " -relaxed_command_check was given when epmd was started).\n"); fprintf(stderr, " -stop Name\n"); -- cgit v1.2.3 From 179de7d370b9e0398500d7d0e5ae34dd2ad6c619 Mon Sep 17 00:00:00 2001 From: Tuncer Ayaz Date: Tue, 14 Dec 2010 00:08:21 +0100 Subject: Fix two typos in erlsrv log messages --- erts/etc/win32/erlsrv/erlsrv_service.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erts/etc/win32/erlsrv/erlsrv_service.c b/erts/etc/win32/erlsrv/erlsrv_service.c index a58ee862c5..8891379643 100644 --- a/erts/etc/win32/erlsrv/erlsrv_service.c +++ b/erts/etc/win32/erlsrv/erlsrv_service.c @@ -523,7 +523,7 @@ static BOOL start_a_service(ServerInfo *srvi){ srvi->keys[WorkDir].data.bytes : NULL, &start, &(srvi->info))){ - sprintf(errbuff,"Could not start erlang service" + sprintf(errbuff,"Could not start erlang service " "with commandline \"%s\".", service_name, execbuff @@ -924,7 +924,7 @@ static VOID WINAPI service_main_loop(DWORD argc, char **argv){ } else { DWORD ecode = NO_ERROR; if(success_wait == NO_SUCCESS_WAIT){ - log_warning("Erlang machine volountarily stopped. " + log_warning("Erlang machine voluntarily stopped. " "The service is not restarted as OnFail " "is set to ignore."); } else { -- cgit v1.2.3