Last change
on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
692 bytes
|
Line | |
---|
1 | #!/usr/bin/env node
|
---|
2 | var hpack = require('../');
|
---|
3 |
|
---|
4 | var options = {
|
---|
5 | table: { size: 1024 }
|
---|
6 | };
|
---|
7 |
|
---|
8 | var compressor = hpack.compressor.create(options);
|
---|
9 |
|
---|
10 | var vector = [];
|
---|
11 | for (var i = 0; i < 1024; i++) {
|
---|
12 | vector.push({
|
---|
13 | name: 'kind-of-big-header-name__',
|
---|
14 | value: 'not-so-small value yes!',
|
---|
15 | huffman: true,
|
---|
16 | neverIndex: true
|
---|
17 | });
|
---|
18 | }
|
---|
19 | compressor.write(vector);
|
---|
20 | var input = compressor.read();
|
---|
21 |
|
---|
22 | console.time('decompressor');
|
---|
23 | for (var i = 0; i < 2000; i++) {
|
---|
24 | var decompressor = hpack.decompressor.create(options);
|
---|
25 |
|
---|
26 | decompressor.write(input);
|
---|
27 | decompressor.execute();
|
---|
28 | while (true) {
|
---|
29 | var chunk = decompressor.read();
|
---|
30 | if (!chunk)
|
---|
31 | break;
|
---|
32 | }
|
---|
33 | }
|
---|
34 | console.timeEnd('decompressor');
|
---|
Note:
See
TracBrowser
for help on using the repository browser.