Skip to content

(Overly?) Slow parsing #184

@marcelstoer

Description

@marcelstoer
  • PHP Version: 7.1.16
  • PHP date.timezone: UTC
  • ICS Parser Version: 2.1.5
  • Windows/Mac/Linux

Description of the Issue:

Parsing the attached exchange.ics.txt takes some 3s. For my use case this is way too slow but I have no idea if this is considered "normal" with this library. Before I download & configure Xdebug (PHP is not my home turf) to see where those milliseconds are lost I would like to know how you assess this case.

File size: 160KB
Number of events: 242
When expanded with span 1: 512

Steps to Reproduce:

<?php
date_default_timezone_set("UTC");
require_once "./vendor/autoload.php";

use ICal\ICal;

$calendarString = "";

try {
    $ical = new ICal(array(
        "defaultSpan"                 => 1,     // Default value: 2
        "defaultWeekStart"            => "MO",  // Default value
        "disableCharacterReplacement" => false, // Default value
        "skipRecurrence"              => false, // Default value
        "useTimeZoneWithRRules"       => false, // Default value
    ));
    $millis = getMillis();
    $ical->initString($calendarString);
    echo "ical->initString() took " . (getMillis() - $millis) . "ms\n";
    $events = $ical->events();
    echo "calendar contains " . sizeof($events) . " events (recurring span: 1y)\n";
} catch (\Exception $e) {
    die($e);
}
function getMillis() {
    return round(microtime(true) * 1000);
}

I pasted the content of the file exchange.ics.txt into $calendarString.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions