1. 25 Aug, 2021 2 commits
    • Felix Lange's avatar
      rlp: minor optimizations for slice/array encoding (#23467) · 32c576bd
      Felix Lange authored
      As per benchmark results below, these changes speed up encoding/decoding of
      consensus objects a bit.
      
          name                             old time/op    new time/op    delta
          EncodeRLP/legacy-header-8           384ns ± 1%     331ns ± 3%  -13.83%  (p=0.000 n=7+8)
          EncodeRLP/london-header-8           411ns ± 1%     359ns ± 2%  -12.53%  (p=0.000 n=8+8)
          EncodeRLP/receipt-for-storage-8     251ns ± 0%     239ns ± 0%   -4.97%  (p=0.000 n=8+8)
          EncodeRLP/receipt-full-8            319ns ± 0%     300ns ± 0%   -5.89%  (p=0.000 n=8+7)
          EncodeRLP/legacy-transaction-8      389ns ± 1%     387ns ± 1%     ~     (p=0.099 n=8+8)
          EncodeRLP/access-transaction-8      607ns ± 0%     581ns ± 0%   -4.26%  (p=0.000 n=8+8)
          EncodeRLP/1559-transaction-8        627ns ± 0%     606ns ± 1%   -3.44%  (p=0.000 n=8+8)
          DecodeRLP/legacy-header-8           831ns ± 1%     813ns ± 1%   -2.20%  (p=0.000 n=8+8)
          DecodeRLP/london-header-8           824ns ± 0%     804ns ± 1%   -2.44%  (p=0.000 n=8+7)
      
      * rlp: pass length to byteArrayBytes
      
      This makes it possible to inline byteArrayBytes. For arrays, the length is known
      at encoder construction time, so the call to v.Len() can be avoided.
      
      * rlp: avoid IsNil for pointer encoding
      
      It's actually cheaper to use Elem first, because it performs less checks
      on the value. If the pointer was nil, the result of Elem is 'invalid'.
      
      * rlp: minor optimizations for slice/array encoding
      
      For empty slices/arrays, we can avoid storing a list header entry in the
      encoder buffer. Also avoid doing the tail check at encoding time because
      it is already known at encoder construction time.
      32c576bd
    • Felix Lange's avatar
      all: add go:build lines (#23468) · 8a134014
      Felix Lange authored
      Generated by go1.17 fmt ./...
      8a134014
  2. 22 May, 2021 1 commit
    • Felix Lange's avatar
      rlp: optimize byte array handling (#22924) · 154ca32a
      Felix Lange authored
      This change improves the performance of encoding/decoding [N]byte.
      
          name                     old time/op    new time/op    delta
          DecodeByteArrayStruct-8     336ns ± 0%     246ns ± 0%  -26.98%  (p=0.000 n=9+10)
          EncodeByteArrayStruct-8     225ns ± 1%     148ns ± 1%  -34.12%  (p=0.000 n=10+10)
      
          name                     old alloc/op   new alloc/op   delta
          DecodeByteArrayStruct-8      120B ± 0%       48B ± 0%  -60.00%  (p=0.000 n=10+10)
          EncodeByteArrayStruct-8     0.00B          0.00B          ~     (all equal)
      154ca32a
  3. 22 Apr, 2021 1 commit
  4. 25 May, 2019 1 commit
  5. 20 Feb, 2019 1 commit
    • Ferenc Szabo's avatar
      Ci race detector handle failing tests (#19143) · e38b227c
      Ferenc Szabo authored
      * swarm/storage: increase mget timeout in common_test.go
      
       TestDbStoreCorrect_1k sometimes timed out with -race on Travis.
      
      --- FAIL: TestDbStoreCorrect_1k (24.63s)
          common_test.go:194: testStore failed: timed out after 10s
      
      * swarm: remove unused vars from TestSnapshotSyncWithServer
      
      nodeCount and chunkCount is returned from setupSim and those values
      we use.
      
      * swarm: move race/norace helpers from stream to testutil
      
      As we will need to use the flag in other packages, too.
      
      * swarm: refactor TestSwarmNetwork case
      
      Extract long running test cases for better visibility.
      
      * swarm/network: skip TestSyncingViaGlobalSync with -race
      
      As panics on Travis.
      
      panic: runtime error: invalid memory address or nil pointer dereference
      [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x7e351b]
      
      * swarm: run TestSwarmNetwork with fewer nodes with -race
      
      As otherwise we always get test failure with `network_test.go:374:
      context deadline exceeded` even with raised `Timeout`.
      
      * swarm/network: run TestDeliveryFromNodes with fewer nodes with -race
      
      Test on Travis times out with 8 or more nodes if -race flag is present.
      
      * swarm/network: smaller node count for discovery tests with -race
      
      TestDiscoveryPersistenceSimulationSimAdapters failed on Travis with
      `-race` flag present. The failure was due to extensive memory usage,
      coming from the CGO runtime. Using a smaller node count resolves the
      issue.
      
      === RUN   TestDiscoveryPersistenceSimulationSimAdapter
      ==7227==ERROR: ThreadSanitizer failed to allocate 0x80000 (524288) bytes of clock allocator (error code: 12)
      FATAL: ThreadSanitizer CHECK failed: ./gotsan.cc:6976 "((0 && "unable to mmap")) != (0)" (0x0, 0x0)
      FAIL    github.com/ethereum/go-ethereum/swarm/network/simulations/discovery     804.826s
      
      * swarm/network: run TestFileRetrieval with fewer nodes with -race
      
      Otherwise we get a failure due to extensive memory usage, as the CGO
      runtime cannot allocate more bytes.
      
      === RUN   TestFileRetrieval
      ==7366==ERROR: ThreadSanitizer failed to allocate 0x80000 (524288) bytes of clock allocator (error code: 12)
      FATAL: ThreadSanitizer CHECK failed: ./gotsan.cc:6976 "((0 && "unable to mmap")) != (0)" (0x0, 0x0)
      FAIL	github.com/ethereum/go-ethereum/swarm/network/stream	155.165s
      
      * swarm/network: run TestRetrieval with fewer nodes with -race
      
      Otherwise we get a failure due to extensive memory usage, as the CGO
      runtime cannot allocate more bytes ("ThreadSanitizer failed to
      allocate").
      
      * swarm/network: skip flaky TestGetSubscriptionsRPC on Travis w/ -race
      
      Test fails a lot with something like:
       streamer_test.go:1332: Real subscriptions and expected amount don't match; real: 0, expected: 20
      
      * swarm/storage: skip TestDB_SubscribePull* tests on Travis w/ -race
      
      Travis just hangs...
      
      ok  	github.com/ethereum/go-ethereum/swarm/storage/feed/lookup	1.307s
      keepalive
      keepalive
      keepalive
      
      or panics after a while.
      
      Without these tests the race detector job is now stable. Let's
      invetigate these tests in a separate issue:
      https://github.com/ethersphere/go-ethereum/issues/1245
      e38b227c
  6. 13 Feb, 2019 1 commit
  7. 15 Oct, 2018 1 commit
  8. 23 Jul, 2015 1 commit
  9. 22 Jul, 2015 1 commit
  10. 07 Jul, 2015 1 commit
  11. 23 Mar, 2015 1 commit
  12. 16 Nov, 2014 1 commit
  13. 14 Nov, 2014 1 commit
  14. 12 Nov, 2014 2 commits
  15. 11 Nov, 2014 1 commit