keccak: improve perf a little (#2321)
* avoid `burnMem` * avoid zeroing buffers * work around `when nimvm` issue
This commit is contained in:
parent
4e50b05564
commit
32c51b14a4
|
@ -14,8 +14,13 @@ register_matplotlib_converters()
|
||||||
|
|
||||||
def readStats(name: str, min_block_number: int):
|
def readStats(name: str, min_block_number: int):
|
||||||
df = pd.read_csv(name).convert_dtypes()
|
df = pd.read_csv(name).convert_dtypes()
|
||||||
if df.block_number.iloc[-1] > min_block_number:
|
# at least one item - let it lag in the beginning until we reach the min
|
||||||
cutoff = min(df.block_number.iloc[-1] - min_block_number, min_block_number)
|
# 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 = df[df.block_number >= cutoff]
|
||||||
df.set_index("block_number", inplace=True)
|
df.set_index("block_number", inplace=True)
|
||||||
df.time /= 1000000000
|
df.time /= 1000000000
|
||||||
|
@ -43,7 +48,7 @@ def prettySecs(s: float):
|
||||||
def formatBins(df: pd.DataFrame, bins: int):
|
def formatBins(df: pd.DataFrame, bins: int):
|
||||||
if bins > 0:
|
if bins > 0:
|
||||||
bins = np.linspace(
|
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)
|
return df.groupby(pd.cut(df["block_number"], bins), observed=True)
|
||||||
else:
|
else:
|
||||||
|
@ -68,15 +73,15 @@ parser.add_argument(
|
||||||
)
|
)
|
||||||
args = parser.parse_args()
|
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)
|
contender = readStats(args.contender, args.min_block_number)
|
||||||
|
|
||||||
# Pick out the rows to match - a more sophisticated version of this would
|
# 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
|
# interpolate, perhaps - also, maybe should check for non-matching block/tx counts
|
||||||
df = baseline.merge(contender, on=("block_number", "blocks", "txs"))
|
df = baseline.merge(contender, on=("block_number", "blocks", "txs"))
|
||||||
|
|
||||||
df["bpsd"] = ((df.bps_y - df.bps_x) / df.bps_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).fillna(0)
|
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["timed"] = (df.time_y - df.time_x) / df.time_x
|
||||||
|
|
||||||
df.reset_index(inplace=True)
|
df.reset_index(inplace=True)
|
||||||
|
@ -131,10 +136,8 @@ print(f"tpsd (mean): {df.tpsd.mean():.2%}")
|
||||||
time_xt = df.time_x.sum()
|
time_xt = df.time_x.sum()
|
||||||
time_yt = df.time_y.sum()
|
time_yt = df.time_y.sum()
|
||||||
|
|
||||||
timet = time_yt-df.time_x.sum()
|
timet = time_yt - df.time_x.sum()
|
||||||
print(
|
print(f"Time (total): {prettySecs(timet)}, {(timet/time_xt):.2%}")
|
||||||
f"Time (total): {prettySecs(timet)}, {(timet/time_xt):.2%}"
|
|
||||||
)
|
|
||||||
|
|
||||||
print()
|
print()
|
||||||
print(
|
print(
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit d935c0de47a69de58b37b47b601f75f8a05def00
|
Subproject commit c02e050db8c60010b1e779d81c9d0f033f88d410
|
|
@ -1 +1 @@
|
||||||
Subproject commit 485f7b3cfa83c1beecc0e31be0e964d697aa74d7
|
Subproject commit 71bca15508e2c0548f32b42a69bcfb1ccd9ab9ff
|
Loading…
Reference in New Issue