Skip to content

Instantly share code, notes, and snippets.

@kylebarron
Last active April 26, 2025 18:01
Show Gist options
  • Save kylebarron/4aa486f40756f9ed1fc5078ea3292953 to your computer and use it in GitHub Desktop.
Save kylebarron/4aa486f40756f9ed1fc5078ea3292953 to your computer and use it in GitHub Desktop.
Creating graph for Cloud Native Geo Conference 2025 to test async-tiff and rasterio
import altair as alt
import pandas as pd
recv_bytes_per_second_mean = pd.DataFrame(
{
"Group": ["rasterio", "async-tiff"],
"Throughput (bytes/s)": [972102.34, 24319246.71],
},
)
recv_bytes_per_second_per_cpu_mean = pd.DataFrame(
{
"Group": ["rasterio", "async-tiff"],
"Throughput per CPU second": [760349.7069, 11429263.13],
},
)
memory_usage_bytes_mean = pd.DataFrame(
{
"Group": ["rasterio", "async-tiff"],
"Memory Usage (MiB)": [91331281.77 / 1024 / 1024, 491729766.7 / 1024 / 1024],
},
)
recv_bytes_per_second_mean_chart = (
alt.Chart(recv_bytes_per_second_mean)
.mark_bar()
.encode(
x=alt.X("Group:N", title="Library"),
y=alt.Y("Throughput (bytes/s):Q"),
color=alt.Color("Group:N", legend=alt.Legend(title="Library")),
)
.properties(
width=150,
height=200,
title=alt.TitleParams(
text="Throughput (higher is better)",
fontSize=14,
),
)
)
recv_bytes_per_second_per_cpu_mean_chart = (
alt.Chart(recv_bytes_per_second_per_cpu_mean)
.mark_bar()
.encode(
x=alt.X("Group:N", title="Library"),
y=alt.Y("Throughput per CPU second:Q"),
color=alt.Color("Group:N", legend=alt.Legend(title="Library")),
)
.properties(
width=150,
height=200,
title=alt.TitleParams(
text="Throughput/CPU sec (higher is better)",
fontSize=14,
),
)
)
memory_usage_bytes_mean_chart = (
alt.Chart(memory_usage_bytes_mean)
.mark_bar()
.encode(
x=alt.X("Group:N", title="Library"),
y=alt.Y("Memory Usage (MiB):Q"),
color=alt.Color("Group:N", legend=alt.Legend(title="Library")),
)
.properties(
width=150,
height=200,
title=alt.TitleParams(text="Memory Usage (lower is better)", fontSize=14),
)
)
final_chart = (
alt.hconcat(
recv_bytes_per_second_mean_chart,
recv_bytes_per_second_per_cpu_mean_chart,
memory_usage_bytes_mean_chart,
)
.properties(
title="Comparing async-tiff and rasterio for opening & parsing COG header.",
)
.configure_title(anchor="middle", fontSize=18)
)
final_chart.save("async-tiff.png", scale_factor=2)
import altair as alt
import pandas as pd
recv_bytes_per_second_mean = pd.DataFrame(
{
"Group": ["obstore", "requests", "aioboto3", "aiohttp"],
"Throughput (bytes/s)": [253384242.4, 81147299.37, 87910179.82, 231605561.1],
},
)
recv_bytes_per_second_per_cpu_mean = pd.DataFrame(
{
"Group": ["obstore", "requests", "aioboto3", "aiohttp"],
"Throughput per CPU second": [43811471.59, 8542193.1, 11903911.6, 38808248.24],
},
)
memory_usage_bytes_mean = pd.DataFrame(
{
"Group": ["obstore", "requests", "aioboto3", "aiohttp"],
"Memory Usage (MiB)": [
1060266099 / 1024 / 1024,
126520167.3 / 1024 / 1024,
546641897.1 / 1024 / 1024,
1642166646 / 1024 / 1024,
],
},
)
recv_bytes_per_second_mean_chart = (
alt.Chart(recv_bytes_per_second_mean)
.mark_bar()
.encode(
x=alt.X("Group:N", title="Library"),
y=alt.Y("Throughput (bytes/s):Q"),
color=alt.Color("Group:N", legend=alt.Legend(title="Library")),
)
.properties(
width=150,
height=200,
title=alt.TitleParams(
text="Throughput (higher is better)",
fontSize=14,
),
)
)
recv_bytes_per_second_per_cpu_mean_chart = (
alt.Chart(recv_bytes_per_second_per_cpu_mean)
.mark_bar()
.encode(
x=alt.X("Group:N", title="Library"),
y=alt.Y("Throughput per CPU second:Q"),
color=alt.Color("Group:N", legend=alt.Legend(title="Library")),
)
.properties(
width=150,
height=200,
title=alt.TitleParams(
text="Throughput/CPU sec (higher is better)",
fontSize=14,
),
)
)
memory_usage_bytes_mean_chart = (
alt.Chart(memory_usage_bytes_mean)
.mark_bar()
.encode(
x=alt.X("Group:N", title="Library"),
y=alt.Y("Memory Usage (MiB):Q"),
color=alt.Color("Group:N", legend=alt.Legend(title="Library")),
)
.properties(
width=150,
height=200,
title=alt.TitleParams(text="Memory Usage (lower is better)", fontSize=14),
)
)
final_chart = (
alt.hconcat(
recv_bytes_per_second_mean_chart,
recv_bytes_per_second_per_cpu_mean_chart,
memory_usage_bytes_mean_chart,
)
.properties(
title="Comparing libraries for requesting initial 32kb of file on S3",
)
.configure_title(anchor="middle", fontSize=18)
)
final_chart.save("obstore-concurrency.png", scale_factor=2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment