Skip to content
This repository was archived by the owner on May 21, 2024. It is now read-only.

Commit 836dce2

Browse files
committed
docs: update benchmarks into README
Signed-off-by: Leonardo Di Donato <[email protected]>
1 parent 7db7436 commit 836dce2

File tree

1 file changed

+30
-29
lines changed

1 file changed

+30
-29
lines changed

README.md

Lines changed: 30 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
[![MIT License](http://img.shields.io/badge/license-MIT-blue.svg?style=for-the-badge)](LICENSE)
22

3-
**A parser for syslog messages and transports**.
3+
**A parser for Syslog messages and transports**.
44

5-
> [Blazing fast](#Performances) syslog parsers
5+
> [Blazing fast](#Performances) Syslog parsers
66
77
To wrap up, this package provides:
88

@@ -11,7 +11,7 @@ To wrap up, this package provides:
1111
- a parser which works on streams for syslog with [octet counting](https://tools.ietf.org/html/rfc5425#section-4.3) framing technique, see [octetcounting](/cotentcounting)
1212
- a parser which works on streams for syslog with [non-transparent](https://tools.ietf.org/html/rfc6587#section-3.4.2) framing technique, see [nontransparent](/nontransparent)
1313

14-
This library provides the pieces to parse syslog messages transported following various RFCs.
14+
This library provides the pieces to parse Syslog messages transported following various RFCs.
1515

1616
For example:
1717

@@ -67,7 +67,7 @@ This results in `m` being equal to:
6767
// })
6868
```
6969

70-
And `e` being equal to `nil`, since the `i` byte slice contains a perfectly valid RFC5424 message.
70+
And `e` being equal to `nil` since the `i` byte slice contains a perfectly valid RFC5424 message.
7171

7272
### Best effort mode
7373

@@ -167,9 +167,9 @@ This library provide stream parsers for both.
167167

168168
### Octet counting
169169

170-
In short, [RFC5425](https://tools.ietf.org/html/rfc5425#section-4.3) and [RFC6587](https://tools.ietf.org/html/rfc6587), aside from the protocol considerations, describe a **transparent framing** technique for syslog messages that uses the **octect counting** technique - ie., the message lenght of the incoming message.
170+
In short, [RFC5425](https://tools.ietf.org/html/rfc5425#section-4.3) and [RFC6587](https://tools.ietf.org/html/rfc6587), aside from the protocol considerations, describe a **transparent framing** technique for Syslog messages that uses the **octect counting** technique - ie., the message length of the incoming message.
171171

172-
Each syslog message is sent with a prefix representing the number of bytes it is made of.
172+
Each Syslog message is sent with a prefix representing the number of bytes it is made of.
173173

174174
The [octecounting package](./octetcounting) parses messages stream following such rule.
175175

@@ -188,7 +188,7 @@ To quickly understand how to use it please have a look at the [example file](./n
188188
Things we do not support:
189189

190190
- trailers other than `LF` or `NUL`
191-
- trailer which length is greater than 1 byte
191+
- trailers which length is greater than 1 byte
192192
- trailer change on a frame-by-frame basis
193193

194194
## Performances
@@ -202,38 +202,39 @@ make bench
202202
On my machine<sup>[1](#mymachine)</sup> this are the results obtained paring RFC5424 syslog messages with best effort mode on.
203203

204204
```
205-
[no]_empty_input__________________________________-4 30000000 253 ns/op 224 B/op 3 allocs/op
206-
[no]_multiple_syslog_messages_on_multiple_lines___-4 20000000 433 ns/op 304 B/op 12 allocs/op
207-
[no]_impossible_timestamp_________________________-4 10000000 1080 ns/op 528 B/op 11 allocs/op
208-
[no]_malformed_structured_data____________________-4 20000000 552 ns/op 400 B/op 12 allocs/op
209-
[no]_with_duplicated_structured_data_id___________-4 5000000 1246 ns/op 688 B/op 17 allocs/op
210-
[ok]_minimal______________________________________-4 30000000 264 ns/op 247 B/op 9 allocs/op
211-
[ok]_average_message______________________________-4 5000000 1984 ns/op 1536 B/op 26 allocs/op
212-
[ok]_complicated_message__________________________-4 5000000 1644 ns/op 1280 B/op 25 allocs/op
213-
[ok]_very_long_message____________________________-4 2000000 3826 ns/op 2464 B/op 28 allocs/op
214-
[ok]_all_max_length_and_complete__________________-4 3000000 2792 ns/op 1888 B/op 28 allocs/op
215-
[ok]_all_max_length_except_structured_data_and_mes-4 5000000 1830 ns/op 883 B/op 13 allocs/op
216-
[ok]_minimal_with_message_containing_newline______-4 20000000 294 ns/op 250 B/op 10 allocs/op
217-
[ok]_w/o_procid,_w/o_structured_data,_with_message-4 10000000 956 ns/op 364 B/op 11 allocs/op
218-
[ok]_minimal_with_UTF-8_message___________________-4 20000000 586 ns/op 359 B/op 10 allocs/op
219-
[ok]_with_structured_data_id,_w/o_structured_data_-4 10000000 998 ns/op 592 B/op 14 allocs/op
220-
[ok]_with_multiple_structured_data________________-4 5000000 1538 ns/op 1232 B/op 22 allocs/op
221-
[ok]_with_escaped_backslash_within_structured_data-4 5000000 1316 ns/op 920 B/op 20 allocs/op
222-
[ok]_with_UTF-8_structured_data_param_value,_with_-4 5000000 1580 ns/op 1050 B/op 21 allocs/op
205+
[no]_empty_input__________________________________ 4524100 274 ns/op 272 B/op 4 allocs/op
206+
[no]_multiple_syslog_messages_on_multiple_lines___ 3039513 361 ns/op 288 B/op 8 allocs/op
207+
[no]_impossible_timestamp_________________________ 1244562 951 ns/op 512 B/op 11 allocs/op
208+
[no]_malformed_structured_data____________________ 2389249 512 ns/op 512 B/op 9 allocs/op
209+
[no]_with_duplicated_structured_data_id___________ 1000000 1183 ns/op 712 B/op 17 allocs/op
210+
[ok]_minimal______________________________________ 6876235 178 ns/op 227 B/op 5 allocs/op
211+
[ok]_average_message______________________________ 730473 1653 ns/op 1520 B/op 24 allocs/op
212+
[ok]_complicated_message__________________________ 908776 1344 ns/op 1264 B/op 24 allocs/op
213+
[ok]_very_long_message____________________________ 392737 3114 ns/op 2448 B/op 25 allocs/op
214+
[ok]_all_max_length_and_complete__________________ 510740 2431 ns/op 1872 B/op 28 allocs/op
215+
[ok]_all_max_length_except_structured_data_and_mes 755124 1593 ns/op 867 B/op 13 allocs/op
216+
[ok]_minimal_with_message_containing_newline______ 6142984 199 ns/op 230 B/op 6 allocs/op
217+
[ok]_w/o_procid,_w/o_structured_data,_with_message 1670286 732 ns/op 348 B/op 10 allocs/op
218+
[ok]_minimal_with_UTF-8_message___________________ 3013480 407 ns/op 339 B/op 6 allocs/op
219+
[ok]_minimal_with_UTF-8_message_starting_with_BOM_ 2926410 423 ns/op 355 B/op 6 allocs/op
220+
[ok]_with_structured_data_id,_w/o_structured_data_ 1558971 814 ns/op 570 B/op 11 allocs/op
221+
[ok]_with_multiple_structured_data________________ 1000000 1243 ns/op 1205 B/op 16 allocs/op
222+
[ok]_with_escaped_backslash_within_structured_data 1000000 1025 ns/op 896 B/op 17 allocs/op
223+
[ok]_with_UTF-8_structured_data_param_value,_with_ 1000000 1241 ns/op 1034 B/op 19 allocs/op
223224
```
224225

225226
As you can see it takes:
226227

227228
* ~250ns to parse the smallest legal message
228229

229-
* ~2µs to parse an average legal message
230+
* less than 2µs to parse an average legal message
230231

231-
* ~4µs to parse a very long legal message
232+
* ~3µs to parse a very long legal message
232233

233234
Other RFC5424 implementations, like this [one](https://github.com/roguelazer/rust-syslog-rfc5424) in Rust, spend 8µs to parse an average legal message.
234235

235-
_TBD: comparation against other golang parsers_.
236+
_TBD: comparison against other Go parsers_.
236237

237238
---
238239

239-
* <a name="mymachine">[1]</a>: Intel Core i7-7600U CPU @ 2.80GHz
240+
* <a name="mymachine">[1]</a>: Intel Core i7-8850H CPU @ 2.60GHz

0 commit comments

Comments
 (0)