File: README.md

package info (click to toggle)
libhttp-headers-fast-perl 0.22-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 176 kB
  • sloc: perl: 1,036; makefile: 2
file content (113 lines) | stat: -rw-r--r-- 2,306 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# NAME

HTTP::Headers::Fast - faster implementation of HTTP::Headers

# SYNOPSIS

    use HTTP::Headers::Fast;
    # and, same as HTTP::Headers.

# DESCRIPTION

HTTP::Headers::Fast is a perl class for parsing/writing HTTP headers.

The interface is same as HTTP::Headers.

# WHY YET ANOTHER ONE?

HTTP::Headers is a very good. But I needed a faster implementation, fast  =)

# ADDITIONAL METHODS

- as\_string\_without\_sort

    as\_string method sorts the header names.But, sorting is bit slow.

    In this method, stringify the instance of HTTP::Headers::Fast without sorting.

- psgi\_flatten

    returns PSGI compatible arrayref of header.

        my $headers:ArrayRef = $header->flatten

- psgi\_flatten\_without\_sort

    same as flatten but returns arrayref without sorting.

# @ISA HACK

If you want HTTP::Headers::Fast to pretend like it's really HTTP::Headers, you can try the following hack:

    unshift @HTTP::Headers::Fast::ISA, 'HTTP::Headers';

# BENCHMARK

    HTTP::Headers 5.818, HTTP::Headers::Fast 0.01

    -- push_header
            Rate orig fast
    orig 144928/s   -- -20%
    fast 181818/s  25%   --

    -- push_header_many
            Rate orig fast
    orig 74627/s   -- -16%
    fast 89286/s  20%   --

    -- get_date
            Rate orig fast
    orig 34884/s   -- -14%
    fast 40541/s  16%   --

    -- set_date
            Rate orig fast
    orig 21505/s   -- -19%
    fast 26525/s  23%   --

    -- scan
            Rate orig fast
    orig 57471/s   --  -1%
    fast 57803/s   1%   --

    -- get_header
            Rate orig fast
    orig 120337/s   -- -24%
    fast 157729/s  31%   --

    -- set_header
            Rate orig fast
    orig  79745/s   -- -30%
    fast 113766/s  43%   --

    -- get_content_length
            Rate orig fast
    orig 182482/s   -- -77%
    fast 793651/s 335%   --

    -- as_string
            Rate orig fast
    orig 23753/s   -- -41%
    fast 40161/s  69%   --

# AUTHOR

    Tokuhiro Matsuno E<lt>tokuhirom@gmail.comE<gt>
    Daisuke Maki

And HTTP::Headers' originally written by Gisle Aas.

# THANKS TO

Markstos

Tatsuhiko Miyagawa

# SEE ALSO

[HTTP::Headers](https://metacpan.org/pod/HTTP::Headers)

# LICENSE

This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.