diff options
author | Isaku Yamahata <yamahata@valinux.co.jp> | 2013-04-01 11:58:54 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2013-04-02 12:00:12 +0900 |
commit | e0bcd61f92dbfd1fd9b6acc7387ec531449dcbac (patch) | |
tree | ea9b0ccccd159f00065134d6d96a363ec3e24ace /doc/source/images/trace-route.png | |
parent | b471e1900fa761a0b7610a012d0e6492aacda6d0 (diff) |
lib/packet/packet_utils: optimize checksum
builtin function, sum, is much faster than for loop.
The result on my machine is as follows
> def main():
> from timeit import timeit
> data = bytearray().zfill(1500)
> print 'new=', timeit(lambda : checksum(data), number=1000)
> print 'old=', timeit(lambda : checksum_old(data), number=1000)
>
> new= 0.00800108909607
> old= 0.266770124435
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'doc/source/images/trace-route.png')
0 files changed, 0 insertions, 0 deletions