[interchange/parsing-improvements] WIP test approach for speeding up UTF-8-based page parsing

David Christensen interchange-cvs at icdevgroup.org
Mon Nov 13 16:48:56 UTC 2017


commit 150e9428b78bd0cdcd3839ebf7a9fe43d7725977
Author: David Christensen <david at endpoint.com>
Date:   Mon Nov 13 09:35:50 2017 -0600

    WIP test approach for speeding up UTF-8-based page parsing

 lib/Vend/Interpolate.pm |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/lib/Vend/Interpolate.pm b/lib/Vend/Interpolate.pm
index ece47f9..a71b889 100644
--- a/lib/Vend/Interpolate.pm
+++ b/lib/Vend/Interpolate.pm
@@ -649,6 +649,9 @@ sub interpolate_html {
 
 	local($^W);
 
+	my $was_utf8 = utf8::is_utf8($html);
+	Encode::_utf8_off($html) if $was_utf8;
+
 	my $toplevel;
 	if(defined $Vend::PageInit and ! $Vend::PageInit) {
 		defined $::Variable->{MV_AUTOLOAD}
@@ -675,6 +678,7 @@ sub interpolate_html {
 		}
 		$parse->parse('');
 	}
+	Encode::_utf8_on(${$parse->{OUT}}) if $was_utf8;
 	return $parse->{OUT} if defined $wantref;
 	return ${$parse->{OUT}};
 }



More information about the interchange-cvs mailing list