Skip to content

Performance #609

@gruppenhaus

Description

@gruppenhaus

Using Webklex on the same IMAP Server, It takes 50 time longer to get the mails:

Here you can check:

https://devmail.gruppenhaus-manager.de/mailtest.php

First part uses the IMAP functions which are included in PHP 8.3

Second part uses the WEBKLEX. This only appens on the sever from "imap.strato.de"

I use the standard "imap.php" config.

Part1:

$mailbox = imap_open("{".$mailkonto["serverinhost"].":".$mailkonto["serverinport"].$sslstring."}INBOX",
$mailkonto["serverinuser"],$mailkonto["serverinpass"]);

$check = imap_check($mailbox);
$anz=$check->Nmsgs;

for($i=1;$i<=$anz;$i++) {
$index=$i;
$header = imap_headerinfo($mailbox, $index);

 	echo "ALT ".$i." ".$header->Subject."<br>";
}

$end = hrtime(true);

	$dauerInSekunden = ($end - $start) / 1e+9;

	echo "ALT Dauer: " . number_format($dauerInSekunden, 4) . " s<br>";

echo "


";

Part2:
$client = $cm->account('default');

$client = $cm->make([
'host' => 'imap.strato.de',
'port' => 993,
'encryption' => 'ssl',
'validate_cert' => false,
'username' => '...',
'password' => '...',
'protocol' => 'imap'

$client->connect();

$folder = $client->getFolder('INBOX');

$totalMessages = $folder->query()->all()->count(); // Gesamtanzahl ermitteln

try {
	$start = hrtime(true);
	
	
	#->limit($chunkSize, $i)
	$messages = $folder->query()
->all()
->setFetchOrder('desc')
->setFetchBody(false) // Lädt keine Inhalte/Anhänge
->setFetchFlags(false)  // Optional: Lädt Flags wie "gelesen/ungelesen"

->limit(5)

->get();
$end = hrtime(true);

	$dauerInSekunden = ($end - $start) / 1e+9;

	echo "Dauer: " . number_format($dauerInSekunden, 4) . " s<br>";

Normaly I expect the nearly the same time. But I differs totaly.

Part 1: Time 0.0726 s

Part 2: Time 112.7657 s

The same servers, the same mailbox

PHP 8.3
PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
NAME="Debian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions