mirror of
git://git.psyc.eu/libpsyc
synced 2024-08-15 03:19:02 +00:00
xml-unfriendly complete
This commit is contained in:
parent
6898cc65e4
commit
c705ba2259
6 changed files with 33 additions and 35 deletions
|
@ -37,6 +37,8 @@ Same test with characters which aren't practical
|
||||||
in the XML syntax.
|
in the XML syntax.
|
||||||
|
|
||||||
#+INCLUDE: packets/xml-unfriendly.xml src xml
|
#+INCLUDE: packets/xml-unfriendly.xml src xml
|
||||||
|
#+INCLUDE: packets/xml-unfriendly.json src js
|
||||||
|
#+INCLUDE: packets/xml-unfriendly.psyc src psyc
|
||||||
|
|
||||||
** A message with PSYC-unfriendly strings
|
** A message with PSYC-unfriendly strings
|
||||||
PSYC prefixes data with length as soon as it
|
PSYC prefixes data with length as soon as it
|
||||||
|
@ -93,16 +95,8 @@ np
|
||||||
|
|
||||||
** An average chat message
|
** An average chat message
|
||||||
|
|
||||||
XMPP:
|
|
||||||
|
|
||||||
#+INCLUDE: packets/chat_msg.xml src xml
|
#+INCLUDE: packets/chat_msg.xml src xml
|
||||||
|
|
||||||
JSON:
|
|
||||||
|
|
||||||
#+INCLUDE: packets/chat_msg.json src js
|
#+INCLUDE: packets/chat_msg.json src js
|
||||||
|
|
||||||
PSYC:
|
|
||||||
|
|
||||||
#+INCLUDE: packets/chat_msg.psyc src psyc
|
#+INCLUDE: packets/chat_msg.psyc src psyc
|
||||||
|
|
||||||
Why PSYC doesn't have an id? Because packet counting from contexts
|
Why PSYC doesn't have an id? Because packet counting from contexts
|
||||||
|
@ -155,7 +149,19 @@ Pure syntax comparisons above, protocol performance comparisons below:
|
||||||
These tests were performed on a 2.53 GHz Intel(R) Core(TM)2 Duo P9500 CPU.
|
These tests were performed on a 2.53 GHz Intel(R) Core(TM)2 Duo P9500 CPU.
|
||||||
|
|
||||||
* Conclusions
|
* Conclusions
|
||||||
... TBD ...
|
|
||||||
|
The Internet has developed two major breeds of protocol formats.
|
||||||
|
The binary ones are extremely efficient but usually not very flexible
|
||||||
|
while the plain-text ones are reaching out for achieving perfection
|
||||||
|
in data representation while leaving the path of efficiency. Some
|
||||||
|
protocols such as HTTP and SIP are in-between these two schools,
|
||||||
|
offering both a text-based extensible syntax (it's actually easier to
|
||||||
|
add a header to HTTP than to come up with a namespace for XMPP...)
|
||||||
|
and the ability to deliver binary data. But these protocols do not
|
||||||
|
come with native data structure support. PSYC is a protocol that
|
||||||
|
combines the compactness and efficiency of binary protocols with the
|
||||||
|
extensibility of text-based protocols and still provides for enough
|
||||||
|
data structuring to rarely require the use of other data formats.
|
||||||
|
|
||||||
* Criticism
|
* Criticism
|
||||||
Are we comparing apples and oranges? Yes and no, depends on what you
|
Are we comparing apples and oranges? Yes and no, depends on what you
|
||||||
|
@ -192,7 +198,6 @@ After a month of development libpsyc is already performing pretty
|
||||||
well, but we presume various optimizations, like rewriting parts
|
well, but we presume various optimizations, like rewriting parts
|
||||||
in assembler, are possible.
|
in assembler, are possible.
|
||||||
|
|
||||||
|
|
||||||
* Appendix
|
* Appendix
|
||||||
** Tools used
|
** Tools used
|
||||||
|
|
||||||
|
@ -208,3 +213,5 @@ xmlbench:
|
||||||
: parse/libxml-sax 1000000 $file
|
: parse/libxml-sax 1000000 $file
|
||||||
: parse/libxml 1000000 $file
|
: parse/libxml 1000000 $file
|
||||||
: parse/rapidxml 1000000 $file
|
: parse/rapidxml 1000000 $file
|
||||||
|
|
||||||
|
See also "make bench"
|
||||||
|
|
|
@ -1,10 +1,5 @@
|
||||||
<message
|
<message from='romeo@example.net/orchard' to='juliet@example.com/balcony'>
|
||||||
from='romeo@example.net/orchard'
|
<body>"Neither, fair saint, if either thee dislike.", he said.
|
||||||
id='sl3nx51f'
|
|
||||||
to='juliet@example.com/balcony'
|
|
||||||
type='chat'
|
|
||||||
xml:lang='en'>
|
|
||||||
<body>"Neither, fair saint, if either thee dislike.", he said.
|
|
||||||
And
|
And
|
||||||
the
|
the
|
||||||
rest
|
rest
|
||||||
|
|
|
@ -1,12 +1,7 @@
|
||||||
<message
|
<message from='juliet@example.com/balcony' to='romeo@example.net'>
|
||||||
from='juliet@example.com/balcony'
|
<subject>I implore you with a pointless
|
||||||
id='c8xg3nf8'
|
|
||||||
to='romeo@example.net'
|
|
||||||
type='chat'
|
|
||||||
xml:lang='en'>
|
|
||||||
<subject>I implore you with a pointless
|
|
||||||
newline in a header variable</subject>
|
newline in a header variable</subject>
|
||||||
<body>Wherefore art thou, Romeo?
|
<body>Wherefore art thou, Romeo?
|
||||||
|
|
|
|
||||||
And for practicing purposes we added a PSYC packet delimiter.</body>
|
And for practicing purposes we added a PSYC packet delimiter.</body>
|
||||||
</message>
|
</message>
|
||||||
|
|
3
bench/packets/xml-unfriendly.json
Normal file
3
bench/packets/xml-unfriendly.json
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
|
||||||
|
["message",{"from":"juliet@example.com/balcony","to":"romeo@example.net"},
|
||||||
|
"Pro\x010De\x017D jsi ty, Romeo?"]
|
6
bench/packets/xml-unfriendly.psyc
Normal file
6
bench/packets/xml-unfriendly.psyc
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
:_source psyc://example.com/~juliet
|
||||||
|
:_target psyc://example.net/~romeo
|
||||||
|
|
||||||
|
_message
|
||||||
|
PročeŽ jsi ty, Romeo?
|
||||||
|
|
|
|
@ -1,11 +1,3 @@
|
||||||
<message
|
<message from='juliet@example.com/balcony' to='romeo@example.net'>
|
||||||
from='juliet@example.com/balcony'
|
<body>PročeŽ jsi ty, Romeo?</body>
|
||||||
id='z94nb37h'
|
|
||||||
to='romeo@example.net'
|
|
||||||
type='chat'
|
|
||||||
xml:lang='en'>
|
|
||||||
<body>Wherefore art thou, Romeo?</body>
|
|
||||||
<body xml:lang='cs'>
|
|
||||||
PročeŽ jsi ty, Romeo?
|
|
||||||
</body>
|
|
||||||
</message>
|
</message>
|
||||||
|
|
Loading…
Reference in a new issue