Commit Graph

31 Commits

Author SHA1 Message Date
fanquake d873ff96e5
refactor: cleanups post unsubtree'ing univalue
Mostly changes to remove src/univalue exceptions from the various linters,
and the required code changes to make them happy. As well as minor doc
changes.
2022-06-15 12:56:44 +01:00
brunoerg 027aab663a test, contrib, refactor: use `with` when opening a file 2022-04-27 20:04:33 -03:00
Hennadii Stepanov f47dda2c58
scripted-diff: Bump copyright headers
-BEGIN VERIFY SCRIPT-
./contrib/devtools/copyright_header.py update ./
-END VERIFY SCRIPT-

Commits of previous years:
* 2020: fa0074e2d8
* 2019: aaaaad6ac9
2021-12-30 19:36:57 +02:00
Hennadii Stepanov c29105efdc
script: Fix copyright_header.py
This change prevents updating copyright years from "2021" to
"2021-2017".
2021-12-30 19:33:20 +02:00
Gleb Naumenko 0659f12b13
Add minisketch dependency 2021-10-21 09:38:55 +08:00
Martin Ankerl 78c312c983 Replace current benchmarking framework with nanobench
This replaces the current benchmarking framework with nanobench [1], an
MIT licensed single-header benchmarking library, of which I am the
autor. This has in my opinion several advantages, especially on Linux:

* fast: Running all benchmarks takes ~6 seconds instead of 4m13s on
  an Intel i7-8700 CPU @ 3.20GHz.

* accurate: I ran e.g. the benchmark for SipHash_32b 10 times and
  calculate standard deviation / mean = coefficient of variation:

  * 0.57% CV for old benchmarking framework
  * 0.20% CV for nanobench

  So the benchmark results with nanobench seem to vary less than with
  the old framework.

* It automatically determines runtime based on clock precision, no need
  to specify number of evaluations.

* measure instructions, cycles, branches, instructions per cycle,
  branch misses (only Linux, when performance counters are available)

* output in markdown table format.

* Warn about unstable environment (frequency scaling, turbo, ...)

* For better profiling, it is possible to set the environment variable
  NANOBENCH_ENDLESS to force endless running of a particular benchmark
  without the need to recompile. This makes it to e.g. run "perf top"
  and look at hotspots.

Here is an example copy & pasted from the terminal output:

|             ns/byte |              byte/s |    err% |        ins/byte |        cyc/byte |    IPC |       bra/byte |   miss% |     total | benchmark
|--------------------:|--------------------:|--------:|----------------:|----------------:|-------:|---------------:|--------:|----------:|:----------
|                2.52 |      396,529,415.94 |    0.6% |           25.42 |            8.02 |  3.169 |           0.06 |    0.0% |      0.03 | `bench/crypto_hash.cpp RIPEMD160`
|                1.87 |      535,161,444.83 |    0.3% |           21.36 |            5.95 |  3.589 |           0.06 |    0.0% |      0.02 | `bench/crypto_hash.cpp SHA1`
|                3.22 |      310,344,174.79 |    1.1% |           36.80 |           10.22 |  3.601 |           0.09 |    0.0% |      0.04 | `bench/crypto_hash.cpp SHA256`
|                2.01 |      496,375,796.23 |    0.0% |           18.72 |            6.43 |  2.911 |           0.01 |    1.0% |      0.00 | `bench/crypto_hash.cpp SHA256D64_1024`
|                7.23 |      138,263,519.35 |    0.1% |           82.66 |           23.11 |  3.577 |           1.63 |    0.1% |      0.00 | `bench/crypto_hash.cpp SHA256_32b`
|                3.04 |      328,780,166.40 |    0.3% |           35.82 |            9.69 |  3.696 |           0.03 |    0.0% |      0.03 | `bench/crypto_hash.cpp SHA512`

[1] https://github.com/martinus/nanobench

