File: benchmark.pl

package info (click to toggle)
libhtml-escape-perl 1.11-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 312 kB
  • sloc: perl: 59; makefile: 3
file content (22 lines) | stat: -rw-r--r-- 359 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/env perl
use strict;
use warnings;
use utf8;
use 5.010000;
use autodie;

use HTML::Escape;
use HTML::Entities;
use Benchmark ':all';
my $txt = "<=> (^^)" x 10000;

cmpthese(
    -1, {
        "HTML::Escape" => sub {
            escape_html($txt);
        },
        "HTML::Entities" => sub {
            encode_entities($txt);
        },
    },
);