diff --git a/scripts/block-import-stats.py b/scripts/block-import-stats.py index c6d108236..2def0ae56 100644 --- a/scripts/block-import-stats.py +++ b/scripts/block-import-stats.py @@ -14,8 +14,13 @@ register_matplotlib_converters() def readStats(name: str, min_block_number: int): df = pd.read_csv(name).convert_dtypes() - if df.block_number.iloc[-1] > min_block_number: - cutoff = min(df.block_number.iloc[-1] - min_block_number, min_block_number) + # at least one item - let it lag in the beginning until we reach the min + # block number or the table will be empty + if df.block_number.iloc[-1] > min_block_number + df.block_number.iloc[0]: + cutoff = min( + df.block_number.iloc[-1] - min_block_number, + min_block_number, + ) df = df[df.block_number >= cutoff] df.set_index("block_number", inplace=True) df.time /= 1000000000 @@ -43,7 +48,7 @@ def prettySecs(s: float): def formatBins(df: pd.DataFrame, bins: int): if bins > 0: bins = np.linspace( - df.block_number.iloc[0], df.block_number.iloc[-1], bins, dtype=int + df.block_number.iloc[0] - df.blocks.iloc[0], df.block_number.iloc[-1], bins, dtype=int ) return df.groupby(pd.cut(df["block_number"], bins), observed=True) else: @@ -68,15 +73,15 @@ parser.add_argument( ) args = parser.parse_args() -baseline = readStats(args.baseline, args.min_block_number) +baseline = readStats(args.baseline, 0) contender = readStats(args.contender, args.min_block_number) # Pick out the rows to match - a more sophisticated version of this would # interpolate, perhaps - also, maybe should check for non-matching block/tx counts df = baseline.merge(contender, on=("block_number", "blocks", "txs")) -df["bpsd"] = ((df.bps_y - df.bps_x) / df.bps_x).fillna(0) -df["tpsd"] = ((df.tps_y - df.tps_x) / df.tps_x).fillna(0) +df["bpsd"] = ((df.bps_y - df.bps_x) / df.bps_x) +df["tpsd"] = ((df.tps_y - df.tps_x) / df.tps_x.replace(0, 1)) df["timed"] = (df.time_y - df.time_x) / df.time_x df.reset_index(inplace=True) @@ -131,10 +136,8 @@ print(f"tpsd (mean): {df.tpsd.mean():.2%}") time_xt = df.time_x.sum() time_yt = df.time_y.sum() -timet = time_yt-df.time_x.sum() -print( - f"Time (total): {prettySecs(timet)}, {(timet/time_xt):.2%}" -) +timet = time_yt - df.time_x.sum() +print(f"Time (total): {prettySecs(timet)}, {(timet/time_xt):.2%}") print() print( diff --git a/vendor/nim-eth b/vendor/nim-eth index d935c0de4..c02e050db 160000 --- a/vendor/nim-eth +++ b/vendor/nim-eth @@ -1 +1 @@ -Subproject commit d935c0de47a69de58b37b47b601f75f8a05def00 +Subproject commit c02e050db8c60010b1e779d81c9d0f033f88d410 diff --git a/vendor/nimcrypto b/vendor/nimcrypto index 485f7b3cf..71bca1550 160000 --- a/vendor/nimcrypto +++ b/vendor/nimcrypto @@ -1 +1 @@ -Subproject commit 485f7b3cfa83c1beecc0e31be0e964d697aa74d7 +Subproject commit 71bca15508e2c0548f32b42a69bcfb1ccd9ab9ff