* Adds support for asymptotes

  This adds support to calculate asymptotic complexity of a benchmark.
  This is similar to #17375, but currently only one asymptote is
  supported, and I have added support in the benchmark `ComplexMemPool`
  as an example.

  Usage is e.g. like this:

  ```
  ./bench_bitcoin -filter=ComplexMemPool -asymptote=25,50,100,200,400,600,800
  ```

  This runs the benchmark `ComplexMemPool` several times but with
  different complexityN settings. The benchmark can extract that number
  and use it accordingly. Here, it's used for `childTxs`. The output is
  this:

  | complexityN |               ns/op |                op/s |    err% |          ins/op |          cyc/op |    IPC |     total | benchmark
  |------------:|--------------------:|--------------------:|--------:|----------------:|----------------:|-------:|----------:|:----------
  |          25 |        1,064,241.00 |              939.64 |    1.4% |    3,960,279.00 |    2,829,708.00 |  1.400 |      0.01 | `ComplexMemPool`
  |          50 |        1,579,530.00 |              633.10 |    1.0% |    6,231,810.00 |    4,412,674.00 |  1.412 |      0.02 | `ComplexMemPool`
  |         100 |        4,022,774.00 |              248.58 |    0.6% |   16,544,406.00 |   11,889,535.00 |  1.392 |      0.04 | `ComplexMemPool`
  |         200 |       15,390,986.00 |               64.97 |    0.2% |   63,904,254.00 |   47,731,705.00 |  1.339 |      0.17 | `ComplexMemPool`
  |         400 |       69,394,711.00 |               14.41 |    0.1% |  272,602,461.00 |  219,014,691.00 |  1.245 |      0.76 | `ComplexMemPool`
  |         600 |      168,977,165.00 |                5.92 |    0.1% |  639,108,082.00 |  535,316,887.00 |  1.194 |      1.86 | `ComplexMemPool`
  |         800 |      310,109,077.00 |                3.22 |    0.1% |1,149,134,246.00 |  984,620,812.00 |  1.167 |      3.41 | `ComplexMemPool`

  |   coefficient |   err% | complexity
  |--------------:|-------:|------------
  |   4.78486e-07 |   4.5% | O(n^2)
  |   6.38557e-10 |  21.7% | O(n^3)
  |   3.42338e-05 |  38.0% | O(n log n)
  |   0.000313914 |  46.9% | O(n)
  |     0.0129823 | 114.4% | O(log n)
  |     0.0815055 | 133.8% | O(1)

  The best fitting curve is O(n^2), so the algorithm seems to scale
  quadratic with `childTxs` in the range 25 to 800.
2020-06-13 12:24:18 +02:00
MarcoFalke fa488f131f
scripted-diff: Bump copyright headers
-BEGIN VERIFY SCRIPT-
./contrib/devtools/copyright_header.py update ./
-END VERIFY SCRIPT-
2020-04-16 13:33:09 -04:00
Wladimir J. van der Laan 3a037d0067 test: Add crc32c exception to various linters and generation scripts 2020-01-28 17:01:48 +01:00
Hennadii Stepanov 6fde9d5e47
script: Update EXLUDE list in copyright_header.py 2020-01-03 17:48:37 +02:00
Hennadii Stepanov 1998152f15
script: Add empty line after C++ copyright 2020-01-03 17:48:37 +02:00
Hennadii Stepanov 071f2fc204
script: Add ability to insert copyright to *.sh 2020-01-03 17:47:54 +02:00
gchuf dffae5a5ad scripts: update copyright_header script to include additional files
Includes .sh and .bash-completion files in the script as well
2019-10-04 17:47:55 +02:00
Ben Woosley 3d0a82cff8
devtools: Accomodate block-style copyright blocks
Without this, `copyright_header.py report . verbose` reports:
-------------------------------------------------------------------------------
1 with unexpected copyright holder names
	./build_msvc/libsecp256k1_config.h
-------------------------------------------------------------------------------
2019-09-03 14:41:43 -04:00
Ben Woosley b21680baf5
test/contrib: Fix invalid escapes in regex strings
Flagged by flake8 v3.6.0, as W605, plus a few others identified
incidentally, e.g. 59ffecf66cf4d08c4b431e457b083878d66a3fd6.

