[ 
https://issues.apache.org/jira/browse/THRIFT-3217?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14612906#comment-14612906
 ] 

Randy Abernethy commented on THRIFT-3217:
-----------------------------------------

I could not attribute any noticeable variation in performance between BE and LE 
protocols. 

I get about the same results as you did (ratiowise) with the provided benchmark 
prog:
thrift@ubuntu:~/t2/lib/cpp/test$ ./Benchmark 
Write big endian: 6253.51 kHz
 Read big endian: 4101.72 kHz
Write little endian: 7454.67 kHz
 Read little endian: 3944.28 kHz

However the slow first loop is likely due to cold cache. When I run the LE 
first and the BE second the output looks about the same (first loop is slow). 
I sanity tested with BE and BE and got the same result (first loop slow); then 
with LE.and LE and got the same result (first loop slow) 

When I preheat the cache (adding a preheating loop just like the first loop 
followed by a TMemoryBuffer reset) I see parity across the runs in both LE 
and BE. 

thrift@ubuntu:~/t2/lib/cpp/test$ ./Benchmark 
Write big endian: 7205.23 kHz
 Read big endian: 3986.69 kHz
Write little endian: 7210.8 kHz
 Read little endian: 3943.92 kHz
thrift@ubuntu:~/t2/lib/cpp/test$ ./Benchmark 
Write big endian: 7247.9 kHz
 Read big endian: 3990.68 kHz
Write little endian: 7414.92 kHz
 Read little endian: 4002.96 kHz
thrift@ubuntu:~/t2/lib/cpp/test$ ./Benchmark 
Write big endian: 7290.75 kHz
 Read big endian: 3969.55 kHz
Write little endian: 7429.7 kHz
 Read little endian: 4007.77 kHz
thrift@ubuntu:~/t2/lib/cpp/test$ ./Benchmark 
Write big endian: 7223.86 kHz
 Read big endian: 3928.78 kHz
Write little endian: 6812.92 kHz
 Read little endian: 4008.93 kHz
thrift@ubuntu:~/t2/lib/cpp/test$ ./Benchmark 
Write big endian: 7375.34 kHz
 Read big endian: 3965.91 kHz
Write little endian: 7397.37 kHz
 Read little endian: 4003.54 kHz

My guess is that the Intel BSWAP is too fast to notice.

> Provide a little endian variant of the binary protocol in C++
> -------------------------------------------------------------
>
>                 Key: THRIFT-3217
>                 URL: https://issues.apache.org/jira/browse/THRIFT-3217
>             Project: Thrift
>          Issue Type: Improvement
>          Components: C++ - Library
>    Affects Versions: 0.9.3
>            Reporter: Ben Craig
>            Assignee: Ben Craig
>
> Most computers these days are little endian.  With Thrift's current binary 
> protocol, we end up adjusting endianness on both sides of the connection most 
> of the time.  We should provide a variant that is optimized for the common 
> case of little endian machines.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to