syncthing/lib
Jakob Borg 9682bbfbda lib/protocol: Optimize luhn and chunk functions
These functions were very naive and slow. We haven't done much about
them because they pretty much don't matter at all for Syncthing
performance. They are however called very often in the discovery server
and these optimizations have a huge effect on the CPU load on the
public discovery servers.

The code isn't exactly obvious, but we have good test coverage on all
these functions.

benchmark                 old ns/op     new ns/op     delta
BenchmarkLuhnify-8        12458         1045          -91.61%
BenchmarkUnluhnify-8      12598         1074          -91.47%
BenchmarkChunkify-8       10792         104           -99.04%

benchmark                 old allocs     new allocs     delta
BenchmarkLuhnify-8        18             1              -94.44%
BenchmarkUnluhnify-8      18             1              -94.44%
BenchmarkChunkify-8       44             2              -95.45%

benchmark                 old bytes     new bytes     delta
BenchmarkLuhnify-8        1278          64            -94.99%
BenchmarkUnluhnify-8      1278          64            -94.99%
BenchmarkChunkify-8       42552         128           -99.70%

GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/4346
2017-09-03 10:26:12 +00:00
..
auto all: Update license url to https (ref #3976) 2017-02-09 08:04:16 +01:00
beacon all: Update license url to https (ref #3976) 2017-02-09 08:04:16 +01:00
config lib: Folder marker is now a folder 2017-09-02 05:52:38 +00:00
connections vendor: Update kcp, removes closeConn (fixes #4343) 2017-09-02 16:11:48 +02:00
db all: Convert folders to use filesystem abstraction 2017-08-19 14:36:56 +00:00
dialer all: Update license url to https (ref #3976) 2017-02-09 08:04:16 +01:00
discover all: Update license url to https (ref #3976) 2017-02-09 08:04:16 +01:00
events cmd/syncthing: Allow custom event subscriptions (fixes #1879) 2017-04-13 17:14:34 +00:00
fs lib: Folder marker is now a folder 2017-09-02 05:52:38 +00:00
ignore lib: Folder marker is now a folder 2017-09-02 05:52:38 +00:00
logger cmd/syncthing, lib/logger: Set debug flags on SetDebug for tests 2017-06-02 07:04:06 +00:00
model lib/model: Make puller retrying and logging less aggressive 2017-09-02 06:05:55 +00:00
nat all: Update license url to https (ref #3976) 2017-02-09 08:04:16 +01:00
osutil all: Convert folders to use filesystem abstraction 2017-08-19 14:36:56 +00:00
pmp all: Update license url to https (ref #3976) 2017-02-09 08:04:16 +01:00
protocol lib/protocol: Optimize luhn and chunk functions 2017-09-03 10:26:12 +00:00
rand all: Update license url to https (ref #3976) 2017-02-09 08:04:16 +01:00
rc all: Update license url to https (ref #3976) 2017-02-09 08:04:16 +01:00
relay all: Update license url to https (ref #3976) 2017-02-09 08:04:16 +01:00
scanner lib: Folder marker is now a folder 2017-09-02 05:52:38 +00:00
sha256 all: Update license url to https (ref #3976) 2017-02-09 08:04:16 +01:00
signature all: Update license url to https (ref #3976) 2017-02-09 08:04:16 +01:00
stats all: Update license url to https (ref #3976) 2017-02-09 08:04:16 +01:00
sync lib/sync: Make some tests not depend on real clock 2017-04-01 11:03:11 +00:00
tlsutil lib/tlsutil: Remove undesired bufio from UnionedConnection (ref #4245) 2017-08-31 07:34:48 +00:00
upgrade lib/upgrade: 0.x to 1.0 is a minor upgrade 2017-06-25 14:17:43 +00:00
upnp lib/upnp: Fix build 2017-08-21 11:41:40 +00:00
util all: Update license url to https (ref #3976) 2017-02-09 08:04:16 +01:00
versioner all: Convert folders to use filesystem abstraction 2017-08-19 14:36:56 +00:00
weakhash all: Convert folders to use filesystem abstraction 2017-08-19 14:36:56 +00:00