Note that r"\n" matches to "\n" under re.match/search.
2019-09-03 14:38:38 -04:00
Hennadii Stepanov ca11606858
Fix: "Bitcoin Core" -> "The Bitcoin Core" 2019-06-29 18:58:52 +03:00
Hennadii Stepanov 621463d7df
Drop no-longer-relevant copyright holder name 2019-06-29 18:50:39 +03:00
Hennadii Stepanov 01fafe55a1
Include Objective-C source files
The copyright_header.py script will process Objective-C source files 
(*.mm) as other ones.
2019-06-29 18:35:45 +03:00
Ben Woosley ad5e5a105e
Scripts and tools: Drop no-longer-relevant copyright holder names
Now that leveldb, secp256k1, etc. are reliably excluded, these
names will not show up in the searched files.
2019-01-24 23:46:12 -08:00
Ben Woosley 2434ab5c2a
Scripts and tools: Fix devtools/copyright_header.py to always honor exclusions
This script compared paths relative to the report directory to test for exclusion,
meaning the directory exclusions did not work properly, as they were relative to
the project root.

Fix this by creating absolute paths through the combination of:
'git ls-files --full-name' and 'git rev-parse --show-toplevel'
2019-01-24 23:46:06 -08:00
Daniel Ingram 17b55202da Compare to None with is/is not 2018-12-10 15:11:37 -05:00
Cornelius Schumacher af9a9918b2 Fix detection of copyright holders
* There is a copyright notice in `src/crypto/sha256_sse4.cpp` in the
  middle of the file which contains a comma before the copyright
  holder name. Correctly detect this so it's added to the report.
* Add missing copyright holders so that `copyright_header.py report`
  doesn't show any unexpected copyright holder names anymore.
* Exclude files from git subtrees because they are maintained at the
  original source.
2018-11-23 17:22:50 +01:00
DrahtBot eb7daf4d60 Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
practicalswift 634bd97001 Explicitly specify encoding when opening text files in Python code 2018-06-12 21:34:52 +02:00
John Bampton 0d31ef4762 Enable W191 and W291 flake8 checks.
Remove trailing whitespace from Python files.
Convert tabs to spaces.
2018-05-11 07:59:05 +10:00
practicalswift f020aca297 Minor Python cleanups to make flake8 pass with the new rules enabled 2018-04-16 17:25:11 +02:00
MarcoFalke c991b304de
Merge #12075: [scripts] Add missing univalue file to copyright_header.py
415f86c6ae [scripts] Add missing univalue file to copyright_header.py (fanquake)

Pull request description:

  This needs to be added so that PRs like #12062 don't modify the subtree.

Tree-SHA512: 3642bdb0c8271ae700857a79fa5800b0c26c4b3f126d4406f224293817fb74d498fa1fc581d576ae747fbbb6952d4369fc4ab823ab48fd0946c1e8ccbe93cee6
2018-01-03 06:03:03 -09:00
Akira Takizawa 595a7bab23 Increment MIT Licence copyright header year on files modified in 2017 2018-01-03 02:26:56 +09:00
fanquake 415f86c6ae
[scripts] Add missing univalue file to copyright_header.py 2018-01-02 10:20:50 +08:00
John Newbery c28ee91db0 Rename rpc-tests directory to functional 2017-03-20 10:40:31 -04:00
John Newbery 00902c48cd Rename qa directory to test 2017-03-20 10:40:31 -04:00
isle2983 159597a2b8 [devtools] script support for managing source file copyright headers
Three subcommands to this script:

1) ./copyright_header.py report

Examines git-tracked files with extensions that match:

INCLUDE = ['*.h', '*.cpp', '*.cc', '*.c', '*.py']

Helps to:

-> Identify source files without copyright
-> Identify source files added with something other than "The Bitcoin Core
developers" holder so we can be sure it is appropriate
-> Identify unintentional typos in the copyright line

2) ./copyright_header.py update

Replaces fix-copyright-headers.py. It does file editing in native python
rather than subprocessing out to perl as was the case with
fix-copyright-headers.py. It also shares code with the 'report' functions.

3) ./copyright_header.py insert

Inserts a copyright header into a source file with the proper format and
dates.
2016-09-10 14:58:42 -06:00