Skip to content

Conversation

@Uzaaft
Copy link
Contributor

@Uzaaft Uzaaft commented Nov 30, 2025

Before:
image

After:
image

The most significant changes is the changes done to main.rs, which dropped the memory usage with about 2.2 kb

Eliminates ~1KB stdout buffering allocation by using Cursor<&mut [u8]>
and libc::write instead of format!() + stdout().write_all()
@Uzaaft Uzaaft changed the title Gotta go fast Gotta go small Nov 30, 2025
@github-actions
Copy link

Performance Comparison

Total Elapsed Time: 820.31µs → 844.84µs (+3.0%)

Profiling Mode: timing - Execution duration of functions.

+-----------------------------------------------+------------------+--------------------------------+--------------------------------+--------------------------------+------------------------------+
| Function                                      | Calls            | Avg                            | P95                            | Total                          | % Total                      |
+-----------------------------------------------+------------------+--------------------------------+--------------------------------+--------------------------------+------------------------------+
| microfetch::main                              | 1 → 1 (+0.0%)    | 103.12µs → 106.56µs (+3.3%)    | 103.17µs → 106.62µs (+3.3%)    | 103.12µs → 106.56µs (+3.3%)    | 100.00% → 100.00% (+0.0%)    |
+-----------------------------------------------+------------------+--------------------------------+--------------------------------+--------------------------------+------------------------------+
| microfetch::system::get_memory_usage          | 1 → 1 (+0.0%)    | 30.05µs → 27.86µs (-7.3%)      | 30.05µs → 27.87µs (-7.2%)      | 30.05µs → 27.86µs (-7.3%)      | 29.13% → 26.14% (-10.3%)     |
+-----------------------------------------------+------------------+--------------------------------+--------------------------------+--------------------------------+------------------------------+
| microfetch::system::parse_memory_info         | 1 → 1 (+0.0%)    | 25.68µs → 24.77µs (-3.5%)      | 25.68µs → 24.77µs (-3.6%)      | 25.68µs → 24.77µs (-3.5%)      | 24.90% → 23.24% (-6.7%)      |
+-----------------------------------------------+------------------+--------------------------------+--------------------------------+--------------------------------+------------------------------+
| microfetch::release::get_os_pretty_name       | 1 → 1 (+0.0%)    | 13.28µs → 23.69µs (+78.4%) ⚠️  | 13.28µs → 23.70µs (+78.4%) ⚠️  | 13.28µs → 23.69µs (+78.4%) ⚠️  | 12.87% → 22.22% (+72.6%) ⚠️  |
+-----------------------------------------------+------------------+--------------------------------+--------------------------------+--------------------------------+------------------------------+
| microfetch::print_system_info                 | 1 → 1 (+0.0%)    | 20.51µs → 11.94µs (-41.8%) 🚀  | 20.51µs → 11.94µs (-41.8%) 🚀  | 20.51µs → 11.94µs (-41.8%) 🚀  | 19.88% → 11.20% (-43.7%) 🚀  |
+-----------------------------------------------+------------------+--------------------------------+--------------------------------+--------------------------------+------------------------------+
| microfetch::system::get_username_and_hostname | 1 → 1 (+0.0%)    | 3.16µs → 6.15µs (+94.9%) ⚠️    | 3.16µs → 6.15µs (+94.8%) ⚠️    | 3.16µs → 6.15µs (+94.9%) ⚠️    | 3.06% → 5.77% (+88.6%) ⚠️    |
+-----------------------------------------------+------------------+--------------------------------+--------------------------------+--------------------------------+------------------------------+
| microfetch::release::get_system_info          | 1 → 1 (+0.0%)    | 7.32µs → 5.40µs (-26.3%) 🚀    | 7.33µs → 5.40µs (-26.3%) 🚀    | 7.32µs → 5.40µs (-26.3%) 🚀    | 7.10% → 5.06% (-28.7%) 🚀    |
+-----------------------------------------------+------------------+--------------------------------+--------------------------------+--------------------------------+------------------------------+
| microfetch::system::get_root_disk_usage       | 1 → 1 (+0.0%)    | 4.76µs → 4.56µs (-4.2%)        | 4.76µs → 4.56µs (-4.2%)        | 4.76µs → 4.56µs (-4.2%)        | 4.61% → 4.27% (-7.4%)        |
+-----------------------------------------------+------------------+--------------------------------+--------------------------------+--------------------------------+------------------------------+
| microfetch::uptime::get_current               | 1 → 1 (+0.0%)    | 4.04µs → 3.90µs (-3.4%)        | 4.04µs → 3.90µs (-3.4%)        | 4.04µs → 3.90µs (-3.4%)        | 3.91% → 3.65% (-6.6%)        |
+-----------------------------------------------+------------------+--------------------------------+--------------------------------+--------------------------------+------------------------------+
| microfetch::desktop::get_desktop_info         | 1 → 1 (+0.0%)    | 1.69µs → 1.51µs (-10.7%)       | 1.69µs → 1.51µs (-10.7%)       | 1.69µs → 1.51µs (-10.7%)       | 1.64% → 1.41% (-14.0%)       |
+-----------------------------------------------+------------------+--------------------------------+--------------------------------+--------------------------------+------------------------------+
| microfetch::system::get_shell                 | 1 → 1 (+0.0%)    | 1.37µs → 822.00ns (-40.1%) 🚀  | 1.37µs → 822.00ns (-40.1%) 🚀  | 1.37µs → 822.00ns (-40.1%) 🚀  | 1.33% → 0.77% (-42.1%) 🚀    |
+-----------------------------------------------+------------------+--------------------------------+--------------------------------+--------------------------------+------------------------------+
| microfetch::colors::print_dots                | 1 → 1 (+0.0%)    | 611.00ns → 622.00ns (+1.8%)    | 611.00ns → 622.00ns (+1.8%)    | 611.00ns → 622.00ns (+1.8%)    | 0.59% → 0.58% (-1.7%)        |
+-----------------------------------------------+------------------+--------------------------------+--------------------------------+--------------------------------+------------------------------+

