Browse Source

Talk about benchmarks in documentation.

pull/2/head
Justine Alexandra Roberts Tunney 11 years ago
parent
commit
1cf0e74cdf
2 changed files with 11 additions and 6 deletions
  1. +2
    -2
      sip/msg_test.go
  2. +9
    -4
      sip/sip.rl

+ 2
- 2
sip/msg_test.go View File

@ -1249,14 +1249,14 @@ func TestParseMsg(t *testing.T) {
}
}
func BenchmarkParseMsgFlowroute(b *testing.B) { // 27256 ns/op
func BenchmarkParseMsgFlowroute(b *testing.B) { // 26653 ns/op
msg := []byte(flowroute)
for i := 0; i < b.N; i++ {
sip.ParseMsgBytes(msg)
}
}
func BenchmarkParseMsgTorture2(b *testing.B) { // 32296 ns/op
func BenchmarkParseMsgTorture2(b *testing.B) { // 31397 ns/op
msg := []byte(torture2)
for i := 0; i < b.N; i++ {
sip.ParseMsgBytes(msg)


+ 9
- 4
sip/sip.rl View File

@ -6,10 +6,15 @@
# the purpose of converting SIP messages into a Msg data structure. This
# machine works in tandem with the Ragel machine defined in uri_parse.rl.
#
# Perhaps it would have been better if the authors of this protocol had chosen
# to use a binary serialization format like protocol buffers. But instead they
# chose to create a plaintext protocol that looks similar to HTTP requests,
# but are phenomenally more complicated.
# The parser is deterministicly effectively O(k). It's able to parse an
# ordinary INVITE message in less than 30μs, which means 30k messages can be
# parsed per second. Best of all, messages are parsed into a very easy to use
# and transparent data structure.
#
# Perhaps it would have been better if the SIP protocol designers had chosen to
# use a binary serialization format like protocol buffers. But instead they
# chose to create a plaintext protocol that looks similar to HTTP requests, but
# are phenomenally more complicated.
#
# SIP messages are quite insane.
#


Loading…
Cancel
Save