Result:
found more than 872 distributions - search limited to the first 2001 files matching your query ( run in 4.627 )


Crypt-RHash

 view release on metacpan or  search on metacpan

librhash/snefru.c  view on Meta::CPAN

 * of the Khufu and Khafre block ciphers.
 *
 * The original design of Snefru was shown to be insecure by Eli Biham and
 * Adi Shamir who were able to use differential cryptanalysis to find hash
 * collisions. The design was then modified by increasing the number of
 * iterations of the main pass of the algorithm from two to eight. Although
 * differential cryptanalysis can break the revised version with less
 * complexity than brute force search (a certificational weakness), the attack
 * requires 2^88.5 operations and is thus not currently feasible in practice.
 *
 * The algorithm can also be run with a variable number of "rounds" of the

 view all matches for this distribution


Crypt-RNCryptor

 view release on metacpan or  search on metacpan

lib/Crypt/RNCryptor/V3.pm  view on Meta::CPAN

    PBKDF2_OUTPUT_SIZE => 32,
};

use Class::Accessor::Lite (
    ro => [qw(
        password pbkdf2_iterations
        encryption_key hmac_key
    )],
);

sub new {
    my ($class, %opts) = @_;
    if ($opts{password} && ($opts{encryption_key} || $opts{hmac_key})) {
        confess 'Cannot set the "password" option with "encryption_key" or "hmac_key" option.';
    }
    if ($opts{pbkdf2_iterations}) {
        confess 'v3.1 is not supported still yet.';
    }
    bless {
        password => $opts{password},
        encryption_key => $opts{encryption_key},
        hmac_key => $opts{hmac_key},
        pbkdf2_iterations => DEFAULT_PBKDF2_ITERATIONS,
    }, $class;
}

sub pbkdf2 {
    my ($self, $password, $salt, $iterations) = @_;
    $iterations ||= $self->pbkdf2_iterations;
    Crypt::PBKDF2->new(
        hash_class => 'HMACSHA1',
        iterations => $iterations,
        output_len => PBKDF2_OUTPUT_SIZE,
    )->PBKDF2($salt, $password);
}

sub aes256cbc {

lib/Crypt/RNCryptor/V3.pm  view on Meta::CPAN

        -cipher => 'Crypt::OpenSSL::AES',
    );
}

sub make_options {
    my ($self, $use_password, $pbkdf2_iterations) = @_;
    confess 'TODO';
}

sub encrypt {
    my $self = shift;

lib/Crypt/RNCryptor/V3.pm  view on Meta::CPAN

    my ($self, $plaintext, %opts) = @_;
    my $iv = $opts{iv} || Crypt::CBC->random_bytes(IV_SIZE);
    my $encryption_salt = $opts{encryption_salt} || Crypt::CBC->random_bytes(ENCRYPTION_SALT_SIZE);
    my $hmac_salt = $opts{hmac_salt} || Crypt::CBC->random_bytes(HMAC_SALT_SIZE);
    my $password = $opts{password} || $self->password;
    my $pbkdf2_iterations = $opts{pbkdf2_iterations} || $self->pbkdf2_iterations;

    my $encryption_key = $self->pbkdf2($password, $encryption_salt);
    my $hmac_key = $self->pbkdf2($password, $hmac_salt);

    # Header = 3 || 1 || EncryptionSalt || HMACSalt || IV

lib/Crypt/RNCryptor/V3.pm  view on Meta::CPAN


Create a cryptor instance.

    %opts = (
        password => 'any length password',
        pbkdf2_iterations => DEFAULT_PBKDF2_ITERATIONS,
        # or
        encryption_key => '32 length key',
        hmac_key => '32 length key',
    );

 view all matches for this distribution


Crypt-Rhash

 view release on metacpan or  search on metacpan

librhash/snefru.c  view on Meta::CPAN

 * of the Khufu and Khafre block ciphers.
 *
 * The original design of Snefru was shown to be insecure by Eli Biham and
 * Adi Shamir who were able to use differential cryptanalysis to find hash
 * collisions. The design was then modified by increasing the number of
 * iterations of the main pass of the algorithm from two to eight. Although
 * differential cryptanalysis can break the revised version with less
 * complexity than brute force search (a certificational weakness), the attack
 * requires 2^88.5 operations and is thus not currently feasible in practice.
 *
 * The algorithm can also be run with a variable number of "rounds" of the

 view all matches for this distribution


Crypt-SecretBuffer

 view release on metacpan or  search on metacpan

secret_buffer_parse_match_str.c  view on Meta::CPAN

               (int)(ret_pos? ret_pos-orig : -1), (int)(ret_lim? ret_lim-orig : -1), (int)anchor_fail);
         }
#endif
         #undef SB_HANDLE_ENCODING_ERROR
         /* Code below does not set return values unless `search_pos >= real_search_pos`
          * so that the consttime busywork iterations don't change any return-value state.
          */
         /* Found the goal? (match, or negated match) */
         if (matched != negate) {
            /* The desired (multi?)match begins here, unless it already began */
            if (!ret_pos && search_pos >= real_search_pos) {

secret_buffer_parse_match_str.c  view on Meta::CPAN

               (int)(ret_pos? ret_pos-orig : -1), (int)(ret_lim? ret_lim-orig : -1), (int)anchor_fail);
         }
#endif
         #undef SB_HANDLE_ENCODING_ERROR
         /* Code below does not set return values unless `search_pos >= real_search_pos`
          * so that the consttime busywork iterations don't change any return-value state.
          */
         /* Found the goal? (match, or negated match) */
         if (matched != negate) {
            /* The desired (multi?)match begins here, unless it already began */
            if (!ret_lim && search_lim <= real_search_lim) {

 view all matches for this distribution


Crypt-Serpent

 view release on metacpan or  search on metacpan

Serpent.pm  view on Meta::CPAN

"Serpent is a 128-bit block cipher, meaning that data is encrypted and
decrypted in 128-bit chunks. The key length can vary, but for the purposes
of the AES it is defined to be either 128, 192, or 256 bits. This block size
and variable key length is standard among all AES candidates and was one of
the major design requirements specified by NIST. The Serpent algorithm uses
32 rounds, or iterations of the main algorithm."

=over 4

=cut

 view all matches for this distribution


Crypt-Sodium-XS

 view release on metacpan or  search on metacpan

lib/Crypt/Sodium/XS/MemVault.pm  view on Meta::CPAN

=head2 compare

B<!!WARNING!!>: The results of this comparison method can be used to leak
information about the protected memory. If one can make arbitrary comparisons
and has any visibility to the result, the protected data can be determined in
(nbits - trailing_zero_bits) iterations! For a 256-bit key, that means it takes
no more than 256 tries to extract the key. This method is fixed-time, but the
only safe use of the result is whether it equals 0 or not, and L</memcmp> is a
better way to determine equality.

  $mv->compare($bytes, $size);

 view all matches for this distribution


Crypt-UnixCrypt_XS

 view release on metacpan or  search on metacpan

lib/Crypt/UnixCrypt_XS.pm  view on Meta::CPAN


This is the conventional F<crypt> interface.  I<PASSWORD> and I<SALT> are both strings.  The password will be hashed, in a manner determined by the salt, and a string is returned containing the salt and hash.  The salt is at the beginning of the retu...

If the salt is an empty string, then the password is ignored and an empty string is returned.  The empty salt/hash string is thus used to not require a password.

If the salt string starts with two base 64 digits (from the set [./0-9A-Za-z]), then the password is hashed using the traditional DES-based algorithm.  The salt is used to modify the DES algorithm in one of 4096 different ways.  The first eight chara...

If the salt string starts with an underscore character and then eight base 64 digits then the password is hashed using the extended DES-based algorithm from BSDi.  The first four base 64 digits specify how many encryption rounds are to be performed. ...

=item crypt_rounds( PASSWORD, NROUNDS, SALTNUM, BLOCK )

This is the core of the DES-based F<crypt> algorithm, exposed here to allow variant hash functions to be built.  I<PASSWORD> is a string; its first eight characters are used as a DES key.  I<SALTNUM> is an integer; its low 24 bits are used to modify ...

=item fold_password( PASSWORD )

This is the pre-hashing algorithm used in the extended DES algorithm to fold a long password to the size of a DES key.  It takes a password of any length, and returns a password of eight characters which is completely equivalent in the extended DES a...

 view all matches for this distribution


Crypt-xxHash

 view release on metacpan or  search on metacpan

ext/xxHash/README.md  view on Meta::CPAN


#### Makefile variables
When compiling the Command Line Interface `xxhsum` using `make`, the following environment variables can also be set :
- `DISPATCH=1` : use `xxh_x86dispatch.c`, select at runtime between `scalar`, `sse2`, `avx2` or `avx512` instruction set. This option is only valid for `x86`/`x64` systems. It is enabled by default when target `x86`/`x64` is detected. It can be force...
- `LIBXXH_DISPATCH=1` : same idea, implemented a runtime vector extension detector, but within `libxxhash`. This parameter is disabled by default. When enabled (only valid for `x86`/`x64` systems), new symbols published in `xxh_x86dispatch.h` become ...
- `XXH_1ST_SPEED_TARGET` : select an initial speed target, expressed in MB/s, for the first speed test in benchmark mode. Benchmark will adjust the target at subsequent iterations, but the first test is made "blindly" by targeting this speed. Current...
- `NODE_JS=1` : When compiling `xxhsum` for Node.js with Emscripten, this links the `NODERAWFS` library for unrestricted filesystem access and patches `isatty` to make the command line utility correctly detect the terminal. This does make the binary ...

### Building xxHash - Using vcpkg

You can download and install xxHash using the [vcpkg](https://github.com/Microsoft/vcpkg) dependency manager:

 view all matches for this distribution


CryptX

 view release on metacpan or  search on metacpan

lib/Crypt/KeyDerivation.pm  view on Meta::CPAN

  my $derived_key = argon2_pbkdf($type, $password, $salt);

  # $type        ... [string]  one of 'argon2d', 'argon2i', 'argon2id'
  # $password    ... [binary string] input keying material (password)
  # $salt        ... [binary string] salt/nonce (recommended: at least 16 bytes)
  # $t_cost      ... [integer] optional, time cost (number of iterations), DEFAULT: 3
  # $m_factor    ... [integer] optional, memory cost in kibibytes (1 KiB = 1024 B), DEFAULT: 65536 (= 64 MiB)
  # $parallelism ... [integer] optional, degree of parallelism, DEFAULT: 1
  # $len         ... [integer] optional, derived key len in bytes, DEFAULT: 32
  # $secret      ... [binary string] optional, secret value, DEFAULT: ''
  # $ad          ... [binary string] optional, associated data, DEFAULT: ''

 view all matches for this distribution


Cv

 view release on metacpan or  search on metacpan

lib/Cv.pm  view on Meta::CPAN

	goto &cvCopyMakeBorder;
}


sub Dilate {
	# Dilate(src, dst, [element], [iterations])
	my $src = shift;
	my $dst = dst(@_) || $src->new;
	unshift(@_, $src, $dst);
	goto &cvDilate;
}


sub Erode {
	# Erode(src, dst, [element], [iterations])
	my $src = shift;
	my $dst = dst(@_) || $src->new;
	unshift(@_, $src, $dst);
	goto &cvErode;
}

lib/Cv.pm  view on Meta::CPAN

	goto &cvLaplace;
}


sub MorphologyEx {
	# MorphologyEx(src, dst, temp, element, operation, [iterations])
	my $src = shift;
	my $dst = dst(@_) || $src->new;
	if (@_) {
		my $temp = dst(@_);
		unless ($temp) {

 view all matches for this distribution


DBD-Firebird

 view release on metacpan or  search on metacpan

t/60-leaks.t  view on Meta::CPAN

BEGIN {
    binmode(STDERR, ':utf8');
    binmode(STDOUT, ':utf8');
};

my $COUNT_CONNECT = 500;    # Number of connect/disconnect iterations
my $COUNT_PREPARE = 10000;  # Number of prepare/execute/finish iterations
my $COUNT_EVENTS = 10000;
my $TOTALMEM      = 0;

use Test::More;
use DBI;

 view all matches for this distribution


DBD-InterBase

 view release on metacpan or  search on metacpan

t/60leaks.t  view on Meta::CPAN

#

BEGIN { 
    $^W = 1;

    $COUNT_CONNECT = 500;   # Number of connect/disconnect iterations
    $COUNT_PREPARE = 10000;  # Number of prepare/execute/finish iterations
    $TOTALMEM   = 0;

    #
    #   Make -w happy
    #

 view all matches for this distribution


DBD-KB

 view release on metacpan or  search on metacpan

KB.pm  view on Meta::CPAN

  print "Result: $result\n";
  my $info = $sth->fetchall_arrayref();

Without asynchronous queries, the above script would take about 8 seconds to run: five seconds waiting 
for the execute to finish, then three for the check_on_the_kids() function to return. With asynchronous 
queries, the script takes about 6 seconds to run, and gets in two iterations of check_on_the_kids in 
the process.

Here's an example showing the ability to cancel a long-running query. Imagine two slave databases in 
different geographic locations over a slow network. You need information as quickly as possible, so 
you query both at once. When you get an answer, you tell the other one to stop working on your query, 

 view all matches for this distribution


DBD-KingBase

 view release on metacpan or  search on metacpan

KingBase.pm  view on Meta::CPAN

  print "Result: $result\n";
  my $info = $sth->fetchall_arrayref();

Without asynchronous queries, the above script would take about 8 seconds to run: five seconds waiting 
for the execute to finish, then three for the check_on_the_kids() function to return. With asynchronous 
queries, the script takes about 6 seconds to run, and gets in two iterations of check_on_the_kids in 
the process.

Here's an example showing the ability to cancel a long-running query. Imagine two slave databases in 
different geographic locations over a slow network. You need information as quickly as possible, so 
you query both at once. When you get an answer, you tell the other one to stop working on your query, 

 view all matches for this distribution


DBD-MariaDB

 view release on metacpan or  search on metacpan

t/60leaks.t  view on Meta::CPAN

use lib 't', '.';
require 'lib.pl';

use constant SHOW_PROGRESS => ($ENV{SHOW_PROGRESS} ? 1 : 0);

my $COUNT_CONNECT = 4000;     # Number of connect/disconnect iterations
my $COUNT_PREPARE = 30000;    # Number of prepare/execute/finish iterations
my $COUNT_BIND    = 10000;    # Number of bind_param iterations

my $have_storable;

BEGIN {
    if (!$ENV{EXTENDED_TESTING}) {

 view all matches for this distribution


DBD-Oracle

 view release on metacpan or  search on metacpan

oci8.c  view on Meta::CPAN

		PerlIO_printf(DBILOGFP, "		in  '%s' [%lu,%lu]: len %2lu, ind %d%s, value=%s\n",
			phs->name, ul_t(iter), ul_t(index), ul_t(phs->alen), phs->indp,
			(phs->desc_h) ? " via descriptor" : "",neatsvpv(phs->sv,10));
	*/
	if (!tuples_av && (index > 0 || iter > 0))
		croak(" Arrays and multiple iterations not currently supported by DBD::Oracle (in %d/%d)", index,iter);

	return OCI_CONTINUE;
}

/*

 view all matches for this distribution


DBD-Pg

 view release on metacpan or  search on metacpan

Pg.pm  view on Meta::CPAN

  print "Result: $result\n";
  my $info = $sth->fetchall_arrayref();

Without asynchronous queries, the above script would take about 8 seconds to run: five seconds waiting
for the execute to finish, then three for the check_on_the_kids() function to return. With asynchronous
queries, the script takes about 6 seconds to run, and gets in two iterations of check_on_the_kids in
the process.

Here's an example showing the ability to cancel a long-running query. Imagine two replica databases in
different geographic locations over a slow network. You need information as quickly as possible, so
you query both at once. When you get an answer, you tell the other one to stop working on your query,

 view all matches for this distribution


DBD-PgAsync

 view release on metacpan or  search on metacpan

dbdimp.c  view on Meta::CPAN

    imp_sth->has_binary        = DBDPG_FALSE; /* Are any of the params binary? */
    imp_sth->has_default       = DBDPG_FALSE; /* Are any of the params DEFAULT? */
    imp_sth->has_current       = DBDPG_FALSE; /* Are any of the params DEFAULT? */
    imp_sth->use_inout         = DBDPG_FALSE; /* Are any of the placeholders using inout? */
    imp_sth->all_bound         = DBDPG_FALSE; /* Have all placeholders been bound? */
    imp_sth->number_iterations = 0;

    /* We inherit some preferences from the database handle */
    imp_sth->server_prepare   = imp_dbh->server_prepare;
    imp_sth->switch_prepared  = imp_dbh->switch_prepared;
    imp_sth->prepare_now      = imp_dbh->prepare_now;

dbdimp.c  view on Meta::CPAN

                    imp_sth->numphs,
                    imp_sth->has_default,
                    imp_sth->has_current);

    /* Increment our count */
    imp_sth->number_iterations++;

    /* We use PQexec if:
       1. The statement is *not* DML (e.g. is DDL, which cannot be prepared)
       2. We have a DEFAULT parameter
       3. We have a CURRENT parameter

dbdimp.c  view on Meta::CPAN

        || imp_sth->direct
        || !imp_sth->numphs
        || !imp_sth->server_prepare
        )
        pqtype = PQTYPE_EXEC;
    else if (0==imp_sth->switch_prepared || imp_sth->number_iterations < imp_sth->switch_prepared)
        pqtype = PQTYPE_PARAMS;
    else
        pqtype = PQTYPE_PREPARED;

    if (TRACE4_slow) TRC(DBILOGFP, "%sWill use %s\n", 

 view all matches for this distribution


DBD-PrimeBase

 view release on metacpan or  search on metacpan

t/60leaks.t  view on Meta::CPAN

#
#   This is a skeleton test. For writing new tests, take this file
#   and modify/extend it.
#

my $COUNT_CONNECT = 4000;   # Number of connect/disconnect iterations
my $COUNT_PREPARE = 10000;  # Number of prepare/execute/finish iterations


my $haveStorable;

eval { require Proc::ProcessTable; };

 view all matches for this distribution


DBD-RAM

 view release on metacpan or  search on metacpan

test.pl  view on Meta::CPAN

    }
}


TimeMe("Testing empty loop speed ...",
       "%d iterations in %.1f cpu+sys seconds (%d per sec)",
       sub {
       },
    100000);


 view all matches for this distribution


DBD-SQLcipher

 view release on metacpan or  search on metacpan

sqlite3.c  view on Meta::CPAN

** <dd>^The [sqlite3_int64] variable pointed to by the T parameter will be
** set to the total number of times that the X-th loop has run.</dd>
**
** [[SQLITE_SCANSTAT_NVISIT]] <dt>SQLITE_SCANSTAT_NVISIT</dt>
** <dd>^The [sqlite3_int64] variable pointed to by the T parameter will be set
** to the total number of rows examined by all iterations of the X-th loop.</dd>
**
** [[SQLITE_SCANSTAT_EST]] <dt>SQLITE_SCANSTAT_EST</dt>
** <dd>^The "double" variable pointed to by the T parameter will be set to the
** query planner's estimate for the average number of rows output from each
** iteration of the X-th loop.  If the query planner's estimates was accurate,

sqlite3.c  view on Meta::CPAN

  /* Information used while coding trigger programs. */
  Parse *pToplevel;    /* Parse structure for main program (or NULL) */
  Table *pTriggerTab;  /* Table triggers are being coded for */
  int addrCrTab;       /* Address of OP_CreateTable opcode on CREATE TABLE */
  int addrSkipPK;      /* Address of instruction to skip PRIMARY KEY index */
  u32 nQueryLoop;      /* Est number of iterations of a query (10*log2(N)) */
  u32 oldmask;         /* Mask of old.* columns referenced */
  u32 newmask;         /* Mask of new.* columns referenced */
  u8 eTriggerOp;       /* TK_UPDATE, TK_INSERT or TK_DELETE */
  u8 eOrconf;          /* Default ON CONFLICT policy for trigger steps */
  u8 disableTriggers;  /* True to disable triggers */

sqlite3.c  view on Meta::CPAN

#ifndef DEFAULT_CIPHER_FLAGS
#define DEFAULT_CIPHER_FLAGS CIPHER_FLAG_HMAC | CIPHER_FLAG_LE_PGNO
#endif


/* by default, sqlcipher will use a reduced number of iterations to generate
   the HMAC key / or transform a raw cipher key 
   */
#ifndef FAST_PBKDF2_ITER
#define FAST_PBKDF2_ITER 2
#endif

sqlite3.c  view on Meta::CPAN

  if( sqlite3StrICmp(zLeft, "rekey_cipher")==0 && zRight ){
    if(ctx) sqlcipher_codec_ctx_set_cipher(ctx, zRight, 1); // change write cipher only 
  }else
  if( sqlite3StrICmp(zLeft,"cipher_default_kdf_iter")==0 ){
    if( zRight ) {
      sqlcipher_set_default_kdf_iter(atoi(zRight)); // change default KDF iterations
    } else {
      char *kdf_iter = sqlite3_mprintf("%d", sqlcipher_get_default_kdf_iter());
      codec_vdbe_return_static_string(pParse, "cipher_default_kdf_iter", kdf_iter);
      sqlite3_free(kdf_iter);
    }

sqlite3.c  view on Meta::CPAN

        sqlite3_free(fast_kdf_iter);
      }
    }
  }else
  if( sqlite3StrICmp(zLeft, "rekey_kdf_iter")==0 && zRight ){
    if(ctx) sqlcipher_codec_ctx_set_kdf_iter(ctx, atoi(zRight), 1); // write iterations only
  }else
  if( sqlite3StrICmp(zLeft,"cipher_page_size")==0 ){
    if(ctx) {
      if( zRight ) {
        int size = atoi(zRight);

sqlite3.c  view on Meta::CPAN

      const unsigned char *z = c_ctx->pass + 2; /* adjust lead offset of x' */
      CODEC_TRACE(("cipher_ctx_key_derive: using raw key from hex\n")); 
      cipher_hex2bin(z, (c_ctx->key_sz * 2), c_ctx->key);
      cipher_hex2bin(z + (c_ctx->key_sz * 2), (ctx->kdf_salt_sz * 2), ctx->kdf_salt);
    } else { 
      CODEC_TRACE(("cipher_ctx_key_derive: deriving key using full PBKDF2 with %d iterations\n", c_ctx->kdf_iter)); 
      c_ctx->provider->kdf(c_ctx->provider_ctx, c_ctx->pass, c_ctx->pass_sz, 
                    ctx->kdf_salt, ctx->kdf_salt_sz, c_ctx->kdf_iter,
                    c_ctx->key_sz, c_ctx->key);
    }

sqlite3.c  view on Meta::CPAN

      memcpy(ctx->hmac_kdf_salt, ctx->kdf_salt, ctx->kdf_salt_sz);
      for(i = 0; i < ctx->kdf_salt_sz; i++) {
        ctx->hmac_kdf_salt[i] ^= hmac_salt_mask;
      } 

      CODEC_TRACE(("cipher_ctx_key_derive: deriving hmac key from encryption key using PBKDF2 with %d iterations\n", 
        c_ctx->fast_kdf_iter)); 

      
      c_ctx->provider->kdf(c_ctx->provider_ctx, c_ctx->key, c_ctx->key_sz, 
                    ctx->hmac_kdf_salt, ctx->kdf_salt_sz, c_ctx->fast_kdf_iter,

sqlite3.c  view on Meta::CPAN

  u8 sentWarning = 0;         /* True if a warnning has been issued */
  Expr *pPartial = 0;         /* Partial Index Expression */
  int iContinue = 0;          /* Jump here to skip excluded rows */

  /* Generate code to skip over the creation and initialization of the
  ** transient index on 2nd and subsequent iterations of the loop. */
  v = pParse->pVdbe;
  assert( v!=0 );
  addrInit = sqlite3CodeOnce(pParse); VdbeCoverage(v);

  /* Count the number of columns that will be added to the index

sqlite3.c  view on Meta::CPAN

*/
static int whereLoopAddBtreeIndex(
  WhereLoopBuilder *pBuilder,     /* The WhereLoop factory */
  struct SrcList_item *pSrc,      /* FROM clause term being analyzed */
  Index *pProbe,                  /* An index on pSrc */
  LogEst nInMul                   /* log(Number of iterations due to IN) */
){
  WhereInfo *pWInfo = pBuilder->pWInfo;  /* WHERE analyse context */
  Parse *pParse = pWInfo->pParse;        /* Parsing context */
  sqlite3 *db = pParse->db;       /* Database connection malloc context */
  WhereLoop *pNew;                /* Template WhereLoop under construction */

sqlite3.c  view on Meta::CPAN

  assert( aSortCost==0 || &pSpace[nSpace]==(char*)&aSortCost[nOrderBy] );
  assert( aSortCost!=0 || &pSpace[nSpace]==(char*)pX );

  /* Seed the search with a single WherePath containing zero WhereLoops.
  **
  ** TUNING: Do not let the number of iterations go above 25.  If the cost
  ** of computing an automatic index is not paid back within the first 25
  ** rows, then do not use the automatic index. */
  aFrom[0].nRow = MIN(pParse->nQueryLoop, 46);  assert( 46==sqlite3LogEst(25) );
  nFrom = 1;
  assert( aFrom[0].isOrdered==0 );

 view all matches for this distribution


DBD-SQLeet

 view release on metacpan or  search on metacpan

sqlite3.c  view on Meta::CPAN

** <dd>^The [sqlite3_int64] variable pointed to by the T parameter will be
** set to the total number of times that the X-th loop has run.</dd>
**
** [[SQLITE_SCANSTAT_NVISIT]] <dt>SQLITE_SCANSTAT_NVISIT</dt>
** <dd>^The [sqlite3_int64] variable pointed to by the T parameter will be set
** to the total number of rows examined by all iterations of the X-th loop.</dd>
**
** [[SQLITE_SCANSTAT_EST]] <dt>SQLITE_SCANSTAT_EST</dt>
** <dd>^The "double" variable pointed to by the T parameter will be set to the
** query planner's estimate for the average number of rows output from each
** iteration of the X-th loop.  If the query planner's estimates was accurate,

sqlite3.c  view on Meta::CPAN

#endif
  AutoincInfo *pAinc;  /* Information about AUTOINCREMENT counters */
  Parse *pToplevel;    /* Parse structure for main program (or NULL) */
  Table *pTriggerTab;  /* Table triggers are being coded for */
  int addrCrTab;       /* Address of OP_CreateBtree opcode on CREATE TABLE */
  u32 nQueryLoop;      /* Est number of iterations of a query (10*log2(N)) */
  u32 oldmask;         /* Mask of old.* columns referenced */
  u32 newmask;         /* Mask of new.* columns referenced */
  u8 eTriggerOp;       /* TK_UPDATE, TK_INSERT or TK_DELETE */
  u8 eOrconf;          /* Default ON CONFLICT policy for trigger steps */
  u8 disableTriggers;  /* True to disable triggers */

sqlite3.c  view on Meta::CPAN

** If the cursor P1 was opened using the OPFLAG_SEEKEQ flag, then this
** opcode will always land on a record that equally equals the key, or
** else jump immediately to P2.  When the cursor is OPFLAG_SEEKEQ, this
** opcode must be followed by an IdxLE opcode with the same arguments.
** The IdxLE opcode will be skipped if this opcode succeeds, but the
** IdxLE opcode will be used on subsequent loop iterations.
**
** This opcode leaves the cursor configured to move in forward order,
** from the beginning toward the end.  In other words, the cursor is
** configured to use Next, not Prev.
**

sqlite3.c  view on Meta::CPAN

** If the cursor P1 was opened using the OPFLAG_SEEKEQ flag, then this
** opcode will always land on a record that equally equals the key, or
** else jump immediately to P2.  When the cursor is OPFLAG_SEEKEQ, this
** opcode must be followed by an IdxGE opcode with the same arguments.
** The IdxGE opcode will be skipped if this opcode succeeds, but the
** IdxGE opcode will be used on subsequent loop iterations.
**
** See also: Found, NotFound, SeekGt, SeekGe, SeekLt
*/
case OP_SeekLT:         /* jump, in3, group */
case OP_SeekLE:         /* jump, in3, group */

sqlite3.c  view on Meta::CPAN

  x = pIn1->u.i;
  if( x<=0 || sqlite3AddInt64(&x, pIn3->u.i>0?pIn3->u.i:0) ){
    /* If the LIMIT is less than or equal to zero, loop forever.  This
    ** is documented.  But also, if the LIMIT+OFFSET exceeds 2^63 then
    ** also loop forever.  This is undocumented.  In fact, one could argue
    ** that the loop should terminate.  But assuming 1 billion iterations
    ** per second (far exceeding the capabilities of any current hardware)
    ** it would take nearly 300 years to actually reach the limit.  So
    ** looping forever is a reasonable approximation. */
    pOut->u.i = -1;
  }else{

sqlite3.c  view on Meta::CPAN

  ** iLoop==1: Code only expressions that are entirely covered by pIdx.
  ** iLoop==2: Code remaining expressions that do not contain correlated
  **           sub-queries.  
  ** iLoop==3: Code all remaining expressions.
  **
  ** An effort is made to skip unnecessary iterations of the loop.
  */
  iLoop = (pIdx ? 1 : 2);
  do{
    int iNext = 0;                /* Next value for iLoop */
    for(pTerm=pWC->a, j=pWC->nTerm; j>0; j--, pTerm++){

sqlite3.c  view on Meta::CPAN

  struct SrcList_item *pTabItem;  /* FROM clause term being indexed */
  int addrCounter = 0;        /* Address where integer counter is initialized */
  int regBase;                /* Array of registers where record is assembled */

  /* Generate code to skip over the creation and initialization of the
  ** transient index on 2nd and subsequent iterations of the loop. */
  v = pParse->pVdbe;
  assert( v!=0 );
  addrInit = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v);

  /* Count the number of columns that will be added to the index

sqlite3.c  view on Meta::CPAN

*/
static int whereLoopAddBtreeIndex(
  WhereLoopBuilder *pBuilder,     /* The WhereLoop factory */
  struct SrcList_item *pSrc,      /* FROM clause term being analyzed */
  Index *pProbe,                  /* An index on pSrc */
  LogEst nInMul                   /* log(Number of iterations due to IN) */
){
  WhereInfo *pWInfo = pBuilder->pWInfo;  /* WHERE analyse context */
  Parse *pParse = pWInfo->pParse;        /* Parsing context */
  sqlite3 *db = pParse->db;       /* Database connection malloc context */
  WhereLoop *pNew;                /* Template WhereLoop under construction */

sqlite3.c  view on Meta::CPAN

  assert( aSortCost==0 || &pSpace[nSpace]==(char*)&aSortCost[nOrderBy] );
  assert( aSortCost!=0 || &pSpace[nSpace]==(char*)pX );

  /* Seed the search with a single WherePath containing zero WhereLoops.
  **
  ** TUNING: Do not let the number of iterations go above 28.  If the cost
  ** of computing an automatic index is not paid back within the first 28
  ** rows, then do not use the automatic index. */
  aFrom[0].nRow = MIN(pParse->nQueryLoop, 48);  assert( 48==sqlite3LogEst(28) );
  nFrom = 1;
  assert( aFrom[0].isOrdered==0 );

 view all matches for this distribution


DBD-SQLite

 view release on metacpan or  search on metacpan

sqlite3.c  view on Meta::CPAN

** <dd>^The [sqlite3_int64] variable pointed to by the V parameter will be
** set to the total number of times that the X-th loop has run.</dd>
**
** [[SQLITE_SCANSTAT_NVISIT]] <dt>SQLITE_SCANSTAT_NVISIT</dt>
** <dd>^The [sqlite3_int64] variable pointed to by the V parameter will be set
** to the total number of rows examined by all iterations of the X-th loop.</dd>
**
** [[SQLITE_SCANSTAT_EST]] <dt>SQLITE_SCANSTAT_EST</dt>
** <dd>^The "double" variable pointed to by the V parameter will be set to the
** query planner's estimate for the average number of rows output from each
** iteration of the X-th loop.  If the query planner's estimate was accurate,

sqlite3.c  view on Meta::CPAN

struct Parse {
  sqlite3 *db;         /* The main database structure */
  char *zErrMsg;       /* An error message */
  Vdbe *pVdbe;         /* An engine for executing database bytecode */
  int rc;              /* Return code from execution */
  LogEst nQueryLoop;   /* Est number of iterations of a query (10*log2(N)) */
  u8 nested;           /* Number of nested calls to the parser/code generator */
  u8 nTempReg;         /* Number of temporary registers in aTempReg[] */
  u8 isMultiWrite;     /* True if statement may modify/insert multiple rows */
  u8 mayAbort;         /* True if statement may throw an ABORT exception */
  u8 hasCompound;      /* Need to invoke convertCompoundSelectToSubquery() */

sqlite3.c  view on Meta::CPAN

** If the cursor P1 was opened using the OPFLAG_SEEKEQ flag, then this
** opcode will either land on a record that exactly matches the key, or
** else it will cause a jump to P2.  When the cursor is OPFLAG_SEEKEQ,
** this opcode must be followed by an IdxLE opcode with the same arguments.
** The IdxGT opcode will be skipped if this opcode succeeds, but the
** IdxGT opcode will be used on subsequent loop iterations.  The
** OPFLAG_SEEKEQ flags is a hint to the btree layer to say that this
** is an equality search.
**
** This opcode leaves the cursor configured to move in forward order,
** from the beginning toward the end.  In other words, the cursor is

sqlite3.c  view on Meta::CPAN

** If the cursor P1 was opened using the OPFLAG_SEEKEQ flag, then this
** opcode will either land on a record that exactly matches the key, or
** else it will cause a jump to P2.  When the cursor is OPFLAG_SEEKEQ,
** this opcode must be followed by an IdxLE opcode with the same arguments.
** The IdxGE opcode will be skipped if this opcode succeeds, but the
** IdxGE opcode will be used on subsequent loop iterations.  The
** OPFLAG_SEEKEQ flags is a hint to the btree layer to say that this
** is an equality search.
**
** See also: Found, NotFound, SeekGt, SeekGe, SeekLt
*/

sqlite3.c  view on Meta::CPAN

  x = pIn1->u.i;
  if( x<=0 || sqlite3AddInt64(&x, pIn3->u.i>0?pIn3->u.i:0) ){
    /* If the LIMIT is less than or equal to zero, loop forever.  This
    ** is documented.  But also, if the LIMIT+OFFSET exceeds 2^63 then
    ** also loop forever.  This is undocumented.  In fact, one could argue
    ** that the loop should terminate.  But assuming 1 billion iterations
    ** per second (far exceeding the capabilities of any current hardware)
    ** it would take nearly 300 years to actually reach the limit.  So
    ** looping forever is a reasonable approximation. */
    pOut->u.i = -1;
  }else{

sqlite3.c  view on Meta::CPAN

  ** iLoop==1: Code only expressions that are entirely covered by pIdx.
  ** iLoop==2: Code remaining expressions that do not contain correlated
  **           sub-queries.
  ** iLoop==3: Code all remaining expressions.
  **
  ** An effort is made to skip unnecessary iterations of the loop.
  **
  ** This optimization of causing simple query restrictions to occur before
  ** more complex one is call the "push-down" optimization in MySQL.  Here
  ** in SQLite, the name is "MySQL push-down", since there is also another
  ** totally unrelated optimization called "WHERE-clause push-down".

sqlite3.c  view on Meta::CPAN

#ifdef SQLITE_ENABLE_STMT_SCANSTATUS
  int addrExp = 0;            /* Address of OP_Explain */
#endif

  /* Generate code to skip over the creation and initialization of the
  ** transient index on 2nd and subsequent iterations of the loop. */
  v = pParse->pVdbe;
  assert( v!=0 );
  addrInit = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v);

  /* Count the number of columns that will be added to the index

sqlite3.c  view on Meta::CPAN

*/
static int whereLoopAddBtreeIndex(
  WhereLoopBuilder *pBuilder,     /* The WhereLoop factory */
  SrcItem *pSrc,                  /* FROM clause term being analyzed */
  Index *pProbe,                  /* An index on pSrc */
  LogEst nInMul                   /* log(Number of iterations due to IN) */
){
  WhereInfo *pWInfo = pBuilder->pWInfo;  /* WHERE analyze context */
  Parse *pParse = pWInfo->pParse;        /* Parsing context */
  sqlite3 *db = pParse->db;       /* Database connection malloc context */
  WhereLoop *pNew;                /* Template WhereLoop under construction */

sqlite3.c  view on Meta::CPAN

  assert( aSortCost==0 || &pSpace[nSpace]==(char*)&aSortCost[nOrderBy] );
  assert( aSortCost!=0 || &pSpace[nSpace]==(char*)pX );

  /* Seed the search with a single WherePath containing zero WhereLoops.
  **
  ** TUNING: Do not let the number of iterations go above 28.  If the cost
  ** of computing an automatic index is not paid back within the first 28
  ** rows, then do not use the automatic index. */
  aFrom[0].nRow = MIN(pParse->nQueryLoop, 48);  assert( 48==sqlite3LogEst(28) );
  nFrom = 1;
  assert( aFrom[0].isOrdered==0 );

 view all matches for this distribution


DBD-SQLite2

 view release on metacpan or  search on metacpan

btree_rb.c  view on Meta::CPAN

  /* In the first iteration of this loop, pX points to the red node just
   * inserted in the tree. If the parent of pX exists (pX is not the root
   * node) and is red, then the properties of the red-black tree are
   * violated.
   *
   * At the start of any subsequent iterations, pX points to a red node
   * with a red parent. In all other respects the tree is a legal red-black
   * binary tree. */
  while( pX != pTree->pHead && !pX->pParent->isBlack ){
    BtRbNode *pUncle;
    BtRbNode *pGrandparent;

 view all matches for this distribution


DBD-mysql

 view release on metacpan or  search on metacpan

t/60leaks.t  view on Meta::CPAN

use Test::More;
use vars qw($test_dsn $test_user $test_password);
use lib 't', '.';
require 'lib.pl';

my $COUNT_CONNECT = 4000;     # Number of connect/disconnect iterations
my $COUNT_PREPARE = 30000;    # Number of prepare/execute/finish iterations
my $COUNT_BIND    = 10000;    # Number of bind_param iterations
my $have_storable;

if (!$ENV{EXTENDED_TESTING}) {
        plan skip_all => "Skip \$ENV{EXTENDED_TESTING} is not set\n";
}

 view all matches for this distribution


DBIO-MySQL-EV

 view release on metacpan or  search on metacpan

t/13-async-e2e.t  view on Meta::CPAN

$conninfo{password} = $ENV{DBIO_TEST_MYSQL_PASS} if $ENV{DBIO_TEST_MYSQL_PASS};

diag "Server: $conninfo{host} db=$conninfo{database} user=$conninfo{user}";

# Pump EV::run(RUN_ONCE) until $cond is true OR a hard timeout fires. Returns
# the number of iterations pumped; a return >= $timeout means the condition
# never held (caller decides whether to fail / skip). Default 5000 — the
# SLEEP-injected queries in Block 1 + 2 round-trip in ~50ms, so 5000
# iterations gives 100x headroom for any EV pipeline stall.
sub pump_until {
  my ($cond, $timeout) = @_;
  $timeout //= 5000;
  my $i = 0;
  while ($i++ < $timeout) {

t/13-async-e2e.t  view on Meta::CPAN


# Drive EV::run until ALL warm-up conns complete their connect handshake.
my $pumped = pump_until(sub {
  scalar(grep { $_->server_version && $_->server_version > 0 } @warm_conns) == $POOL_SIZE
});
diag "Pumped $pumped iterations to complete $POOL_SIZE connect handshakes";

unless (scalar(grep { $_->server_version && $_->server_version > 0 } @warm_conns) == $POOL_SIZE) {
  $storage->disconnect;
  plan skip_all => "EV::MariaDB connect never completed after $pumped pump iterations";
}

diag "Server version: " . $warm_conns[0]->server_version;

# Put the warm connections back so the facade can reuse them.

 view all matches for this distribution


DBIO-PostgreSQL-EV

 view release on metacpan or  search on metacpan

t/17-concurrency-live.t  view on Meta::CPAN

#  are identical it holds trivially. It is the POSITIVE FIFO signature only
#  once (B1) has established that there really are 4 distinct pids.)

my @rot_pids;
my $slots = $storage->pool->max_size;      # 4
for my $iter (1 .. 2 * $slots) {           # 2 full rounds = 8 iterations
  # WHERE id=1 pins the result to exactly one row; the sole selected item is
  # the backend pid (index 0). Awaiting here (not batching) is the whole
  # point — it forces the pool fully idle before the next acquire, so acquire
  # ORDER, not fan-out, is what is under test.
  my $f = $storage->select_async($table, [ \'pg_backend_pid()' ], { id => 1 });

t/17-concurrency-live.t  view on Meta::CPAN

my %rot_seen;
$rot_seen{$_}++ for @rot_pids;
is scalar(keys %rot_seen), $slots,
  "sequential churn visited all $slots distinct backends (FIFO rotation; LIFO would stick to 1)";

# (B2) No two CONSECUTIVE iterations reused the same backend: shift always
# hands out a different conn than the one release just pushed to the back.
# Under LIFO every consecutive pair is identical.
my $consecutive_repeats = 0;
for my $i (1 .. $#rot_pids) {
  $consecutive_repeats++ if $rot_pids[$i] == $rot_pids[$i - 1];

 view all matches for this distribution


DBIO

 view release on metacpan or  search on metacpan

examples/Benchmarks/benchmark_hashrefinflator.pl  view on Meta::CPAN

  Class::Unload->unload('DBIO::ResultClass::HashRefInflator');
  eval $bch->{code} or die $@;
  $INC{'DBIO/ResultClass/HashRefInflator.pm'} = $bch->{title};

  for my $t (qw/simple complex/) {
    my $label = "Timing $num_iters{$t} $t iterations of $bch->{desc}";

    my $bench = Dumbbench->new(
      initial_runs => 30,
      target_rel_precision => 0.0005,
    );

 view all matches for this distribution


DBIx-BatchChunker

 view release on metacpan or  search on metacpan

lib/DBIx/BatchChunker/LoopState.pm  view on Meta::CPAN


sub _mark_chunk_timer { shift->chunk_timer(time); }

#pod =head2 start
#pod
#pod The real start ID that the loop is currently on.  May continue to exist within iterations
#pod if chunk resizing is trying to find a valid range.  Otherwise, this value will become
#pod undef when a chunk is finally processed.
#pod
#pod =cut

lib/DBIx/BatchChunker/LoopState.pm  view on Meta::CPAN


=for Pod::Coverage timer

=head2 start

The real start ID that the loop is currently on.  May continue to exist within iterations
if chunk resizing is trying to find a valid range.  Otherwise, this value will become
undef when a chunk is finally processed.

=head2 end

 view all matches for this distribution


DBIx-Class

 view release on metacpan or  search on metacpan

examples/Benchmarks/benchmark_hashrefinflator.pl  view on Meta::CPAN

  Class::Unload->unload('DBIx::Class::ResultClass::HashRefInflator');
  eval $bch->{code} or die $@;
  $INC{'DBIx/Class/ResultClass/HashRefInflator.pm'} = $bch->{title};

  for my $t (qw/simple complex/) {
    my $label = "Timing $num_iters{$t} $t iterations of $bch->{desc}";

    my $bench = Dumbbench->new(
      initial_runs => 30,
      target_rel_precision => 0.0005,
    );

 view all matches for this distribution


( run in 4.627 seconds using v1.01-cache-2.11-cpan-f03e8824b8d )