Generated with hotpath-rs

📊 View Raw JSON Metrics

PR Metrics

{
  "hotpath_profiling_mode": "timing",
  "total_elapsed": 844839,
  "description": "Execution duration of functions.",
  "caller_name": "microfetch::main",
  "output": {
    "microfetch::print_system_info": {
      "calls": 1,
      "avg": 11943,
      "p95": 11943,
      "total": 11943,
      "percent_total": 1120
    },
    "microfetch::main": {
      "calls": 1,
      "avg": 106561,
      "p95": 106623,
      "total": 106561,
      "percent_total": 10000
    },
    "microfetch::system::parse_memory_info": {
      "calls": 1,
      "avg": 24767,
      "p95": 24767,
      "total": 24767,
      "percent_total": 2324
    },
    "microfetch::uptime::get_current": {
      "calls": 1,
      "avg": 3898,
      "p95": 3899,
      "total": 3898,
      "percent_total": 365
    },
    "microfetch::system::get_root_disk_usage": {
      "calls": 1,
      "avg": 4559,
      "p95": 4559,
      "total": 4559,
      "percent_total": 427
    },
    "microfetch::release::get_system_info": {
      "calls": 1,
      "avg": 5400,
      "p95": 5403,
      "total": 5400,
      "percent_total": 506
    },
    "microfetch::desktop::get_desktop_info": {
      "calls": 1,
      "avg": 1512,
      "p95": 1512,
      "total": 1512,
      "percent_total": 141
    },
    "microfetch::system::get_username_and_hostname": {
      "calls": 1,
      "avg": 6151,
      "p95": 6151,
      "total": 6151,
      "percent_total": 577
    },
    "microfetch::colors::print_dots": {
      "calls": 1,
      "avg": 622,
      "p95": 622,
      "total": 622,
      "percent_total": 58
    },
    "microfetch::system::get_shell": {
      "calls": 1,
      "avg": 822,
      "p95": 822,
      "total": 822,
      "percent_total": 77
    },
    "microfetch::release::get_os_pretty_name": {
      "calls": 1,
      "avg": 23685,
      "p95": 23695,
      "total": 23685,
      "percent_total": 2222
    },
    "microfetch::system::get_memory_usage": {
      "calls": 1,
      "avg": 27863,
      "p95": 27871,
      "total": 27863,
      "percent_total": 2614
    }
  }
}

