-
-
Notifications
You must be signed in to change notification settings - Fork 431
Open
Description
Describe the bug: The HTML report does not contain information about memory usage:
To Reproduce: Run the command "C:\Users\Akira\anaconda3\Scripts\scalene.exe" "P:\Personal Projects\Dicts\English Wiktionary - October 2025\test.py" --no-browser in Windows CMD where test.py is
import random
import math
import numpy as np
import time
def python_heavy_computation(n: int):
"""
Intentionally CPU- and allocation-heavy pure Python code.
"""
data = []
for i in range(n):
row = []
for j in range(200):
value = math.sin(i * 0.001) * math.cos(j * 0.002)
value += random.random() * 0.0001
row.append(value)
data.append(row)
# Create additional temporary objects
flattened = [abs(x) for row in data for x in row]
return sum(flattened)
def numpy_heavy_computation(n: int):
"""
Vectorized NumPy computation for contrast.
"""
i = np.arange(n).reshape(-1, 1)
j = np.arange(200).reshape(1, -1)
data = np.sin(i * 0.001) * np.cos(j * 0.002)
noise = np.random.random(data.shape) * 0.0001
data = data + noise
return np.sum(np.abs(data))
def memory_churn():
"""
Deliberate memory churn to highlight allocation behavior.
"""
blocks = []
for _ in range(1000):
blocks.append(bytearray(1024 * 50)) # ~50 KB each
random.shuffle(blocks)
blocks.clear()
def main():
start = time.time()
result1 = python_heavy_computation(800)
memory_churn()
result2 = numpy_heavy_computation(800)
elapsed = time.time() - start
print("Python result:", result1)
print("NumPy result:", result2)
print("Elapsed time:", elapsed)
if __name__ == "__main__":
main()Expected behavior: There should be memory usage like in this screenshot.
Desktop (please complete the following information):
- OS:
Edition Windows 11 Pro
Version 25H2
Installed on 11/5/2025
OS build 26200.7462
Experience Windows Feature Experience Pack 1000.26100.275.0
- Browser:
Microsoft Edge Version 143.0.3650.80 (Official build) (64-bit)
- Python:
Python 3.13.5
- Scalene:
Scalene version 1.5.55 (2025.09.23)
Metadata
Metadata
Assignees
Labels
No labels