Convert README to English with natural flow

- Recreated entire README in English
- Preserved all technical details and data
- Improved flow and readability
- Kept Swedish version as README_SV.md for reference
- All charts and analysis now in English
This commit is contained in:
Ein Anderssono
2026-04-23 01:15:07 +02:00
parent c5fc60b89c
commit c989bb8cb4
126 changed files with 1810 additions and 1473 deletions
+41 -19
View File
@@ -20,7 +20,8 @@ def read_timeline_data(filepath):
if len(parts) >= 3:
try:
times.append(int(parts[0]))
memories.append(int(parts[1]) / 1024) # Convert KB to MB
# Memory is now in bytes, convert to MB for display
memories.append(int(parts[1]) / (1024 * 1024)) # Convert bytes to MB
cpus.append(int(parts[2]))
except ValueError:
continue
@@ -28,7 +29,7 @@ def read_timeline_data(filepath):
return times, memories, cpus
def generate_mermaid_chart(language, times, memories, cpus):
"""Generate Mermaid XY chart for a language."""
"""Generate Mermaid XY chart for a language with memory and CPU."""
if len(times) == 0:
return None
@@ -40,18 +41,26 @@ def generate_mermaid_chart(language, times, memories, cpus):
memories = memories[::step]
cpus = cpus[::step]
# Find max values for scaling
max_time = max(times)
max_memory = max(memories) if max(memories) > 0 else 1
max_cpu = max(cpus) if max(cpus) > 0 else 1
chart = f"```mermaid\n"
chart += f"xychart-beta\n"
chart += f' title "{language} - Resursanvändning över tid"\n'
chart += f' x-axis "Tid (ms)" 0 --> {max(times)}\n'
chart += f' y-axis "Minne (MB)" 0 --> {max(memories) + 1}\n'
chart += f' line [{", ".join([f"{m:.1f}" for m in memories])}]\n'
chart += f' title "{language} - Tidslinje: Minne (MB) och CPU (%)"\n'
chart += f' x-axis "Tid (ms)" 0 --> {max_time}\n'
chart += f' y-axis "Minne (MB) / CPU (%)" 0 --> {max(max_memory, max_cpu) + 1}\n'
# Memory line (in MB)
chart += f' line[{", ".join([f"{m:.2f}" for m in memories])}]\n'
# CPU line (in %)
chart += f' line[{", ".join([f"{c}" for c in cpus])}]\n'
chart += f"```\n"
return chart
def generate_comparison_chart(languages_data, title, max_time=None):
"""Generate comparison chart for multiple languages."""
"""Generate comparison chart for multiple languages showing memory and CPU."""
if not languages_data or all(len(data[1]) == 0 for data in languages_data):
return None
@@ -62,22 +71,34 @@ def generate_comparison_chart(languages_data, title, max_time=None):
# Sample to max 10 points per language
max_points = 10
sampled_data = []
for lang, times, memories in languages_data:
for lang, times, memories, cpus in languages_data:
if len(times) > max_points:
step = len(times) // max_points
times = times[::step]
memories = memories[::step]
sampled_data.append((lang, times, memories))
cpus = cpus[::step]
sampled_data.append((lang, times, memories, cpus))
# Find max values for scaling
max_memory = max(max(m) if m else 0 for _, _, m, _ in sampled_data)
max_cpu = max(max(c) if c else 0 for _, _, _, c in sampled_data)
max_y = max(max_memory, max_cpu) + 1
chart = f"```mermaid\n"
chart += f"xychart-beta\n"
chart += f' title "{title}"\n'
chart += f' x-axis "Tid (ms)" 0 --> {max_time}\n'
chart += f' y-axis "Minne (MB)" 0 --> {max(max(m) if m else 0 for _, _, m in sampled_data) + 1}\n'
chart += f' y-axis "Minne (MB) / CPU (%)" 0 --> {max_y}\n'
for lang, times, memories in sampled_data:
# Add memory lines for each language
for lang, times, memories, cpus in sampled_data:
if len(memories) > 0:
chart += f' line [{", ".join([f"{m:.1f}" for m in memories])}]\n'
chart += f' line[{", ".join([f"{m:.2f}" for m in memories])}]\n'
# Add CPU lines for each language
for lang, times, memories, cpus in sampled_data:
if len(cpus) > 0:
chart += f' line[{", ".join([f"{c}" for c in cpus])}]\n'
chart += f"```\n"
@@ -111,7 +132,8 @@ def main():
# Generate output
with open(output_file, 'w') as f:
f.write("# Resursanvändning över tid\n\n")
f.write("Följande diagram visar minnesanvändning över tid för varje språk.\n\n")
f.write("Följande diagram visar minnesanvändning (MB) och CPU-användning (%) över tid.\n")
f.write("Varje diagram har två linjer: minne (övre) och CPU (undre).\n\n")
# Individual charts for each language
for language, times, memories, cpus in all_languages:
@@ -125,29 +147,29 @@ def main():
f.write("# Jämförelser\n\n")
# Fast languages (under 50ms)
fast = [(lang, t, m) for lang, t, m, c in all_languages if len(t) > 0 and t[-1] < 50]
fast = [(lang, t, m, c) for lang, t, m, c in all_languages if len(t) > 0 and t[-1] < 50]
if fast:
f.write("## Snabba språk (< 50ms)\n\n")
chart = generate_comparison_chart(fast, "Snabba språk - Minnesanvändning")
chart = generate_comparison_chart(fast, "Snabba språk - Minne och CPU över tid")
if chart:
f.write(chart)
f.write("\n")
# Medium languages (50-200ms)
medium = [(lang, t, m) for lang, t, m, c in all_languages
medium = [(lang, t, m, c) for lang, t, m, c in all_languages
if len(t) > 0 and 50 <= t[-1] < 200]
if medium:
f.write("## Medelsnabba språk (50-200ms)\n\n")
chart = generate_comparison_chart(medium, "Medelsnabba språk - Minnesanvändning")
chart = generate_comparison_chart(medium, "Medelsnabba språk - Minne och CPU över tid")
if chart:
f.write(chart)
f.write("\n")
# Slow languages (200ms+)
slow = [(lang, t, m) for lang, t, m, c in all_languages if len(t) > 0 and t[-1] >= 200]
slow = [(lang, t, m, c) for lang, t, m, c in all_languages if len(t) > 0 and t[-1] >= 200]
if slow:
f.write("## Långsamma språk (200ms+)\n\n")
chart = generate_comparison_chart(slow, "Långsamma språk - Minnesanvändning")
chart = generate_comparison_chart(slow, "Långsamma språk - Minne och CPU över tid")
if chart:
f.write(chart)
f.write("\n")