Main Branch Metrics

{
  "hotpath_profiling_mode": "timing",
  "total_elapsed": 820313,
  "description": "Execution duration of functions.",
  "caller_name": "microfetch::main",
  "output": {
    "microfetch::uptime::get_current": {
      "calls": 1,
      "avg": 4037,
      "p95": 4037,
      "total": 4037,
      "percent_total": 391
    },
    "microfetch::system::parse_memory_info": {
      "calls": 1,
      "avg": 25678,
      "p95": 25679,
      "total": 25678,
      "percent_total": 2490
    },
    "microfetch::print_system_info": {
      "calls": 1,
      "avg": 20508,
      "p95": 20511,
      "total": 20508,
      "percent_total": 1988
    },
    "microfetch::release::get_os_pretty_name": {
      "calls": 1,
      "avg": 13275,
      "p95": 13279,
      "total": 13275,
      "percent_total": 1287
    },
    "microfetch::main": {
      "calls": 1,
      "avg": 103115,
      "p95": 103167,
      "total": 103115,
      "percent_total": 10000
    },
    "microfetch::colors::print_dots": {
      "calls": 1,
      "avg": 611,
      "p95": 611,
      "total": 611,
      "percent_total": 59
    },
    "microfetch::system::get_memory_usage": {
      "calls": 1,
      "avg": 30047,
      "p95": 30047,
      "total": 30047,
      "percent_total": 2913
    },
    "microfetch::system::get_shell": {
      "calls": 1,
      "avg": 1373,
      "p95": 1373,
      "total": 1373,
      "percent_total": 133
    },
    "microfetch::desktop::get_desktop_info": {
      "calls": 1,
      "avg": 1693,
      "p95": 1693,
      "total": 1693,
      "percent_total": 164
    },
    "microfetch::release::get_system_info": {
      "calls": 1,
      "avg": 7324,
      "p95": 7327,
      "total": 7324,
      "percent_total": 710
    },
    "microfetch::system::get_username_and_hostname": {
      "calls": 1,
      "avg": 3156,
      "p95": 3157,
      "total": 3156,
      "percent_total": 306
    },
    "microfetch::system::get_root_disk_usage": {
      "calls": 1,
      "avg": 4759,
      "p95": 4759,
      "total": 4759,
      "percent_total": 461
    }
  }
}

@github-actions
Copy link

Performance Comparison

Total Elapsed Time: 867.36µs → 864.12µs (-0.4%)

Profiling Mode: alloc - Cumulative allocations during each function call (including nested calls).

