time-to-botec

Benchmark sampling in different programming languages
Log | Files | Refs | README

repl.txt (2005B)


      1 
      2 {{alias}}( size )
      3     Returns a shared array buffer having a specified number of bytes.
      4 
      5     A shared array buffer behaves similarly to a non-shared array buffer, except
      6     that a shared array buffer allows creating views of memory shared between
      7     threads.
      8 
      9     Buffer contents are initialized to 0.
     10 
     11     If an environment does not support shared array buffers, the function throws
     12     an error.
     13 
     14     Parameters
     15     ----------
     16     size: integer
     17         Number of bytes.
     18 
     19     Returns
     20     -------
     21     out: SharedArrayBuffer
     22         A shared array buffer.
     23 
     24     Examples
     25     --------
     26     // Assuming an environment supports SharedArrayBuffers...
     27     > var buf = new {{alias}}( 5 )
     28     <SharedArrayBuffer>
     29 
     30 
     31 {{alias}}.length
     32     Number of input arguments the constructor accepts.
     33 
     34     Examples
     35     --------
     36     > {{alias}}.length
     37     1
     38 
     39 
     40 {{alias}}.prototype.byteLength
     41     Read-only property which returns the length (in bytes) of the array buffer.
     42 
     43     Examples
     44     --------
     45     // Assuming an environment supports SharedArrayBuffers...
     46     > var buf = new {{alias}}( 5 );
     47     > buf.byteLength
     48     5
     49 
     50 
     51 {{alias}}.prototype.slice( [start[, end]] )
     52     Copies the bytes of a shared array buffer to a new shared array buffer.
     53 
     54     Parameters
     55     ----------
     56     start: integer (optional)
     57         Index at which to start copying buffer contents (inclusive). If
     58         negative, the index is relative to the end of the buffer.
     59 
     60     end: integer (optional)
     61         Index at which to stop copying buffer contents (exclusive). If negative,
     62         the index is relative to the end of the buffer.
     63 
     64     Returns
     65     -------
     66     out: SharedArrayBuffer
     67         A new shared array buffer whose contents have been copied from the
     68         calling shared array buffer.
     69 
     70     Examples
     71     --------
     72     // Assuming an environment supports SharedArrayBuffers...
     73     > var b1 = new {{alias}}( 10 );
     74     > var b2 = b1.slice( 2, 6 );
     75     > var bool = ( b1 === b2 )
     76     false
     77     > b2.byteLength
     78     4
     79 
     80     See Also
     81     --------
     82