Skip to content

Instantly share code, notes, and snippets.

View denstad's full-sized avatar

CC denstad

  • Oslo
View GitHub Profile
@denstad
denstad / 01-startup.sh
Created May 16, 2026 17:33
Bun Zig vs Rust benchmarks — 2 days post-port-merge (2026-05-16)
#!/usr/bin/env bash
set -euo pipefail
HERE="$(cd "$(dirname "$0")/.." && pwd)"
ZIG="$HERE/zig/bun"
RUST="$HERE/rust/bun"
RESULTS="$HERE/results"
echo "=== Cold startup: bun -e '1' ==="
hyperfine --warmup 5 --runs 100 --shell=none \
--export-json "$RESULTS/01-startup.json" \
| Method | Length | Ticks | Mean | Error | StdDev | Ratio | RatioSD | Gen0 | Allocated | Alloc Ratio |
|------------------------------------------------- |------- |------ |---------------:|--------------:|--------------:|------:|--------:|-------:|----------:|------------:|
| List_Tick_InsertFront_RemoveTail_ThenTraverse | 10 | 64 | 1,091.3 ns | 9.17 ns | 8.58 ns | 1.00 | 0.01 | - | - | NA |
| LinkedList_Tick_AddFirst_RemoveLast_ThenTraverse | 10 | 64 | 1,205.3 ns | 13.14 ns | 12.29 ns | 1.10 | 0.01 | 0.3662 | 3072 B | NA |
| Ring_Tick_PushHead_PopTail_ThenTraverse | 10 | 64 | 366.6 ns | 2.69 ns | 2.38 ns | 0.34 | 0.00 | - | - | NA |
| List_Traversal_Only | 10 | 64 | 429.6 ns | 2.42 ns | 2.14 ns | 0.39 | 0.00 | - | - |
/// <summary>
/// https://stackoverflow.com/questions/12803012/fire-and-forget-with-async-vs-old-async-delegate
/// </summary>
/// <param name="task"></param>
public static async void FireAndForget(this Task task, ILogger logger)
{
try
{
RequestContext.Set("FF", true);
await task;
@denstad
denstad / Style.ux
Created November 8, 2015 12:34
One way to create watermark to TextInput in Fuse with just UX
<Style>
<TextInput
ux:InheritStyle="false"
ux:Name="_sdtextInput"
TextColor="0,0,0,1"
Padding="0,0,0,16"
Margin="8,8,8,8"
FontSize="16"
Font="LatoRegular"
HitTestMode="LocalBoundsAndChildren"
{ "responseData":
[
{
"author": "Hermione Robinson",
"portrait": "http://www.lightstalking.com/wp-content/uploads/2010/02/square.jpg",
"location": "Leicester, 12km",
"source": "nypost.com",
"postAge": "22 min",
"imageUrl": "http://i.ytimg.com/vi/mPyYEqYSo9A/maxresdefault.jpg",
"headline": "Melissa McCarthy's James Bond spoof 'Spy' is hit-and-miss",