+-----------------------------------------------+------------------+-----------------------------+-----------------------------+-----------------------------+------------------------------+
| Function                                      | Calls            | Avg                         | P95                         | Total                       | % Total                      |
+-----------------------------------------------+------------------+-----------------------------+-----------------------------+-----------------------------+------------------------------+
| microfetch::main                              | 1 → 1 (+0.0%)    | 2.8 KB → 381 B (-86.7%) 🚀  | 2.8 KB → 381 B (-86.7%) 🚀  | 2.8 KB → 381 B (-86.7%) 🚀  | 100.00% → 100.00% (+0.0%)    |
+-----------------------------------------------+------------------+-----------------------------+-----------------------------+-----------------------------+------------------------------+
| microfetch::system::get_root_disk_usage       | 1 → 1 (+0.0%)    | 64 B → 64 B (+0.0%)         | 64 B → 64 B (+0.0%)         | 64 B → 64 B (+0.0%)         | 2.24% → 16.79% (+649.6%) ⚠️  |
+-----------------------------------------------+------------------+-----------------------------+-----------------------------+-----------------------------+------------------------------+
| microfetch::colors::print_dots                | 1 → 1 (+0.0%)    | 64 B → 64 B (+0.0%)         | 64 B → 64 B (+0.0%)         | 64 B → 64 B (+0.0%)         | 2.24% → 16.79% (+649.6%) ⚠️  |
+-----------------------------------------------+------------------+-----------------------------+-----------------------------+-----------------------------+------------------------------+
| microfetch::system::get_memory_usage          | 1 → 1 (+0.0%)    | 64 B → 64 B (+0.0%)         | 64 B → 64 B (+0.0%)         | 64 B → 64 B (+0.0%)         | 2.24% → 16.79% (+649.6%) ⚠️  |
+-----------------------------------------------+------------------+-----------------------------+-----------------------------+-----------------------------+------------------------------+
| microfetch::system::get_username_and_hostname | 1 → 1 (+0.0%)    | 45 B → 39 B (-13.3%)        | 45 B → 39 B (-13.3%)        | 45 B → 39 B (-13.3%)        | 1.57% → 10.23% (+551.6%) ⚠️  |
+-----------------------------------------------+------------------+-----------------------------+-----------------------------+-----------------------------+------------------------------+
| microfetch::release::get_system_info          | 1 → 1 (+0.0%)    | 32 B → 32 B (+0.0%)         | 32 B → 32 B (+0.0%)         | 32 B → 32 B (+0.0%)         | 1.12% → 8.39% (+649.1%) ⚠️   |
+-----------------------------------------------+------------------+-----------------------------+-----------------------------+-----------------------------+------------------------------+
| microfetch::uptime::get_current               | 1 → 1 (+0.0%)    | 32 B → 32 B (+0.0%)         | 32 B → 32 B (+0.0%)         | 32 B → 32 B (+0.0%)         | 1.12% → 8.39% (+649.1%) ⚠️   |
+-----------------------------------------------+------------------+-----------------------------+-----------------------------+-----------------------------+------------------------------+
| microfetch::release::get_os_pretty_name       | 1 → 1 (+0.0%)    | 18 B → 18 B (+0.0%)         | 18 B → 18 B (+0.0%)         | 18 B → 18 B (+0.0%)         | 0.63% → 4.72% (+649.2%) ⚠️   |
+-----------------------------------------------+------------------+-----------------------------+-----------------------------+-----------------------------+------------------------------+
| microfetch::desktop::get_desktop_info         | 1 → 1 (+0.0%)    | 17 B → 17 B (+0.0%)         | 17 B → 17 B (+0.0%)         | 17 B → 17 B (+0.0%)         | 0.59% → 4.46% (+655.9%) ⚠️   |
+-----------------------------------------------+------------------+-----------------------------+-----------------------------+-----------------------------+------------------------------+
| microfetch::system::get_shell                 | 1 → 1 (+0.0%)    | 13 B → 4 B (-69.2%) 🚀      | 13 B → 4 B (-69.2%) 🚀      | 13 B → 4 B (-69.2%) 🚀      | 0.45% → 1.04% (+131.1%) ⚠️   |
+-----------------------------------------------+------------------+-----------------------------+-----------------------------+-----------------------------+------------------------------+
| microfetch::system::parse_memory_info         | 1 → 1 (+0.0%)    | 0 B → 0 B (+0.0%)           | 0 B → 0 B (+0.0%)           | 0 B → 0 B (+0.0%)           | 0.00% → 0.00% (+0.0%)        |
+-----------------------------------------------+------------------+-----------------------------+-----------------------------+-----------------------------+------------------------------+
| microfetch::print_system_info                 | 1 → 1 (+0.0%)    | 2.4 KB → 0 B (-100.0%) 🚀   | 2.4 KB → 0 B (-100.0%) 🚀   | 2.4 KB → 0 B (-100.0%) 🚀   | 86.12% → 0.00% (-100.0%) 🚀  |
+-----------------------------------------------+------------------+-----------------------------+-----------------------------+-----------------------------+------------------------------+

Generated with hotpath-rs

📊 View Raw JSON Metrics

PR Metrics

