summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordakkar <dakkar@thenautilus.net>2019-12-27 17:38:06 +0000
committerdakkar <dakkar@thenautilus.net>2019-12-27 17:38:06 +0000
commit3cb6d151f9f7ab86c29a5f79c69cbdab8e99dbb3 (patch)
treecf567f2757f69ce982c9f76496ab7f8fcba1f992
parentLog::Timeline (diff)
downloadMaildirIndexer-3cb6d151f9f7ab86c29a5f79c69cbdab8e99dbb3.tar.gz
MaildirIndexer-3cb6d151f9f7ab86c29a5f79c69cbdab8e99dbb3.tar.bz2
MaildirIndexer-3cb6d151f9f7ab86c29a5f79c69cbdab8e99dbb3.zip
ok, the slow bit is looking for the @separators
-rw-r--r--lib/MaildirIndexer/LogTimelineSchema.pm62
-rw-r--r--lib/MaildirIndexer/Parser.pm69
2 files changed, 10 insertions, 1 deletions
diff --git a/lib/MaildirIndexer/LogTimelineSchema.pm6 b/lib/MaildirIndexer/LogTimelineSchema.pm6
index 1e1848f..3bbd1eb 100644
--- a/lib/MaildirIndexer/LogTimelineSchema.pm6
+++ b/lib/MaildirIndexer/LogTimelineSchema.pm6
@@ -10,6 +10,8 @@ class Parse::Email::Str does Log::Timeline::Task['MaildirIndexer','Parser','pars
class Parse::Email::File does Log::Timeline::Task['MaildirIndexer','Parser','parsing a file'] { };
class Parse::Email::Socket does Log::Timeline::Task['MaildirIndexer','Parser','parsing a socket'] { };
+class Parse::Email::SocketChunk does Log::Timeline::Event['MaildirIndexer','Parser','read a chunk from the socket'] { };
+
class Parse::Header does Log::Timeline::Task['MaildirIndexer','Email','parsing a header'] { };
class Index::Add does Log::Timeline::Task['MaildirIndexer','Index','add email'] { };
diff --git a/lib/MaildirIndexer/Parser.pm6 b/lib/MaildirIndexer/Parser.pm6
index 7780a62..97f0cd9 100644
--- a/lib/MaildirIndexer/Parser.pm6
+++ b/lib/MaildirIndexer/Parser.pm6
@@ -87,10 +87,17 @@ multi parse-email(IO::Socket::Async:D $s --> MaildirIndexer::Email) is export {
my $string;
react {
whenever $s.Supply(:enc<utf8-c8>) {
+ MaildirIndexer::LogTimelineSchema::Parse::Email::SocketChunk.log(:start);
$string ~= $_;
- done if $string ~~ /@separators/;
+ MaildirIndexer::LogTimelineSchema::Parse::Email::SocketChunk.log(:appended);
+ # this is horribly slow?? 1.2 seconds for 18k of text?
+ # parsing the whole email takes 0.01 seconds!
+ my $done = $string ~~ /@separators/;
+ MaildirIndexer::LogTimelineSchema::Parse::Email::SocketChunk.log(:done(so $done));
+ done if $done;
}
}
+ MaildirIndexer::LogTimelineSchema::Parse::Email::SocketChunk.log(:done);
$result = parse-email($string);
}
return $result;