PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Database » DB » Bug #2404

optimization

Details

Request #2404optimization
Submitted2004-09-27 07:31 UTC
Fromstruchkov at ma-journal dot ru
Assigneddanielc
StatusWont fix
PackageDB
PHP Version4.2.2
OSLinux
Roadmaps(Not assigned)

Comments

[2004-09-27 07:31 UTC] struchkov at ma-journal dot ru

Description:
------------
I optimize DB_common::prepare.
1) Add array cash_prepare_tokens to DB_common member.
2) In the begining of this function I add this code:
if (isset($this->cash_prepare_tokens[crc32($query)])) return $this->cash_prepare_tokens[crc32($query)];
3) At the end before return I add
$this->cash_prepare_tokens[crc32($query)]=$k;
See strange example
for($i=1;$i<100000;++$i)
$db->prepare('insert into a values (?,?,?,?)');
After that print_r($db);
If a user is not experienced enough this approach will help to prevent the usage of great amounts of memory.

Expected result:
----------------
Minimization memory usage.