{
  "hotpath_profiling_mode": "alloc",
  "total_elapsed": 864124,
  "description": "Cumulative allocations during each function call (including nested calls).",
  "caller_name": "microfetch::main",
  "output": {
    "microfetch::system::parse_memory_info": {
      "calls": 1,
      "avg": 0,
      "p95": 0,
      "total": 0,
      "percent_total": 0
    },
    "microfetch::print_system_info": {
      "calls": 1,
      "avg": 0,
      "p95": 0,
      "total": 0,
      "percent_total": 0
    },
    "microfetch::main": {
      "calls": 1,
      "avg": 381,
      "p95": 381,
      "total": 381,
      "percent_total": 10000
    },
    "microfetch::release::get_system_info": {
      "calls": 1,
      "avg": 32,
      "p95": 32,
      "total": 32,
      "percent_total": 839
    },
    "microfetch::system::get_shell": {
      "calls": 1,
      "avg": 4,
      "p95": 4,
      "total": 4,
      "percent_total": 104
    },
    "microfetch::system::get_root_disk_usage": {
      "calls": 1,
      "avg": 64,
      "p95": 64,
      "total": 64,
      "percent_total": 1679
    },
    "microfetch::system::get_username_and_hostname": {
      "calls": 1,
      "avg": 39,
      "p95": 39,
      "total": 39,
      "percent_total": 1023
    },
    "microfetch::desktop::get_desktop_info": {
      "calls": 1,
      "avg": 17,
      "p95": 17,
      "total": 17,
      "percent_total": 446
    },
    "microfetch::uptime::get_current": {
      "calls": 1,
      "avg": 32,
      "p95": 32,
      "total": 32,
      "percent_total": 839
    },
    "microfetch::colors::print_dots": {
      "calls": 1,
      "avg": 64,
      "p95": 64,
      "total": 64,
      "percent_total": 1679
    },
    "microfetch::release::get_os_pretty_name": {
      "calls": 1,
      "avg": 18,
      "p95": 18,
      "total": 18,
      "percent_total": 472
    },
    "microfetch::system::get_memory_usage": {
      "calls": 1,
      "avg": 64,
      "p95": 64,
      "total": 64,
      "percent_total": 1679
    }
  }
}

Main Branch Metrics

{
  "hotpath_profiling_mode": "alloc",
  "total_elapsed": 867359,
  "description": "Cumulative allocations during each function call (including nested calls).",
  "caller_name": "microfetch::main",
  "output": {
    "microfetch::system::get_root_disk_usage": {
      "calls": 1,
      "avg": 64,
      "p95": 64,
      "total": 64,
      "percent_total": 224
    },
    "microfetch::system::get_shell": {
      "calls": 1,
      "avg": 13,
      "p95": 13,
      "total": 13,
      "percent_total": 45
    },
    "microfetch::system::get_memory_usage": {
      "calls": 1,
      "avg": 64,
      "p95": 64,
      "total": 64,
      "percent_total": 224
    },
    "microfetch::main": {
      "calls": 1,
      "avg": 2855,
      "p95": 2855,
      "total": 2855,
      "percent_total": 10000
    },
    "microfetch::desktop::get_desktop_info": {
      "calls": 1,
      "avg": 17,
      "p95": 17,
      "total": 17,
      "percent_total": 59
    },
    "microfetch::system::parse_memory_info": {
      "calls": 1,
      "avg": 0,
      "p95": 0,
      "total": 0,
      "percent_total": 0
    },
    "microfetch::system::get_username_and_hostname": {
      "calls": 1,
      "avg": 45,
      "p95": 45,
      "total": 45,
      "percent_total": 157
    },
    "microfetch::print_system_info": {
      "calls": 1,
      "avg": 2459,
      "p95": 2459,
      "total": 2459,
      "percent_total": 8612
    },
    "microfetch::colors::print_dots": {
      "calls": 1,
      "avg": 64,
      "p95": 64,
      "total": 64,
      "percent_total": 224
    },
    "microfetch::release::get_os_pretty_name": {
      "calls": 1,
      "avg": 18,
      "p95": 18,
      "total": 18,
      "percent_total": 63
    },
    "microfetch::release::get_system_info": {
      "calls": 1,
      "avg": 32,
      "p95": 32,
      "total": 32,
      "percent_total": 112
    },
    "microfetch::uptime::get_current": {
      "calls": 1,
      "avg": 32,
      "p95": 32,
      "total": 32,
      "percent_total": 112
    }
  }
}

Copy link
Owner

@NotAShelf NotAShelf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@NotAShelf NotAShelf merged commit 927dce4 into NotAShelf:main Dec 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants