<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Farzon's blog]]></title><description><![CDATA[Farzon's blog]]></description><link>https://codeblog.farzon.org</link><image><url>https://cdn.hashnode.com/uploads/logos/69f30a5b909e64ad078554d7/02e4698a-cbc4-40cd-85eb-0821784e3a9c.jpg</url><title>Farzon&apos;s blog</title><link>https://codeblog.farzon.org</link></image><generator>RSS for Node</generator><lastBuildDate>Mon, 08 Jun 2026 05:39:39 GMT</lastBuildDate><atom:link href="https://codeblog.farzon.org/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[The Geometry of Dragon Ball: A Deep Dive into SDFs and Raymarching]]></title><description><![CDATA[Today we are deconstructing the 4-Star Dragon Ball shader (available on Shadertoy here). This shader is a good example of using 2D math to drive 3D optical effects. To understand it, we must reference]]></description><link>https://codeblog.farzon.org/dragonball-shader</link><guid isPermaLink="true">https://codeblog.farzon.org/dragonball-shader</guid><category><![CDATA[shader]]></category><category><![CDATA[Caustics]]></category><category><![CDATA[reflection]]></category><category><![CDATA[light-refraction]]></category><category><![CDATA[GLSL]]></category><category><![CDATA[shadertoy]]></category><category><![CDATA[2d]]></category><category><![CDATA[3d]]></category><category><![CDATA[sdf]]></category><category><![CDATA[raymarching]]></category><dc:creator><![CDATA[Farzon Lotfi]]></dc:creator><pubDate>Sat, 02 May 2026 18:55:46 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/69f30a5b909e64ad078554d7/e7f816ae-c4ad-455d-a15a-d3ce628428a4.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Today we are deconstructing the 4-Star Dragon Ball shader (available on <a href="https://www.shadertoy.com/view/7c2SWc">Shadertoy here</a>). This shader is a good example of using 2D math to drive 3D optical effects. To understand it, we must reference the fundamental building blocks provided by <a href="https://iquilezles.org/"><strong>Inigo Quilez</strong></a>.</p>
<p>This shader is more than just a piece of fan art. I built this <a href="https://www.shadertoy.com/view/7c2SWc">4-Star Dragon Ball shader</a> as a bridge between simple 2D shapes and complex 3D optics. If you’re looking for an introductory shader to study, this is a perfect playground because it moves past "drawing a box" and dives into how light behaves. What makes this unique as a case study is the Double March. We are treating the sphere as a physical lens. Once you hit the "glass," the shader calculates a bent path and starts a second march inside. It’s my attempt at playing with coordinate transformation.</p>
<img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgf-d4EdI0mI9bmQ-bSkQzmLyn35eanCLYKBOS4Eg4fbCrWg0sQxhWafOlqlzKviKLhjy0_oY0k4venvcYyBviO9fNyoLj0zCc-eUbH55Ub-sGyHL8FUzDZLtyjxmpn7_xrjhCn8XyJtXsonrPAA4eTW6HnGok3VbFB8W8YX_QNeQHScJAO4b-lYwYuW2c/s320/image.png" alt="The 4 star ball with Caustics" style="display:block;margin:0 auto" />

<h2>1. Defining the Stars (2D SDFs)</h2>
<p>The internal stars are defined using 2D Signed Distance Functions. an SDF is a function that takes a point in space and returns the distance to the nearest surface.</p>
<ul>
<li><p>If the distance is <strong>positive</strong> , you are outside the object.</p>
</li>
<li><p>If the distance is <strong>negative</strong> , you are inside.</p>
</li>
<li><p>If it is <strong>zero</strong> , you are exactly on the surface.</p>
</li>
</ul>
<p>This allows us to define perfect geometric shapes without textures. The specific star logic used here, <code>sdStar5</code>, is a direct implementation of Quilez's formulas found in his <a href="https://iquilezles.org/articles/distfunctions2d/">2D Distance Functions</a> article.</p>
<pre><code class="language-glsl">// Helper to map the 4 stars in 2D
float map4Stars2D(vec2 p) {
    float offset = 0.22;
    float radius = 0.15;
    float d1 = sdStar5(p - vec2(offset, offset), radius, 0.45);
    float d2 = sdStar5(p - vec2(-offset, offset), radius, 0.45);
    float d3 = sdStar5(p - vec2(offset, -offset), radius, 0.45);
    float d4 = sdStar5(p - vec2(-offset, -offset), radius, 0.45);
    return min(min(d1, d2), min(d3, d4)); // Union of all four stars
}
</code></pre>
<h2>2. Extrusion and 3D Modeling</h2>
<p>To turn these flat stars into 3D geometry inside the sphere, we use <a href="https://ansyshelp.ansys.com/public/account/secured?returnurl=/Views/Secured/corp/v251/en/poly_pftut/pf_train_3d-extru.html"><strong>Extrusion</strong></a>. By combining the 2D distance with the Z-axis, we create a volumetric shape. This technique, along with the rounding (beveling) seen in the code, is detailed in Quilez’s <a href="https://iquilezles.org/articles/distfunctions/">3D Distance Functions</a> article.</p>
<pre><code class="language-glsl">float mapStars3D(vec3 p) {
    float d2d = map4Stars2D(p.xy);
    vec2 w = vec2(d2d, abs(p.z) - 0.04); // abs(p.z) defines thickness
    return min(max(w.x, w.y), 0.0) + length(max(w, 0.0)) - 0.015;
}
</code></pre>
<h2>3. The Raymarching Engine</h2>
<p>How does the computer "see" these math functions? For a short intro think of it this way. Since we don't have triangles, we can't use standard rasterization. Instead, we use <a href="https://en.wikipedia.org/wiki/Ray_marching"><strong>Raymarching</strong></a>.</p>
<p>Imagine firing a ray from your eye through every pixel. Instead of moving in tiny constant steps, the ray "leaps" forward by the distance returned by our SDF. Because the SDF tells us the distance to the <em>nearest</em> object, we know it's safe to move that far without hitting anything. We repeat this until the distance is nearly zero (a hit!) or we've gone too far (a miss).</p>
<p>For a full deep dive into the algorithm that powers almost every modern Shadertoy, read Quilez's <a href="https://iquilezles.org/articles/raymarchingdf/">Raymarching Distance Fields</a>.</p>
<p>In our code, this is the loop that "steps" through space until it finds the sphere or the floor.</p>
<pre><code class="language-glsl">for(int i = 0; i &lt; MAX_STEPS; i++) {
    p = ro + rd * dO; // Current position along the ray
    dS = map(p); // Distance to nearest object
    dO += dS.x; // "Safe" jump forward
    if(dO &gt; MAX_DIST || abs(dS.x) &lt; SURF_DIST) break;
}
</code></pre>
<h2>4. Optical Physics: Refraction &amp; Reflection</h2>
<p>To simulate glass, we don't just "draw" it; we simulate how light behaves at the boundary of two materials.</p>
<ul>
<li><p><a href="https://en.wikipedia.org/wiki/Fresnel_equations"><strong>Fresnel Effect</strong></a>: We use the dot product of our view ray and the surface normal to decide if we see the interior (refraction) or the exterior (reflection).</p>
</li>
<li><p><strong>The Nested March</strong>: When the ray enters the sphere, it bends. The code then starts a <em>new</em> internal raymarch loop. This is what allows the stars to look magnified and distorted by the glass.</p>
</li>
</ul>
<pre><code class="language-glsl">vec3 refractDir = refract(rd, n, 1.0 / 1.52); // Bending light into glass
// ... inside the sphere ...
float volumetricGlow = exp(-minStarDist * 18.0); // Creates that resin-like haze
refractCol += emissiveStar * volumetricGlow * 0.45;
</code></pre>
<h2>5. Analytical Caustics &amp; Chromatic Aberration</h2>
<p>The glowing star patterns on the floor are <a href="https://en.wikipedia.org/wiki/Caustic_(optics)"><strong>caustics</strong></a>. <strong>Caustics</strong> are those dancing, wavy patterns of light you see at the bottom of a swimming pool or the bright "ring" at the base of a wine glass. They happen whenever a curved, transparent surface like water or a glass ball acts as a lens, grabbing scattered light rays and bunching them together into concentrated, glowing shapes.</p>
<img src="https://upload.wikimedia.org/wikipedia/commons/8/8e/Kaustik.jpg" alt="Caustics example from Wikipedia" style="display:block;margin:0 auto" />

<p>I achieve this by using <code>iSphere</code> to project the floor's coordinates back into the star field.</p>
<p>To add realism, I implement **<a href="https://en.wikipedia.org/wiki/Chromatic_aberration">Chromatic Aberration</a> **splitting the light into R, G, and B components by shifting the UV samples slightly.</p>
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/a/aa/Chromatic_aberration_lens_diagram.svg/3840px-Chromatic_aberration_lens_diagram.svg.png" alt="Chromatic Aberration example from Wikipedia" style="display:block;margin:0 auto" />

<p><strong>Chromatic Aberration</strong> is a lens effect that creates a "rainbow fringe" around sharp edges. It happens because glass doesn't bend all colors of light equally; red light bends a little less than blue light. In a shader, you mimic this by "splitting" the image into its red, green, and blue components and shifting them slightly so they don't perfectly line up, giving the scene a realistic, cinematic look.</p>
<pre><code class="language-glsl">float shift = 0.015; 
float dR = map4Stars2D(distortedUV * (1.0 - shift));
float dG = map4Stars2D(distortedUV);
float dB = map4Stars2D(distortedUV * (1.0 + shift));
vec3 starShadow = vec3(smoothstep(0.03, -0.03, dR), ...);
</code></pre>
<h2>The "Secret Sauce": Why This Works</h2>
<p>The uniqueness of this shader lies in its **layered approach**. It isn't just one distance field; it’s a coordinate-space transformation. By distorting the UVs on the floor (<code>distortedUV</code>), I simulate the way a magnifying glass bends light, creating a dynamic caustic pool that responds to the pulsing of the internal emissive stars. I was really trying my best to simulate the below image.</p>
<img src="https://blogger.googleusercontent.com/img/a/AVvXsEgq4QNxZLFMfz0_F4i7XaJqMOMdabDFmX7oO-QaIVJAJj52ID8ClM8hstPPAkEwiM9Qon8SkuyYX0lVVmG9gkxrF1tCB5T_EAIpH04IdB-kClIxT9jglYIILuGZcREmBy7JbV72EfmAdWs6BigPA4sifIlgTrZWNVWi8ktaSlsznEDpQ3yuHhwGvwS58k0" alt="Toy glass dragon ball you can buy from Amazon" style="display:block;margin:0 auto" />

<h2>Conclusion</h2>
<p>Writing shaders is about translating the laws of physics into the language of mathematics. By combining Inigo Quilez’s SDFs with Raymarching, you can build complex, beautiful worlds with nothing but a few lines of GLSL.</p>
<p><strong>References &amp; Further Reading:</strong> </p>
<ul>
<li><a href="https://iquilezles.org/articles/raymarchingdf/">Raymarching Distance Fields (Quilez)</a>  </li>
<li><a href="https://iquilezles.org/articles/distfunctions/">3D Distance Functions (Quilez)</a>  </li>
<li><a href="https://iquilezles.org/articles/distfunctions2d/">2D Distance Functions (Quilez)</a></li>
<li><a href="https://www.shadertoy.com/view/7c2SWc">4-Star Dragon Ball by Me (Noztol)</a></li>
<li><a href="https://www.instagram.com/noztol_shades">noztol_shades instagram</a></li>
</ul>
<blockquote>
<p>First published 5/2/2026 on <a href="https://blog.farzon.org/2026/05/the-geometry-of-dragon-ball-deep-dive.html">blog.farzon.org</a></p>
</blockquote>
]]></content:encoded></item><item><title><![CDATA[From Sidelined to Streamlined: Cracking the Code (Part 2)]]></title><description><![CDATA[In Part 1, I talked about the high-level "magic" happening on your wrist. How Apple uses neural networks and math to guess your VO2Max even when you’re just walking around the block. But if you're lik]]></description><link>https://codeblog.farzon.org/from-sidelined-to-streamlined-cracking-the-code-part-2</link><guid isPermaLink="true">https://codeblog.farzon.org/from-sidelined-to-streamlined-cracking-the-code-part-2</guid><category><![CDATA[Apple]]></category><category><![CDATA[AppleHealth]]></category><category><![CDATA[iphone]]></category><category><![CDATA[Python]]></category><dc:creator><![CDATA[Farzon Lotfi]]></dc:creator><pubDate>Sat, 02 May 2026 08:09:59 GMT</pubDate><content:encoded><![CDATA[<p>In <a href="https://blog.farzon.org/2026/04/from-sidelined-to-streamlined-decoding.html">Part 1</a>, I talked about the high-level "magic" happening on your wrist. How Apple uses neural networks and math to guess your VO2Max even when you’re just walking around the block. But if you're like me, "trusting papers" isn't enough. I wanted to get my hands on the raw numbers to see the "Prediction Delta" for myself</p>
<p>The problem? When you hit "<em>Export Health Data</em>" on your iPhone, you don’t get a clean spreadsheet. You get a giant, messy folder full of scary XML files.</p>
<p><img src="https://blogger.googleusercontent.com/img/a/AVvXsEjVhpl3u3sXHKghuJFwixZP9Nbs7NwM7DQjImNX1-H-Lwuj9NlEEA8_9-ji8sHZHJv8enaoTaewi7PZP88VuTlZInNnsHoWIvKJZ5zOEMvLK_eI0R_eIu8bgu-gBIcbZTdMl0JoYx_LOp8SjImvhInURW72IFA3IujcPi9RE4vSrM5tLH6xGTN0zAwBxiw" alt="How to export Apple health data" /></p>
<p>Here’s how I tackled the two biggest data hurdles in the export: the massive health records and the hidden workout GPS paths.</p>
<h2>Streaming the "Heavyweight" (The CDA File)</h2>
<p>Inside your export, there's a file called <code>export_cda.xml</code>. This is where the "clinical" stuff lives. For example The  second-by-second Heart Rate and Blood Oxygen levels we will use to compute a VO2Max.</p>
<p>The catch? This file can easily be 300MB or more. If you try to open that in a normal text editor or a basic script, your computer will probably hang. To get around this, I wrote a "streaming" parser. Instead of loading the whole file at once, it reads it one tiny piece at a time, grabs what it needs, and then throws the rest away.</p>
<p><strong>The "Secret Sauce" in the Code</strong>:</p>
<ul>
<li><strong>LOINC Codes</strong>: I told the script to ignore everything except two specific ID numbers: <code>8867-4</code> for Heart Rate and <code>2710-2</code> for Blood Oxygen.</li>
<li><strong>Cleaning the Mess</strong>: Apple records Oxygen as a decimal (like <code>0.98</code>), so I had the script multiply that by 100 to make it a readable percentage.</li>
<li><strong>Memory Management</strong>: By using <code>elem.clear()</code>, the script stays fast and light, no matter how many years of data you've collected.</li>
</ul>
<h2>Hunting for Your Routes (The GPX Files)</h2>
<p>If you’ve ever looked at your workout map in the Fitness app and wondered where that data lives, it's in the <code>workout-routes/</code> folder. Every time you track a walk or run, Apple generates a <code>.gpx</code> file.</p>
<p>These files are great because they contain the "Environmental Kinematics"—the pace, distance, and topography that Apple uses to validate your fitness.</p>
<h3><strong>What my GPX Parser does</strong>:</h3>
<p>It loops through every file in that folder and extracts more than just your GPS coordinates. It calculates:</p>
<ul>
<li><strong>The "Verticality"</strong>: It finds the highest and lowest points to see how much of a hill you actually climbed.</li>
<li><strong>The Pace</strong>: It pulls the speed data directly recorded by the watch sensors.</li>
<li><strong>The Duration</strong>: It calculates exactly how long you were moving by comparing the first and last timestamps.</li>
</ul>
<h2>Why do we need this data?</h2>
<p>When these two scripts finish running, that mountain of XML files is transformed into a few clean CSV files. Now, instead of staring at raw code, I have a clear spreadsheet of my rehab walks.</p>
<p>I can see exactly how my heart rate reacted to that one steep hill, and more importantly, I have the "Data Diet" ready to feed into my own model.</p>
<p>Grab the code <a href="https://gist.github.com/farzonl/8ed72ce833d91de1c44dfd8d5072bd4d">here</a>.</p>
<p><strong>Coming up in Part 3:</strong> We finally get to the fun part. I’m taking these CSVs into a Jupyter Notebook to build my own Multi-Layer Perceptron (MLP). We’re going to see if my DIY "Watch Brain" comes up with the same VO2Max scores as Apple's. Stay tuned!</p>
<blockquote>
<p>First published 4/12/26 on <a href="https://blog.farzon.org/2026/04/from-sidelined-to-streamlined-cracking.html">blog.farzon.org</a></p>
</blockquote>
]]></content:encoded></item><item><title><![CDATA[From Sidelined to Streamlined: Decoding My Apple Watch Metrics (Part 1)]]></title><description><![CDATA[I am a data junkie. I track, measure, and optimize. So, when a severe ankle injury recently sidelined me, the hardest part wasn't the physical pain it was watching my hard earned fitness metrics plumm]]></description><link>https://codeblog.farzon.org/from-sidelined-to-streamlined-decoding-my-apple-watch-metrics-part-1</link><guid isPermaLink="true">https://codeblog.farzon.org/from-sidelined-to-streamlined-decoding-my-apple-watch-metrics-part-1</guid><category><![CDATA[Apple]]></category><category><![CDATA[MLP]]></category><category><![CDATA[multi layer perceptron]]></category><category><![CDATA[neural networks]]></category><category><![CDATA[VO2max]]></category><dc:creator><![CDATA[Farzon Lotfi]]></dc:creator><pubDate>Sat, 02 May 2026 07:47:19 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/69f30a5b909e64ad078554d7/e3448172-ef0b-4a1e-8a38-562e130ec793.webp" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>I am a data junkie. I track, measure, and optimize. So, when a severe ankle injury recently sidelined me, the hardest part wasn't the physical pain it was watching my hard earned fitness metrics plummet while I sat powerless on the sidelines.</p>
<img src="https://blogger.googleusercontent.com/img/a/AVvXsEhNWBhlwkZsijRIUGc1LFKmrOsDXpcK-5Zd0VsSILWKg2BAy-PBd7J2yntquh_8Z3ZNX4Ujy67W0CAhhhMdTXkj4FJj__Ve5tiHehP5nhi3IQuJz_ui2Gef5oNeczRX3jTUc9cIpkiylFEqM2qspD8p1a35k48ceiTpIZEx4BFZ02mfL2zcXPgMdjEeDXo" alt="My Apple Health VO2Max" style="display:block;margin:0 auto" />

<p>For the last five weeks, I’ve been cleared to walk. My "North Star" for this comeback? <a href="https://en.wikipedia.org/wiki/VO2_max"><strong>VO2 Max</strong></a>. I’ve watched the numbers slowly climb back toward my peak, but it raised a nagging question: Can I trust the data? Since I can’t wear a clinical oxygen mask on my neighborhood rehab walks, I’m relying on my Apple Watch. I needed to know exactly how a wrist-worn sensor measures elite-level fitness when I’m barely breaking a sweat.</p>
<h2>The Magic/Math on Your Wrist: ODEs and Neural Networks</h2>
<p>The Apple Watch doesn’t just use a basic lookup table. According to technical breakdowns from Empirical Health and Apple’s 2021 Whitepaper, the watch utilizes a sophisticated blend of Ordinary Differential Equations (ODEs) and Deep Neural Networks.</p>
<p>Instead of just checking your heart rate at a specific pace, the algorithm is constantly <em>predicting</em> what your heart rate should be based on your workload. By measuring the <strong>"Prediction Delta"</strong>; the gap between your predicted and actual heart rate is how the neural network learns your exact cardiovascular efficiency.</p>
<h3>The Data Diet</h3>
<p>To calculate this, the "brain" on your wrist consumes three specific streams of data:</p>
<ol>
<li><p><strong>The Biometric Baseline</strong>: Your age, sex, and weight</p>
</li>
<li><p><strong>Environmental Kinematics</strong>: GPS-tracked pace and distance combined with topography. The watch only validates data on relatively flat ground (under a 5% grade).</p>
</li>
<li><p><strong>Physiological Telemetry</strong>: Continuous heart rate data from the photoplethysmograph (PPG) sensor.</p>
</li>
</ol>
<h2>The "Submaximal" Secret: Why Rehab Walks Count</h2>
<p>The brilliance of Apple’s design is its focus on <strong>submaximal validation.</strong> Traditionally, wearables were terrible at estimating VO2 Max unless you were sprinting. But for someone recovering from an injury, high-intensity effort is off the table.</p>
<p>Physiologically, heart rate and oxygen consumption scale proportionately. Because this relationship is linear, the watch can track a brisk walk and mathematically project that trendline up to your theoretical maximum. You only need to hit an exertion threshold of <strong>30% above your resting heart rate</strong> for the algorithm to "get enough" data to extrapolate your score.</p>
<h2>Trusting the Data: What the Science Says</h2>
<p>As a skeptic, I looked at the recent literature to see if the marketing holds up to peer review:</p>
<ul>
<li><p><strong>The PLOS One Study (2025):</strong> Recent validation tests found the Apple Watch to be a highly reliable proxy for clinical cardiopulmonary testing, though it tended to slightly underestimate VO2 Max in highly fit individuals.</p>
</li>
<li><p><strong>The Nature Meta-Analysis (2026):</strong> A massive systematic review in <em>npj Digital Medicine</em> (covering 430,000+ participants) confirmed that while "edge case" heart rate data can vary, the Apple Watch maintains high reliability for core physiological metrics.</p>
</li>
</ul>
<p><strong>The takeaway for my rehab:</strong> The absolute number on my wrist might be off by a fraction of a point compared to a $10,000 lab cart, but the <em>trend</em> is highly accurate. And right now, the trend is all that matters.</p>
<h2>Reverse-Engineering the Logic</h2>
<p>Reading whitepapers is one thing; building the logic is another. To truly understand the "black box" on my wrist, I decided to spin up a Jupyter Notebook.</p>
<p>I wanted to see if I could recreate the watch’s logic using a simple <a href="https://en.wikipedia.org/wiki/Multilayer_perceptron"><strong>Multi-Layer Perceptron (MLP)</strong></a> in Python to simulate my 20-minute rehab walks.</p>
<ul>
<li><p><a href="https://blog.farzon.org/2026/04/from-sidelined-to-streamlined-cracking.html"><strong>Stay tuned for Part 2, where I will show how to export the data off of your iPhone's Apple Health App</strong></a><strong>.</strong></p>
</li>
<li><p><strong>And Part 3 where I break down the code and see if my DIY algorithm matches Apple's output.</strong></p>
</li>
</ul>
<hr />
<p><strong>References:</strong></p>
<ul>
<li><p><a href="https://www.apple.com/healthcare/docs/site/Using_Apple_Watch_to_Estimate_Cardio_Fitness_with_VO2_max.pdf"><em>Apple (2021). "Using Apple Watch to Estimate Cardio Fitness with VO2 max"</em></a></p>
</li>
<li><p><a href="https://www.apple.com/newsroom/pdfs/Health-Report-October-2023.pdf">Apple (223). "Empowering people to live a healthier day Innovation using Apple technology to support personal health, research, and care"</a></p>
</li>
<li><p><a href="https://pubmed.ncbi.nlm.nih.gov/40373042/">Rory Lambe PLOS (2025) "Investigating the accuracy of Apple Watch VO2 max measurements: A validation study"</a></p>
</li>
<li><p><a href="https://www.nature.com/articles/s41746-025-02238-1">Rory Lambre Nature (2026) "The accuracy of Apple Watch measurements: a living systematic review and meta-analysis"</a></p>
</li>
</ul>
<blockquote>
<p>First published 4/11/26 on <a href="https://blog.farzon.org/2026/04/from-sidelined-to-streamlined-decoding.html">blog.farzon.org</a></p>
</blockquote>
]]></content:encoded></item><item><title><![CDATA[An Android Fuzzing Retrospective Part II: The "Single-VM" Theory and the Bionic Wall]]></title><description><![CDATA[In my previous post, I detailed how our move from the Android Emulator to standalone Android-x86 VHDX images gave us impressive cost saving wins for our fuzzing budget. With any infrastructure pivot, ]]></description><link>https://codeblog.farzon.org/an-android-fuzzing-retrospective-part-ii-the-single-vm-theory-and-the-bionic-wall</link><guid isPermaLink="true">https://codeblog.farzon.org/an-android-fuzzing-retrospective-part-ii-the-single-vm-theory-and-the-bionic-wall</guid><category><![CDATA[Android]]></category><category><![CDATA[Androidx86,]]></category><category><![CDATA[bionic]]></category><category><![CDATA[chroot]]></category><category><![CDATA[ChrootOnAndroid]]></category><dc:creator><![CDATA[Farzon Lotfi]]></dc:creator><pubDate>Sat, 02 May 2026 06:59:05 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/69f30a5b909e64ad078554d7/98592934-6747-498e-a369-685f3b998dbd.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In my <a href="https://blog.farzon.org/2026/04/a-retrospective-on-fuzzing-edge-for.html">previous post</a>, I detailed how our move from the Android Emulator to standalone Android-x86 VHDX images gave us impressive cost saving wins for our fuzzing budget. With any infrastructure pivot, the moment we finished it, we started looking for ways to optimize it further. The plan would have been to collapse our two-VM Producer/Consumer model into a <strong>single-VM footprint.</strong></p>
<p>Our next major architectural pivot would have been using <a href="https://wiki.debian.org/ChrootOnAndroid">ChrootOnAndroid</a> to host both the web server based fuzzer and Edge on one kernel. However, our prototypes hit three massive walls: <strong>Bionic libc</strong> , <strong>Filesystem Permissions</strong> , and the <strong>Bootloader Logic</strong> of Android itself.</p>
<h3>The Theoretical Efficiency: Debian via Chroot</h3>
<p>The logic was simple: If we could run our Linux-based test-case generators (the Producer) inside a <strong>Debian Chroot</strong> on the same Android-x86 VM running Edge (the Consumer), we could effectively double our scale again.</p>
<p>By utilizing <strong>ChrootOnAndroid</strong> , we would have gained zero-latency fuzzing and unified compute, but we ran into deep-level technical hurdles that made it unfeasible for a production security pipeline.</p>
<h3>The Technical Blockers: Why We Didn't Ship</h3>
<h4>1. The Bionic vs. glibc Divide</h4>
<p>Android uses <strong>Bionic libc</strong> , while Debian relies on <strong>glibc</strong>. This is a recipe for hitting "Linker Hell." Debian looks for <code>/lib/ld-linux.so</code>, while Android looks for <code>/system/bin/linker</code>. Getting them to coexist requires more effort than I had the resources to devote to this problem.</p>
<h4>2. Filesystem Permission Paradigms</h4>
<p>Debian follows a traditional Linux user model (Root=0), but Android uses a <strong>Sandbox model</strong> where every app has a unique UID. We found that the Debian fuzzer would try to  write test cases to a shared folder, but Android would hit an <code>EACCES</code> (Permission Denied) error because the Android filesystem didn't recognize the Debian "user."</p>
<h4>3. The Bootloader and the <code>mmcblk0p3</code> Trap</h4>
<p>Perhaps the most significant hurdle for our automation was the hardware's boot logic. To get a clean Debian environment, we often had to mess with kernel boot arguments via <code>fastboot</code>.</p>
<p>We spent days debugging errors related to <code>/dev/mmcblk0p3</code>. In Linux/Android, storage is represented as files. By passing <code>root=/dev/mmcblk0p3</code>, we were telling the kernel: <em>"Ignore the standard Android system partition; look at Partition 3 of the internal eMMC for the Debian rootfs."</em></p>
<p><strong>This failed for two reasons:</strong></p>
<ul>
<li><p><strong>Partition Drift</strong>: On modern devices, <code>p3</code> is often metadata or info, not the actual rootfs. We had to use <code>cat /proc/partitions</code> just to find where we were.</p>
</li>
<li><p><strong>The "Live" Limitation</strong>: Using <code>fastboot boot</code> only loads the kernel into RAM. It doesn't persist. For a cloud-scale fuzzing fleet, we couldn't manually inject <code>fastboot -c</code> arguments every time a VM rebooted. Flashing the kernel permanently was too risky; if the Debian build wasn't perfect, the VM would enter a boot loop, killing our uptime.</p>
</li>
</ul>
<h3>Areas for Potential Research</h3>
<p>While we didn't implement the "Single-VM" model, it remains a high-value optimization for mobile security research. Future efforts should focus on:</p>
<ol>
<li><p><strong>Namespace Isolation</strong>: Using Linux Namespaces rather than just a simple chroot to provide better isolation while maintaining a single kernel.</p>
</li>
<li><p><strong>Permission Mapping</strong>: Implementing a custom FUSE mount to translate Android app UIDs to Debian-compatible permissions.</p>
</li>
<li><p><strong>Bootloader Orchestration</strong>: Building automation that can handle persistent kernel argument injection without requiring a manual <code>fastboot</code> session every reboot.</p>
</li>
</ol>
<h3>Final Thoughts</h3>
<p>Our pivot to Android-x86 was about cost constraints; the move to chroot would have been a nice to have optimization, but wasn't necessary. Fighting with fastboot for MultiMediaCard Block devies and Bionic linker errors just wasn't worth it for our team size, but that doesn't mean it couldn't be worth it for you.</p>
<blockquote>
<p>First published 4/29/26 on <a href="https://blog.farzon.org/2026/04/an-android-fuzzing-retrospective-part.html">blog.farzon.org</a></p>
</blockquote>
]]></content:encoded></item><item><title><![CDATA[A Retrospective on Fuzzing Edge for Android: Looking beyond the Emulator]]></title><description><![CDATA[When I was the head of Microsoft's Edge security for the US market, we ran into an infrastructure challenge that forced us to completely rethink how we fuzzed Android.
The project we built no longer e]]></description><link>https://codeblog.farzon.org/a-retrospective-on-fuzzing-edge-for-android-looking-beyond-the-emulator</link><guid isPermaLink="true">https://codeblog.farzon.org/a-retrospective-on-fuzzing-edge-for-android-looking-beyond-the-emulator</guid><category><![CDATA[Androidx86,]]></category><category><![CDATA[Azure]]></category><category><![CDATA[Edge Browser]]></category><category><![CDATA[fuzzing]]></category><dc:creator><![CDATA[Farzon Lotfi]]></dc:creator><pubDate>Sat, 02 May 2026 06:48:21 GMT</pubDate><content:encoded><![CDATA[<p>When I was the head of Microsoft's Edge security for the US market, we ran into an infrastructure challenge that forced us to completely rethink how we fuzzed Android.</p>
<p>The project we built no longer exists at Microsoft, and the <a href="https://www.android-x86.org/">Android-x86 project</a> we relied on is now officially dead and unsupported. However, the architectural pivot we made to get around cloud compute constraints remains a novel approach to Android fuzzing—one that solved a myriad of technical headaches while drastically cutting costs.</p>
<p>Here is a look back at how we bypassed the Android Emulator entirely to find better, real-world bugs.</p>
<h2>The Catalyst: Losing Nested Virtualization</h2>
<p>Fuzzing has always been a core focus of the Edge security posture. Using our own tooling alongside open-source frameworks, we achieved millions of fuzz hours per month across desktop environments. But doing this at scale for Android always presented unique friction.</p>
<p>In 2022, that friction hit a boiling point. Due to cost-cutting measures, our fuzzing budgets were reduced. We had to migrate off of public Azure to the Microsoft 365 substrate for both security and cost reasons. The unintended side effect of this migration was a severe reduction in our quota for CPU cores that supported <strong>nested virtualization</strong>.</p>
<p> <img src="https://i.imgur.com/iQRZp5c.png" alt="The Android Emulator works best with nested virtualization." /></p>
<p>Without nested virtualization, running the standard Android Emulator in the cloud was impossible. We needed a workaround.</p>
<h2>Why the Android Emulator Was Failing Us Anyway</h2>
<p>Losing the ability to run the emulator initially felt like a massive blow, but in retrospect, the emulator was already polluting our fuzzing efforts. When we fuzzed on the emulator, we spent a massive amount of time triaging crashes that had nothing to do with Edge.</p>
<p>The emulator suffered from several fatal flaws for our use case:</p>
<ul>
<li><strong>QEMU-Specific Code Paths</strong>: Many bugs we found hit <code>qemu</code>-specific emulation paths that a real-world mobile user would never actually experience.
 <img src="https://i.imgur.com/eHcSgKe.png" alt="Emulator bug not browser." /></li>
<li><strong>Driver Crashes</strong>: The emulator frequently hit <code>nvoglv64.dll</code>, an Nvidia driver bug that would simply crash the emulator outright.
 <img src="https://i.imgur.com/pQgS4K7.png" alt="nvoglv64.dll driver bugs" /></li>
<li><strong>The Swiftshader Timesink</strong>: The only way to stop the Nvidia crashes was to enable Swiftshader for the emulator. However, Google had already deprecated Swiftshader, meaning any bugs we found there were a complete waste of time to report or investigate.</li>
</ul>
<p>We needed a solution that tested real Android code paths, avoided emulation artifact bugs, and didn't require nested virtualization SKUs.</p>
<h2>The Solution: Direct-to-Azure Android-x86 VHDX Images</h2>
<p>To solve the compute constraint, we turned to the Android-x86 project. Instead of emulating Android hardware, we built Android-x86 <code>.vhdx</code> images and uploaded them directly to Azure to run as standalone VMs. (For a look at the mechanics of this, there is a great breakdown on <a href="https://mahsa-hanifi.medium.com/running-android-inside-azure-68977c687ff5">running Android inside Azure here</a>).</p>
<p> <img src="https://i.imgur.com/C7W9MR8.png" alt="A run of AndroidX86 in Azure" /></p>
<p>Because we were running standard VMs instead of nested virtualization SKUs, our compute costs plummeted. We could suddenly run <strong>two Android-x86 VMs for every one Android Emulator VM</strong> we previously ran.</p>
<p>In the short term, the development time required to create the images and establish communication protocols was slightly higher than just spinning up an emulator. But the image creation and communication processes ended up being a massive success. The long-term Azure cost reductions eventually set a model for the rest of Edge.</p>
<h2>Decoupling the Architecture</h2>
<p>Running standalone Android-x86 instances meant we could no longer run our test case generators, HTTP servers, and browser automation on the same VM as the target—something we took for granted on Windows and Linux.</p>
<p>To adapt, we decoupled the architecture. We built a new producer-consumer model where a robust Linux server handled the heavy lifting of generating test cases. The Android-x86 VMs acted purely as headless consumers, utilizing Mozilla's <a href="https://github.com/MozillaSecurity/grizzly/tree/android-rebase">Grizzly framework</a> to handle the browser automation.</p>
<p>Use of android adb tools worked really smoothly after all of this</p>
<p> <img src="https://i.imgur.com/fdq3dtT.png" alt="Android adb with Androidx86 vm on Hyper-V" /></p>
<p>By pushing our ASAN (AddressSanitizer) builds of the full Edge browser to these VMs, we maximized our chances of finding both security and reliability issues.</p>
<h2>The Takeaway</h2>
<p>Even though Android-x86 was an older version of Android than what was available via the emulator, the net result was surprising: we found more <em>real-world</em> bugs in the browser.</p>
<p> <img src="https://i.imgur.com/moYugL9.jpeg" alt="Bugs found on Androidx86" /></p>
<p>I even found one that someone beat me to fixing.</p>
<p> <img src="https://i.imgur.com/mHNGHqS.jpeg" alt="Bug I had a fix for" /></p>
<p>By being forced off of nested virtualization, we accidentally cured our emulator-noise problem. The project may be sunsetted today, but it stands as a great example of how strict budget and infrastructure constraints can force security teams to build leaner, smarter, and ultimately more effective testing environments.</p>
<blockquote>
<p>First published 4/25/26 on <a href="https://blog.farzon.org/2026/04/a-retrospective-on-fuzzing-edge-for.html">blog.farzon.org</a></p>
</blockquote>
]]></content:encoded></item><item><title><![CDATA[The "Warf" Way Part II: Tackling the macOS Frontier with osx-cross and Darling
]]></title><description><![CDATA[In my last post, The Warf Way: Seamless Windows Testing we looked at how to streamline Windows testing by leveraging Docker and Wine. It provided a seamless way to validate Windows-specific logic with]]></description><link>https://codeblog.farzon.org/the-warf-way-part-ii-tackling-the-macos-frontier-with-osx-cross-and-darling</link><guid isPermaLink="true">https://codeblog.farzon.org/the-warf-way-part-ii-tackling-the-macos-frontier-with-osx-cross-and-darling</guid><category><![CDATA[Apple]]></category><category><![CDATA[darling]]></category><category><![CDATA[Docker]]></category><category><![CDATA[Linux]]></category><dc:creator><![CDATA[Farzon Lotfi]]></dc:creator><pubDate>Sat, 02 May 2026 06:23:02 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/69f30a5b909e64ad078554d7/88cd061a-b9c5-4262-adac-8a6787ae6b8a.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In my last post, <a href="https://blog.farzon.org/2026/04/the-warf-way-seamless-windows-testing.html">The Warf Way: Seamless Windows Testing</a> we looked at how to streamline Windows testing by leveraging Docker and Wine. It provided a seamless way to validate Windows-specific logic without ever leaving the comfort of Linux. But as any cross-platform developer knows, Windows is only half the battle. The "Final Boss" of CI is almost always macOS.</p>
<p>Traditionally, testing for macOS meant maintaining expensive dedicated hardware or spinning up slow, proprietary VM instances in the cloud. Today, I'm excited to share a follow-up on how we are applying the "Warf Way" to Apple's ecosystem using <a href="https://github.com/tpoechtrager/osxcross">osx-cross</a> for compilation and <a href="https://www.darlinghq.org">Darling</a> for runtime testing. All packaged neatly inside <a href="https://github.com/farzonl/warfLang/blob/master/Dockerfile.osx-cross">Dockerfile.osx-cross</a></p>
<h2>The Challenge: Apple's Walled Garden</h2>
<p>Compiling for macOS from Linux is notoriously difficult due to the requirement of the macOS SDK and specific linker behaviors. Testing that code is even harder, as macOS binaries require a Mach-O compatible kernel.</p>
<h3>WARF's Next Step: Declarative macOS Pipelines</h3>
<p>The shift is subtle but important:</p>
<table>
<thead>
<tr>
<th>Stage</th>
<th>Old Model</th>
<th>WARF Model</th>
</tr>
</thead>
<tbody><tr>
<td>Compile</td>
<td>Native macOS machine</td>
<td>osxcross toolchain in Docker</td>
</tr>
<tr>
<td>Test</td>
<td>Physical/virtual macOS</td>
<td>Darling runtime in Docker</td>
</tr>
<tr>
<td>Orchestration</td>
<td>CI tied to hardware</td>
<td>Fully containerized pipeline</td>
</tr>
</tbody></table>
<p>To solve this, we are using three powerhouse open-source projects:</p>
<ul>
<li><strong>osx-cross</strong>: A toolchain that allows us to use <a href="https://github.com/llvm/llvm-project/tree/main/clang">Clang</a>/<a href="https://llvm.org/">LLVM</a> on Linux to target macOS.</li>
<li><strong>Darling</strong>: A translation layer (similar to Wine) that allows macOS binaries to run natively on Linux by implementing the Darwin subsystem.</li>
<li><strong>macOS SDKs</strong>: We need the SDK, headers, and frameworks Mac Apps expect.</li>
</ul>
<h3>The Missing Link: Phracker's SDKs</h3>
<p>The biggest hurdle to cross-compiling for macOS is the SDK. Legally and technically, you need the headers and frameworks found inside Xcode. Ordinarily, this involves downloading a 12GB Xcode image on a Mac and running an extraction script.</p>
<p>To make our Docker build truly portable and "headless", we rely on <a href="https://github.com/phracker/MacOSX-SDKs">Phracker MacOSX-SDKs</a> (no longer maintained). This project provides pre-packaged, compressed versions of the macOS SDKs. By pulling a specific version (like 11.3 or 12.3) directly into our build context, we can automate the entire toolchain setup without manual intervention.</p>
<h2>The Solution: A Unified Dockerfile</h2>
<h3>1. Building the Toolchain</h3>
<p>The <code>Dockerfile.osx-cross</code> starts by fetching build dependencies. Due to licensing, you'll need to package your own SDK, but once it's in the build context, <strong>osx-cross</strong> handles the heavy lifting:</p>
<pre><code class="language-dockerfile"># Extract from Dockerfile.osx-cross
FROM ubuntu:22.04 AS build

# Install dependencies for osxcross
RUN apt-get update &amp;&amp; apt-get install -y \
    clang llvm-dev libxml2-dev uuid-dev \
    libssl-dev bash patch make cmake xz-utils python3

# Set up the SDK and toolchain
COPY MacOSX11.3.sdk.tar.xz /osxcross/tarballs/
RUN UNATTENDED=1 ./build.sh  
</code></pre>
<h3>2. Integrating Darling for Testing</h3>
<p>While osx-cross gets us a binary, Darling acts as the bridge, providing the Mach-O loader and basic Apple frameworks needed to execute command-line tools.</p>
<pre><code class="language-dockerfile"># Setup Darling for runtime tests
RUN apt-get install -y darling-dkms darling
ENTRYPOINT ["darling", "shell"]  
</code></pre>
<blockquote>
<p>Verdict: Darling is incredible for CLI tools, though your mileage may vary if you need to test UI frameworks.</p>
</blockquote>
<h2>Why This Matters</h2>
<ul>
<li><strong>No device context switch</strong>: Compile and test for Linux, Windows (via Wine), and macOS (via Darling) on a single machine.</li>
<li><strong>Reduced Latency</strong>: No waiting for a Mac mini in a server rack. Tests run as fast as your Linux runner allows.</li>
<li><strong>Version Parity</strong>: Every developer uses the exact same SDK version and toolchain headers defined in the Dockerfile.</li>
</ul>
<h2>Conclusion</h2>
<p>The industry has spent years treating platforms as places you log into or wait on. But platforms were always contracts. A set of assumptions about binaries, syscalls, and behavior. When composed correctly, those contracts can be reconstructed and containerized. If a platform can be modeled, it can be versioned. If it can be versioned, it can be reproduced. And if it can be reproduced, it no longer owns your pipeline.</p>
<blockquote>
<p>First published 4/21/26 on <a href="https://blog.farzon.org/2026/04/the-warf-way-part-ii-tackling-macos.html">blog.farzon.org</a></p>
</blockquote>
]]></content:encoded></item><item><title><![CDATA[The "Warf" Way: Seamless Windows Testing on Linux using MinGW & Wine]]></title><description><![CDATA[In the world of language development, even a "toy" language needs a solid foundation. My project, warfLang, isn't trying to replace C++ or Rust. It’s an LL(1) parser written in C++ that generates an A]]></description><link>https://codeblog.farzon.org/the-warf-way-seamless-windows-testing-on-linux-using-mingw-wine</link><guid isPermaLink="true">https://codeblog.farzon.org/the-warf-way-seamless-windows-testing-on-linux-using-mingw-wine</guid><category><![CDATA[cross-compile]]></category><category><![CDATA[Docker]]></category><category><![CDATA[Linux]]></category><category><![CDATA[MinGW]]></category><dc:creator><![CDATA[Farzon Lotfi]]></dc:creator><pubDate>Sat, 02 May 2026 06:15:09 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/69f30a5b909e64ad078554d7/80f01020-4a7e-4b30-9246-187806808d47.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In the world of language development, even a "toy" language needs a solid foundation. My project, <strong><a href="https://github.com/farzonl/warfLang">warfLang</a></strong>, isn't trying to replace C++ or Rust. It’s an LL(1) parser written in C++ that generates an Abstract Syntax Tree (AST)—essentially a glorified calculator that supports variable definitions.</p>
<p><img src="https://blogger.googleusercontent.com/img/a/AVvXsEg2ytcGHR0oYqJtDJvUAxCA6z575HNFLeCsj1Eut6Bbtd0WJhFwg3m45gOc4GjBBP4kYfZJa-vsPnK32cW1gW6GooaojiOym7CWshDD5SLKcyB0objMDWsPUL7c8NG6gX1HsjIz2kD8eJC-ZIEAO8AvVRkXHpKfEU_QtjCywkM5BA6b0x8lIDc1ATMYskI" alt="warflang logo" /></p>
<p>But even a calculator needs to count correctly on every platform. To ensure <strong>warfLang</strong> remains truly cross-platform, I needed a CI/CD pipeline that could verify its logic on Windows without the overhead of actually owning a Windows machine.</p>
<h2>The Problem: Cross-Platform Logic is Tricky</h2>
<p>Even for a high-level parser, moving from Linux to Windows introduces subtle behavioral risks and differences especially when you are compiling acros different compilers like CL, Clang, and GCC or different libC implementations. </p>
<p>Inspired by <a href="https://www.metricpanda.com/rival-fortress-update-11-cross-compiling-for-three-platforms/"><strong>Gianni Milanesi’s</strong> post</a>, I realized I didn't need a native Windows environment to find out. I just needed a containerized "Build Appliance." </p>
<blockquote>
<p><em>Note this post will not be the promised part 5 of the Cross-Compiling series since we are using <strong>mingw-w64</strong>  and not clang</em>.</p>
</blockquote>
<h2>The "Warf" Solution: Dockerizing the Toolchain</h2>
<p>Instead of manually managing cross-compilers, I use a custom Dockerfile <a href="https://github.com/farzonl/warfLang/blob/master/Dockerfile.mingw-cross">Dockerfile.mingw-cross</a>. This encapsulates the entire MinGW-w64 suite, ensuring that the environment where I build <strong>warfLang</strong> today is the exact same one I'll use six months from now.</p>
<h3>Why Docker makes it easy:</h3>
<ol>
<li><p><strong>Zero Setup:</strong> A new contributor doesn't need to install <code>binutils-mingw-w64</code>. They just run the container.</p>
</li>
<li><p><strong>Consistency:</strong> It's a container, it always the works the same thats the point.</p>
</li>
<li><p><strong>The "Magic" Compiler</strong>: We get instant access to <code>x86_64-w64-mingw32-gcc</code>, which treats our C++ code as a native Windows project.</p>
</li>
</ol>
<pre><code class="language-dockerfile">FROM ubuntu:latest
  
# Install MinGW for building and Wine for testing
RUN apt-get update &amp;&amp; apt-get install -y \
 mingw-w64 \
 cmake \
 wine \
 &amp;&amp; rm -rf /var/lib/apt/lists/\*

...

RUN cmake -S . -B build \
 -GNinja -DCMAKE\_BUILD\_TYPE=Release \
 -DCMAKE\_C\_COMPILER=x86\_64-w64-mingw32-gcc-posix \
 -DCMAKE\_CXX\_COMPILER=x86\_64-w64-mingw32-g++-posix \
 -DBuildTest=TRUE \
 -DCMAKE\_SYSTEM\_NAME=Windows -DCMAKE\_CROSS\_COMPILING=TRUE
</code></pre>
<h2>Bundling Wine: Testing the Calculator</h2>
<p>The real value of the "Warf" way is the inclusion of <strong>Wine</strong>. For a project like <strong>warfLang</strong> , testing is straightforward: I feed the parser an expression (like <code>x = 5; x * 2;</code>), and I expect a specific AST output. By bundling Wine in the Docker image, I can run the Windows version immediately after compiling it without having to context switch to a new device. This works the same on my local dev machines as well as in the CI.</p>
<h3>Why this is vital for a "Toy" Language:</h3>
<ul>
<li><strong>It isn't</strong>: but it is fun 😂!</li>
<li><strong>Headless Validation</strong>: The real reason I did this no context switching for testing cross plat. Using <code>wine ./warf_tests.exe</code> in a headless Docker container gives me instant feedback if something works on windows without having to have a dedicated windows device.</li>
</ul>
<h2>Leveraging GitHub Actions</h2>
<p>By using this crossPlat builder approach, my GitHub Actions workflow is faster and <a href="https://docs.github.com/en/billing/reference/actions-runner-pricing">cheaper (see runner pricing)</a>. I pull a single Linux-based image, build the Windows <code>.exe file</code>, and run the test suite through Wine.</p>
<p><img src="https://blogger.googleusercontent.com/img/a/AVvXsEg49EpJab7EvdSIzht5lZj_3EkKnEaaOQXk-bYiHPQvL5vBvPLB86qpFbyAiEyfa7EBGHZuTUHRrWmatoEKQpRERwDYm2EDRlZXqaDW7tQyhSgxqJ4nT6yKQ9nkgCIfD7HytR9gsRmONj7GlFyvL0IxHBULW0OXzuPN9DxJ_ljIRDmG44kRZQpEcC0Q2Jo" alt="Runner prices" /></p>
<p>When I see the "Green Checkmark" now it proves that the "calculator" works on Windows, even though it was born and raised on Linux.</p>
<h2>Conclusion</h2>
<p>Whether you're building a massive compiler or a glorified calculator like <strong>warfLang</strong> , the "Warf" way combining Docker, MinGW, and Wine provides a professional, reproducible, and verifiable way to ship to Windows users without ever leaving the comfort of Linux.</p>
<p><em>Check out the implementation and play with the parser in the <a href="https://farzon.org/warfLang/">WarfLang WASM demo</a>.</em></p>
<blockquote>
<p>First published 4/19/26 on <a href="https://blog.farzon.org/2026/04/the-warf-way-seamless-windows-testing.html">blog.farzon.org</a></p>
</blockquote>
]]></content:encoded></item><item><title><![CDATA[The Hardest Problem in Engineering Isn't Code (It’s Communication)]]></title><description><![CDATA[If you ask a room full of software engineers what the hardest part of their job is, you’ll get a variety of answers. Some will say VM orchestration or these days Agent orchestration. Others will say c]]></description><link>https://codeblog.farzon.org/communication</link><guid isPermaLink="true">https://codeblog.farzon.org/communication</guid><category><![CDATA[Career]]></category><category><![CDATA[communication]]></category><category><![CDATA[growth]]></category><dc:creator><![CDATA[Farzon Lotfi]]></dc:creator><pubDate>Sat, 02 May 2026 05:33:47 GMT</pubDate><content:encoded><![CDATA[<p>If you ask a room full of software engineers what the hardest part of their job is, you’ll get a variety of answers. Some will say VM orchestration or these days Agent orchestration. <a href="https://martinfowler.com/bliki/TwoHardThings.html">Others will say cache invalidation or naming things</a>.</p>
<p>They’re all wrong.</p>
<p>The hardest thing you will ever have to do in your career is communicate your ideas to other people. You can write the most elegant, highly optimized, mathematically perfect algorithm in the world, but if you can't explain why it matters to your team, your manager, or the product owner, it will sit in a repository gathering digital dust.</p>
<p>A good engineer can solve complex technical problems in isolation. A great engineer builds bridges between those solutions and the people who need them. Collaboration is the actual 10x multiplier in tech, and it requires a completely different skill set than writing code.</p>
<p> If you are an introverted engineer who prefers the quiet predictability of working on a ticket to the loud chaos of a planning meeting, this can feel daunting. But influence isn't about being the loudest voice in the room. It’s about being the most strategic. Here is how you can find your voice and get your great ideas the audience they deserve.</p>
<h3>The Art of Engineering "Inception"</h3>
<p>In a large corporation, a brilliant idea is a fragile thing. If a project only has one champion, it is constantly at risk of being deprioritized, defunded, or forgotten. To keep a project alive, you need consensus. You need multiple stakeholders who feel a sense of ownership over the work. The best engineers don’t just pitch ideas; they incept them into their colleagues. Like Leo in <em>Inception</em>, your goal is to plant the seed of an idea so naturally that your colleagues eventually think they came up with it themselves. </p>
<p> <img src="https://i.imgur.com/Meii6VU.gif" alt="Inception meme" /></p>
<p>You do this by asking guided questions rather than making statements. Think socratic method. Instead of saying, "We need to migrate to this new compiler," you ask, "Have you noticed how slow our compile times are on CL? What do you think would happen if we looked at Clang?" When people arrive at the conclusion themselves, they become deeply invested in the outcome. They become your coalition.</p>
<h3>Mirroring: Let Them See Themselves in You</h3>
<p>Influence requires trust, and humans naturally trust people who feel familiar to them. When you are trying to convince a colleague of an idea, pay close attention to their energy and <strong>mirror it</strong>.</p>
<p>  <img src="https://i.imgur.com/HzJLE9L.png" alt="Mirroring" /></p>
<ul>
<li><p><strong>The High-Energy Visionary:</strong> If you are talking to a product manager who speaks quickly and focuses on the big picture, match that tempo. Focus on the end-user impact and the broad strokes. Skip the implementation details.</p>
</li>
<li><p><strong>The Methodical Skeptic:</strong> If you are talking to a senior architect who is quiet, analytical, and risk-averse, slow down. Lower your volume. Present your idea with a focus on edge cases, security, and stability.</p>
</li>
</ul>
<p>Mirroring isn't about manipulation; it’s about translation. It’s taking your brilliant, quiet idea and translating it into a language the other person natively understands. When they see their own communication style reflected back at them, their defenses drop, and they actually <em>listen</em>.</p>
<h3>Building the Muscle: Why I Write</h3>
<p>If you are a quiet person, speaking up in a crowded meeting full of extroverts might feel like trying to jump onto a moving train. You don't have to start there. Communication is a muscle, and you can build it in isolation before testing it in public.</p>
<p> <img src="https://i.imgur.com/rCK9yeR.png" alt="Writing Muscle" /></p>
<p>For me, that meant <strong>writing</strong>.</p>
<p>I started writing down my ideas whether as formal design documents, meeting notes, internal wiki pages, or just structured notes for myself because it forced me to organize the chaos in my head. Writing strips away the pressure of a real-time conversation. It allows you to anticipate counter-arguments, refine your analogies, and distill your thoughts down to their absolute essence.</p>
<p>By the time I actually had to present an idea verbally, I had already rehearsed the logic on paper. If you struggle to find your voice in meetings, start by finding your voice on the page.</p>
<h3>Finding Your Voice</h3>
<p>The tech industry desperately needs the ideas trapped inside the heads of quiet engineers. You don't need to change your personality or suddenly become a boisterous extrovert to be heard. You just need to learn the mechanics of influence: plant the seeds, build a coalition, speak their language, and structure your thoughts.</p>
<p>The code is the easy part. The real engineering happens between people.</p>
<blockquote>
<p>First published 5/1/26 on <a href="https://blog.farzon.org/2026/05/communication.html">blog.farzon.org</a></p>
</blockquote>
]]></content:encoded></item><item><title><![CDATA[The Exhausted Overachiever's Guide to Burnout]]></title><description><![CDATA[For an overachiever, the hardest thing to admit isn't that you're exhausted. It's admitting that you have absolutely no idea what to do next. I spent years playing a very specific character: the one w]]></description><link>https://codeblog.farzon.org/the-exhausted-overachiever-s-guide-to-burnout</link><guid isPermaLink="true">https://codeblog.farzon.org/the-exhausted-overachiever-s-guide-to-burnout</guid><category><![CDATA[Burnout recovery]]></category><category><![CDATA[burnout]]></category><dc:creator><![CDATA[Farzon Lotfi]]></dc:creator><pubDate>Sat, 02 May 2026 05:27:35 GMT</pubDate><content:encoded><![CDATA[<p>For an overachiever, the hardest thing to admit isn't that you're exhausted. It's admitting that you have absolutely no idea what to do next. I spent years playing a very specific character: the one who could out-think, out-work, and out-maneuver any problem. My self-worth wasn't just tied to my output; it <em>was</em> my output. So when burnout hit sure it drained my energy, but worse it entirely stripped away my identity. If your relentless drive that got you here has suddenly gone quiet, I need you to hear this: you have reached a necessary end of a version of yourself that was never sustainable.</p>
<h3>The Story You’re Stuck in</h3>
<p>In In this industry, we’re taught to define ourselves by what we can do. You’re the "DevOps guy" or the "UI specialist." That’s a narrative trap. You start to believe that if you aren't that one specific thing, you’re nothing. Your "self-narrative" is a cage you build for yourself. One based in fear where you are terrified that if you stopped being the "person with all the answers," you would lose your seat at the table. It takes self reflection to realize this story is a lie. You have to be willing to look at your professional identity and admit, "This isn't me anymore." That’s not a failure; it’s an update.</p>
<h3>Rewrite the Story You Tell Yourself (The Power of Self-Narrative)</h3>
<p>Your professional identity is not an unchangeable fact. You are not just "The Fixer" or the person who saves the project at the eleventh hour. Those are just roles you played. Write down the story you’ve been telling yourself. If it’s full of harsh demands and impossible standards, realize that you are the author. You have permission to write a new chapter where your value comes from your presence, your empathy, and your perspective not just your output.</p>
<p><img src="https://blogger.googleusercontent.com/img/a/AVvXsEjB4zRrrxYlCm3-E7PqOoEsClFxzlMGVUMPVfsFPfLvx0p1O5KVIjVFga7uAGiiIS8V0LtTDZrjum2DWIia6zwH0WhEYNqaPlW_jXYwI7uQBaGxVR0a1DsmwdVE0pD1s6l_PzXx9P3Lyv5B8d_elJJ_WF1YppfeqCrXSneUf9MRFNYK58mT1bAmcKkFQvM" alt="A quote about shaping reality with your mind" /></p>
<h3>Listen to the Warning Signs (The Role of Awareness)</h3>
<p>We often ignore our own physical and emotional limits until our bodies force us to stop. We treat anxiety as an inconvenience to power through rather than a warning sign to respect.</p>
<p>Transformation starts with simply observing yourself without judgment. When a crisis happens at work and you feel that familiar, urgent pull to jump in and prove you’re still "smart," just pause. You don't become more valuable by making yourself more available. Notice the physical tension in your chest or your tightened jaw. That’s your ego trying to defend its territory. Awareness is finding that brief gap between a problem arising and your desperate need to fix it. Just sit in that gap and observe for now. </p>
<h3>Lean Into the Reinvention (Embracing Discomfort)</h3>
<p>We hate the space between who we used to be and who we are becoming. When you stop being the "Answer Guy," there is an uncomfortable void. We usually try to fill it by taking on more work, chasing a new goal, or distracting ourselves.</p>
<p>Don't. That discomfort is the friction of actual growth. If you feel like an imposter or a novice again, you’re exactly where you need to be. Stop trying to hustle your way out of burnout. Intentionally spend time in the awkwardness of <em>not knowing</em>. Go to a meeting and don't lead it. Ask a basic question. Prove to your nervous system that you don't have to be perfect to be safe.</p>
<h3>The Pain of Tearing it Down</h3>
<p>Reinvention sounds like a shiny, positive thing. It’s not. It’s messy and it hurts. It’s the feeling of realizing who you are doesn't fit who you’re trying to become. There’s a specific kind of vulnerability in tech when you stop pretending you’re a machine. But that’s where the "scabs" come from. You do it, you survive the transition, and you realize you didn't die. </p>
<h3>Build Something Better with Intention (Conscious Reinvention)</h3>
<p>Real reinvention requires letting go. You cannot just plaster over a burnt-out ego and hope for the best. You have to let the need to be the smartest person in the room die so a well-rounded human can take their place. You must pursue ego death.</p>
<p>This is a deliberate choice. You are deciding which parts of your old identity are worth keeping and which are just weighing you down. Identify one sharp edge of your ego maybe your defensiveness when challenged, or your need for total control and consciously choose to leave it behind. Reinvention isn't about becoming someone else; it’s about stripping away the armor to reveal someone who is approachable, resilient, and real.</p>
<h3>Conclusion</h3>
<p>I'm reminded of the line from <em>Batman Begins</em> where Thomas Wayne tells his son "Why do we fall Bruce?" Strength doesn't come from succeeding; it comes from the moments you feel completely lost. Where you don't have trust that you are still enough. Like Bruce we fall "so we can learn to pick ourselves back up again." So if you are trying to navigate through your burnout, know you will pick yourself back up. You’re in the middle of a necessary transition. Don't rush it.</p>
<blockquote>
<p>First published 4/28/26 on <a href="https://blog.farzon.org/2026/04/the-exhausted-overachievers-guide-to.html">blog.farzon.org</a></p>
</blockquote>
]]></content:encoded></item><item><title><![CDATA[The Quiet Grind: Why Talent is the Least Interesting Thing About You]]></title><description><![CDATA[There is a persistent myth in software engineering that we all quietly worship: the myth of the "natural."
We love the stories of the savant who can architect a billion-dollar app in their dorm room. ]]></description><link>https://codeblog.farzon.org/the-quiet-grind-why-talent-is-the-least-interesting-thing-about-you</link><guid isPermaLink="true">https://codeblog.farzon.org/the-quiet-grind-why-talent-is-the-least-interesting-thing-about-you</guid><category><![CDATA[grind]]></category><category><![CDATA[grit]]></category><category><![CDATA[Limitless ]]></category><category><![CDATA[recovery]]></category><dc:creator><![CDATA[Farzon Lotfi]]></dc:creator><pubDate>Sat, 02 May 2026 05:22:04 GMT</pubDate><content:encoded><![CDATA[<p>There is a persistent myth in software engineering that we all quietly worship: the myth of the "natural."</p>
<p>We love the stories of the savant who can architect a billion-dollar app in their dorm room. It makes for great headlines. But if you spend enough time in this industry, staring at a terminal at 2:00 AM trying to figure out why your code keeps failing, you realize something sobering.</p>
<p>Talent will only get you so far. In fact, relying on talent is usually a trap.</p>
<p>Talent gets you through the first few years. It makes the introductory computer science classes easy. But eventually, everyone hits the wall. You encounter a bug that defies logic, a product launch that lands to total silence, or a market shift that renders your codebase obsolete.</p>
<p>When you hit that wall, talent is useless. The only thing that matters is resilience.</p>
<h2>The Speed of Recovery</h2>
<p>If you look closely at the people whose names we actually remember. The engineers who shaped the tools we use, the founders who built lasting companies; they aren't necessarily the smartest people in the room. But they are the most resilient.</p>
<p><img src="https://blogger.googleusercontent.com/img/a/AVvXsEiOfKMoH_5p_M7JO5VZRzkiD0y7hNrwLGT9vfwf2SJzekSDvtDFQCbuxUgqcV1JyWHrNupHX9meeNy4NzVB_QLv5lFuxmYeW6L-J2PWBH7dYCBkwgICYdmaSJq0SdJ3jegOZu1NWeoQszha_3pM175Q8NvcHhIn08pUPGKVYJU1yNErKhBJlFjvGDnOdUQ" alt="Meme about recovering quickly stronger than before" /></p>
<p>Their defining trait isn't that they never fail; it's that their recovery time from adversity is vanishingly short. When a deployment goes sideways, they don't spiral into imposter syndrome. They don't spend days mourning the architecture that didn't work. They feel the sting, roll back the deploy, open the logs, and start writing the fix.</p>
<p>They are the people who don't spend hours on Hacker News debating the theoretical merits of a new framework. They just go build with it. Talk is cheap; execution is lonely. The most successful people have made peace with that loneliness.</p>
<h2>Encoded in the DNA</h2>
<p>For these people, the "grind" isn't a temporary phase you endure to get a promotion. It becomes their default state. It gets encoded in their DNA.</p>
<p><img src="https://blogger.googleusercontent.com/img/a/AVvXsEj7XDPbN3w5gaXQoel_HGM5RWBqrdfDNnl6plYNlBO8_2kcQRzRWd4fNT7jmNyQE2tDY8n4Y4OOyDHT5FWYS0Lyuxd-chErWH5-GhxVlVCYxwhqDd6kPhi16EW6p3DYjwSmJj-BsXSsLtQdTnx4nmuyeiaEB015oF7IFKQRxcc8Z-922ttkC1-JqHdPl4Y" alt="Meme about Grit encoded in DNA" /></p>
<p>They show up every single day because they operate on a fundamental, unshakeable belief: <em>if I just put in the work, better days are ahead.</em> They don't doubt their potential. Not because they are arrogant, but because they have redefined what potential means. Potential isn't a measure of your raw intellect; it's a measure of your capacity to endure the struggle until the problem is solved.</p>
<p>When you realize that your ability to learn and adapt is infinite, you start to believe you are limitless. And that is why they stay winning. They outlast everyone else who quits when the novelty wears off and the real work begins.</p>
<h2>The Long Game: Why Success is a Game of Attrition</h2>
<p>Ultimately, the industry and life is a giant filter. It’s designed to weed out anyone who is only here for the "easy" days.</p>
<p>Most people are looking for a baseline of comfort. They want a career where they can rely on their initial talent, coast on what they already know, and avoid the friction of being a beginner again. But the people who stay winning, the ones who seem limitless are the ones who have made the grind their home.</p>
<p>They don't see adversity as a signal to stop; they see it as a diagnostic. To them, a failed project or a brutal market shift isn't a personality flaw it's just a bug that needs a patch. They don't have a special biological gift. They've just spent so much time in the trenches that their work ethic is no longer a choice. It’s encoded.</p>
<h2>The Limitless Script</h2>
<p>If you’re feeling like you’re hitting a wall, or like your "talent" has run dry, good. That’s where the real work begins.</p>
<p>Stop talking about what you’re going to build. Stop waiting for the moment where you finally feel "ready" or "talented enough" to compete. That moment doesn't exist. There is only the daily build, the recovery from the inevitable crashes, and the quiet, persistent belief that better days are a mathematical certainty if you refuse to exit the chair.</p>
<p>Success isn't about being the smartest person in the room. It’s about being the one who is still there when everyone else has gone home.</p>
<p><strong>Show up. Ship. Repeat.</strong> That’s how you stay in the league.</p>
<blockquote>
<p>First published 4/27/26 on <a href="https://blog.farzon.org/2026/04/the-quiet-grind-why-talent-is-least.html">blog.farzon.org</a></p>
</blockquote>
]]></content:encoded></item><item><title><![CDATA[The Big Tech Pivot: Why a Buyout Isn't an End, It's an Opening]]></title><description><![CDATA[Right now, a palpable sense of anxious terror is vibrating through our engineering floors. Microsoft is offering thousands of voluntary buyouts. Meta is axing jobs to fund a staggering $135 billion pi]]></description><link>https://codeblog.farzon.org/the-big-tech-pivot-why-a-buyout-isn-t-an-end-it-s-an-opening</link><guid isPermaLink="true">https://codeblog.farzon.org/the-big-tech-pivot-why-a-buyout-isn-t-an-end-it-s-an-opening</guid><category><![CDATA[AI]]></category><category><![CDATA[Layoffs]]></category><category><![CDATA[Retirement]]></category><dc:creator><![CDATA[Farzon Lotfi]]></dc:creator><pubDate>Sat, 02 May 2026 05:12:51 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/69f30a5b909e64ad078554d7/0547fd30-5431-4bdb-bf3a-00f199f02a6e.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Right now, a palpable sense of anxious terror is vibrating through our engineering floors. Microsoft is offering thousands of voluntary buyouts. Meta is axing jobs to fund a staggering $135 billion pivot into AI infrastructure.</p>
<p>When you are staring at a buyout package on your own desk, you have a choice to make about how you frame your reality. You can view yourself as a victim of a collapsing market, and if you do, that will become your reality. You will see a tragedy, a corporate betrayal, and a door closing.</p>
<p>But there is a second option. You can choose to view this not as a funeral, but as a strategic opening. Your reality is dictated by how you frame this moment. If you are sitting in an existential waiting room right now, stomach in knots, let me offer the frame of the opportunist: Your career isn't over. In fact, if you play this right, you might be stepping into the most powerful strategic position of your life.</p>
<h2>The Brutal Math: Software is Going to Zero</h2>
<p>To understand the opportunity, you have to look at the undeniable economic reality driving these buyouts: The marginal cost of standard software engineering is rapidly dropping to zero. </p>
<p>For 50 years, code was a premium, scarce asset. We built our compensation models around being the highly paid gatekeepers of this complex resource. But now, we are staring down the barrel of swarms of specialized AI agents collaborating autonomously to write, test, and deploy entire architectures. Within the next 24 months, it is highly probable that autonomous systems will generate more code than all of humanity has in the history of computing.</p>
<p>You cannot out-work, out-hustle, or out-code a <a href="https://www.gartner.com/en/newsroom/press-releases/2026-1-15-gartner-says-worldwide-ai-spending-will-total-2-point-5-trillion-dollars-in-2026">$2.52 trillion</a> capital rotation into silicon. When a market is intentionally flooded with artificially cheap, AI-generated code, the premium value of raw human output collapses. This is the brutal math driving the layoffs and the buyout packages.</p>
<h2>The Great Headcount Migration</h2>
<p>For those that remain you need to understand Big Tech isn't "running out of money" they are aggressively migrating their human capital.</p>
<p>Companies like Google and Microsoft are moving their best minds out of teams like Gmail and Office and onto teams like Gemini and Azure AI. As they chase the AI infrastructure crown, they are leaving their core, "solved" products the platforms that fund this CapEx in maintenance mode.</p>
<h2>IP Without Architects</h2>
<p>The migration of human capital to new projects means Big Tech is currently sitting on mountains of intellectual property they no longer have the organizational focus to evolve. They have the IP, but they are losing the architects.</p>
<h2>The Big Tech Pivot (And Their Strategic Gap)</h2>
<p>This brings us to the most important strategic shift of our generation. Big Tech is no longer fighting to be the best pure-software provider; they are pivoting to become the foundational AI infrastructure layer for the globe. They want to sell the compute, the agents, and the LLMs. </p>
<p>But the pivoting into AI infrastructure also exposes a massive flank. As they pour hundreds of billions into server farms, the historical revenue drivers also become increasingly easier to replicate. This creates a strategic gap, leaving their core software products vulnerable to more agile competition.</p>
<h2>The Silver Lining: The Great Equalizer</h2>
<p>This is where you come in. Here is the beautiful, unintended consequence of Big Tech's pivot: By subsidizing the cost of AI infrastructure to capture the market, they have dropped your barrier to entry to zero. You don't need an army of 500 engineers to build a leaner, faster alternative to a Microsoft or Google product anymore. </p>
<p>You just need the exact same AI agents that your former employer spent billions to build and subsidize. You are not leaving your domain expertise behind. You built these systems. You know the architectural constraints and the underlying tech debt. </p>
<p>You know exactly where the friction points are for end-users. You can use Big Tech's own subsidized AI infrastructure to build focused, pure-software products that compete directly in the spaces they are currently deprioritizing. In a way it is kind like malicious compliance.</p>
<h2>The Seed Funding Reframe</h2>
<p>Let’s be honest: a buyout package isn’t life-changing money. It isn’t a VC war chest that will last you long. But calling it <strong>"seed funding"</strong> is a necessary psychological hack.</p>
<p>When you label it "severance," your brain chemistry defaults to fear and preservation. When you label it "seed funding," you move into optimism. It forces you to stop thinking like a discarded employee and start thinking like the builder you’ve always been. It is a grant that buys you the time to return to the craft on your own terms.</p>
<h2>Conclusion: Choose Your Reality</h2>
<p>Your reality is how you frame this moment. A buyout isn't a winning lottery ticket, but it is a release from the "existential waiting room." You are an insider armed with domain expertise, a laptop, and a subsidized AI toolkit that levels the playing field in ways that were impossible five years ago.</p>
<blockquote>
<p>First published 4/26/26 on <a href="https://blog.farzon.org/2026/04/the-big-tech-pivot-why-buyout-isnt-end.html">blog.farzon.org</a></p>
</blockquote>
]]></content:encoded></item><item><title><![CDATA[MemGC: A Retrospective on a Bygone Frontline of Browser Security]]></title><description><![CDATA[Looking back at my time on the Chakra and the OG Edge team, few projects I had the opportunity to work on feel as consequential to my development as an engineer as my opportunity to work on MemGC (Mem]]></description><link>https://codeblog.farzon.org/memgc-a-retrospective-on-a-bygone-frontline-of-browser-security</link><guid isPermaLink="true">https://codeblog.farzon.org/memgc-a-retrospective-on-a-bygone-frontline-of-browser-security</guid><category><![CDATA[Chakra]]></category><category><![CDATA[MemGC]]></category><category><![CDATA[Security]]></category><category><![CDATA[spartan-edge]]></category><category><![CDATA[Browser Internals]]></category><category><![CDATA[browser security]]></category><dc:creator><![CDATA[Farzon Lotfi]]></dc:creator><pubDate>Sat, 02 May 2026 05:05:10 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/69f30a5b909e64ad078554d7/f0db731d-88ac-4cf5-888c-b63d4c50a548.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Looking back at my time on the Chakra and the OG Edge team, few projects I had the opportunity to work on feel as consequential to my development as an engineer as my opportunity to work on <strong><a href="https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-10/security/threat-protection/overview-of-threat-mitigations-in-windows-10">MemGC (Memory Garbage Collection)</a></strong>. In the 2014-16 time period the largest amount of security bugs filed against Internet Explorer were <a href="https://chs.us/2026/03/use-after-free-understanding-a-classic-memory-corruption-bug/">Use-After-Frees (UAFs)</a>.</p>
<p><img src="https://blogger.googleusercontent.com/img/a/AVvXsEieXh5Zzzrn79okLg410mTkJIxN7MHFxQwbu2O7EaW0nWzDMayh4RJ9mHbj6yqF78hTr7W-D9_7ix9SyXcVm_NNNMSUd3E4trxQBAFrMj5GwTqkC0yQnT362pmHA6YnLsOlmMGElcTqG5pbHHqvW87KqAgCAQv78C6stgnNFdGTgjewhxTiWfCxoHhk2uk" alt="UaF infographic" /></p>
<p>MemGC was our architectural response: a garbage collector designed not just for performance, but as a hard security boundary. It was good enough that it recieved praise from <a href="https://projectzero.google/2017/09/the-great-dom-fuzz-off-of-2017.html">Google project zero</a>: "<em>MemGC is an example of a useful mitigation that results in a clear positive real-world impact"</em>. I do love quoting this 😂.</p>
<h2>The Core Idea: Turning UAF into a GC Problem</h2>
<p>Before MemGC, we tried mitigations like <em><a href="https://web.archive.org/web/20150524172425/http://labs.bromium.com/2015/01/17/use-after-free-new-protections-and-how-to-defeat-them/">Isolated Heap</a></em> and <em><a href="https://www.securityweek.com/microsofts-use-after-free-mitigations-can-be-bypassed-researcher/">Delay Free</a></em>. They were clever "band-aids" that made exploitation harder but didn't solve the root cause. If a developer forgot to null a pointer after a <code>free()</code>, the door remained open.</p>
<p>MemGC changed the game by bringing the <strong><a href="https://en.wikipedia.org/wiki/Concurrent_mark_sweep_collector">Concurrent Mark-Sweep (CMS)</a></strong> algorithm from the JavaScript engine (Chakra) into the heart of the DOM. We essentially built a safety net:</p>
<ul>
<li><strong>Reference-based Lifetime</strong>: Instead of manual <code>free()</code> calls, objects were only reclaimed when the GC could prove no references to them remained.</li>
<li><strong>The Conservative Scan</strong>: We treated the stack and registers conservatively. If a value looked like a pointer to a MemGC object, we kept that object alive. This effectively killed "immediate" UAF exploits.</li>
</ul>
<h2>What it Was Good At: Structural Defenses</h2>
<p>From a developer’s perspective, MemGC was incredibly successful at <strong>"Vulnerability Class Elimination."</strong></p>
<ol>
<li><strong>Automation of Safety</strong>: It removed the cognitive load from DOM developers. The GC handled the cleanup of complex DOM nodes automatically.</li>
<li><strong>Performance Balance</strong>: By using a concurrent mark-sweep, we kept the UI thread responsive while the GC did the heavy lifting on a background thread.</li>
<li><strong>Heap Integrity</strong>: The data structures we used, like the <code>HeapBlock32Map</code>, allowed us to quickly determine if an address was a valid object start, preventing many "middle-of-object" pointer tricks.</li>
</ol>
<h2>Where it Failed: The "Blind Spots"</h2>
<p>No mitigation is perfect. As developers, we had to confront the reality that hackers are just as creative as we are. One of the most interesting "failures" was a limitation in visibility between different engine components.</p>
<p>As detailed in the <em>"Seeing Double"</em> research, we discovered that having separate "Chakra" and "DOM" heaps created a blind spot. The Chakra recycler didn't always have visibility into allocations on the DOM heap, and vice versa. If a pointer to a Chakra object was stored in a buffer on the DOM heap, the Chakra GC might not "see" it, leading to a UAF despite the protection.</p>
<p>Furthermore, killing UAF simply pushed attackers toward <strong>Type Confusion</strong>. MemGC ensured the memory was <em>there</em>, but it couldn't ensure the memory was being interpreted as the correct <em>type</em>.</p>
<h2>Lessons for Today’s Developers</h2>
<p>If I were building a new engine today, what would I take from the MemGC era?</p>
<ul>
<li><strong>Defense in Depth</strong>: MemGC works best when paired with modern mitigations like <strong><a href="https://learn.microsoft.com/en-us/windows/win32/secbp/control-flow-guard">Control Flow Guard (CFG)</a></strong>.</li>
<li><strong>The Precision Problem</strong>: Conservative scanning prevents UAF but can cause memory leaks. Precise GC is the gold standard for modern systems.</li>
<li><strong>Language Safety</strong>: MemGC was a heroic effort to make C++ safe. Today, we should look toward <strong>Rust</strong> for compile-time safety guarantees.</li>
</ul>
<h2>Final Thoughts</h2>
<p>MemGC was a milestone in browser security. It forced attackers to abandon their favorite exploits and move into much more difficult territory. For those of us who built it, it remains a proud example of weaponizing computer science for defense.</p>
<h3>References:</h3>
<ul>
<li><a href="https://www.microsoft.com/en-us/msrc/blog/2016/01/triaging-the-exploitability-of-ieedge-crashes">MSRC: Triaging Exploitability in the MemGC Era</a></li>
<li><a href="https://www.zerodayinitiative.com/blog/2018/12/17/seeing-double-exploiting-a-blind-spot-in-memgc">ZDI: Seeing Double - Exploiting a Blind Spot in MemGC</a></li>
</ul>
<blockquote>
<p>First published 4/24/26 on <a href="https://blog.farzon.org/2026/04/memgc-retrospective-on-bygone-frontline.html">blog.farzon.org</a></p>
</blockquote>
]]></content:encoded></item><item><title><![CDATA[The ROI of Irrationality: What Grad School Actually Taught Me]]></title><description><![CDATA[I went to graduate school to specialize in computer graphics. I came out of it to find a job market that had practically vanished.
If I had listened to the conventional wisdom of the time, I would hav]]></description><link>https://codeblog.farzon.org/the-roi-of-irrationality-what-grad-school-actually-taught-me</link><guid isPermaLink="true">https://codeblog.farzon.org/the-roi-of-irrationality-what-grad-school-actually-taught-me</guid><category><![CDATA[academia]]></category><category><![CDATA[Career]]></category><category><![CDATA[goals]]></category><category><![CDATA[grad school]]></category><dc:creator><![CDATA[Farzon Lotfi]]></dc:creator><pubDate>Sat, 02 May 2026 04:53:29 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/69f30a5b909e64ad078554d7/e7a7c013-be3c-4d56-8bc7-c9e02aa1b60f.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>I went to graduate school to specialize in computer graphics. I came out of it to find a job market that had practically vanished.</p>
<p>If I had listened to the conventional wisdom of the time, I would have pivoted. I would have cut my losses, updated my resume to reflect a safer trajectory, and moved on. For a time I did do just that and pivoted to computer security. But I realized it would be better to dig my heels in and commit to the career I wanted. Today, I have that career. But let’s be entirely clear: it wasn’t the institution or the degree that got me here. It was sheer, unadulterated stubbornness.</p>
<p>Looking back on that journey, there are a few hard truths about goals, higher education, and the absolute necessity of refusing to compromise.</p>
<h3><strong>The Danger of Being "Rational"</strong></h3>
<p>Throughout my life, I have developed a deep resentment for the advice to "be rational." We are constantly told to temper our expectations, play the percentages, and have a pragmatic fallback plan.</p>
<p>Here is the reality: in a world of eight billion people, rationality is just a mathematical formula for settling. To truly believe that you deserve to occupy a highly specific, fiercely competitive niche, you cannot be rational. You have to be deeply irrational. You need to possess a healthy streak of delusion to look at the impossible odds, the closed doors, and the saturated markets and decide, <em>“Yes, that spot still belongs to me.”</em> Rationality protects you from disappointment, but it also completely insulates you from your own potential.</p>
<h3><strong>The Illusion of the Academic Pipeline</strong></h3>
<p>We also need to have an honest conversation about the current state of higher education. It is time to acknowledge that much of academia has evolved into a heavily institutionalized enterprise that frequently extracts far more financial and temporal value from its students than it returns. It has become a systemic sinkhole, operating on a timeline fundamentally disconnected from the velocity of modern industry.</p>
<p>If you are relying on a core curriculum to prepare you for the cutting edge, you are already years behind. Too much of the standard coursework is a parade of outdated concepts and irrelevant syllabi that no longer apply to the real-world demands of tech or art. Ironically, the only classes reflecting the true, current state of the field are the "Special Topics", the seminars, and the elective. The very courses that the university administration rarely allows to count toward your actual degree requirements. </p>
<p>Learning is still essential, but we must recognize it for what it truly is: the continuous act of self-creation. Today, LLMs and Youtube can deliver raw information far more efficiently than a lecture hall, which means your intellectual evolution must be self-authored. A syllabus offers no armor against the future. The only real measure of a course's worth is whether it permanently alters the architecture of your thinking.</p>
<h3><strong>The Saving Grace: Research</strong></h3>
<p>There is one major caveat to this critique. The beating heart that keeps the academic body alive and the only reason it is still worth navigating is the research.</p>
<p>My saving grace in graduate school was securing a Graduate Research Assistantship (GRA). That was where the real education happened. Away from the archaic lectures and standardized rubrics, research is where you actually touch the boundary of what is possible. It is the one space left in the university ecosystem where discovery and innovation are prioritized over bureaucracy. If you are going to go to grad school, go for the research. Everything else is just noise.</p>
<h3><strong>Stubbornness as a Strategy</strong></h3>
<p>I didn't get my career because a piece of paper guaranteed me a spot in computer graphics. I got it because I refused to let an empty job market dictate my trajectory. The system is not designed to hand you your dream; it is designed to process you.</p>
<p>If you have a vision for your life, guard it fiercely against the "rational" advice of the masses. Take the research experience, absorb the uncredited special topics, and leave the bureaucratic friction behind. At the end of the day, your success won't be a product of the institution. It will be a testament to your refusal to quit.</p>
<blockquote>
<p>First published 4/23/26 on <a href="https://blog.farzon.org/2026/04/the-roi-of-irrationality-what-grad.html">blog.farzon.org</a></p>
</blockquote>
]]></content:encoded></item><item><title><![CDATA[The Benchmarks of a Ghost Ship: On Knowing When to Walk Away]]></title><description><![CDATA[In the world of software engineering, we are raised on a diet of pure meritocracy. We believe that if our algorithms are faster, our latency lower, and our architecture more elegant, we win. We treat ]]></description><link>https://codeblog.farzon.org/the-benchmarks-of-a-ghost-ship-on-knowing-when-to-walk-away</link><guid isPermaLink="true">https://codeblog.farzon.org/the-benchmarks-of-a-ghost-ship-on-knowing-when-to-walk-away</guid><category><![CDATA[Chakra]]></category><category><![CDATA[growth]]></category><category><![CDATA[IonicSecurity]]></category><category><![CDATA[MemGC]]></category><dc:creator><![CDATA[Farzon Lotfi]]></dc:creator><pubDate>Sat, 02 May 2026 04:46:06 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/69f30a5b909e64ad078554d7/3f338680-92c3-47da-a95a-dd5424207d8b.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In the world of software engineering, we are raised on a diet of pure meritocracy. We believe that if our algorithms are faster, our latency lower, and our architecture more elegant, we win. We treat the codebase like a sanctuary where logic is the only law.</p>
<p>But I’ve spent my career building cathedrals in sinking cities, and if there is one thing I’ve learned, it’s that the most brilliant code in the world cannot save a product whose time has passed or one that never found its timing at all.</p>
<h2>The Chakra Paradox: Winning the Wrong Race</h2>
<p>During my tenure on the <strong><a href="https://github.com/chakra-core/ChakraCore">Chakra JavaScript compiler</a></strong> team at Microsoft, we did the "impossible." We went toe-to-toe with Google’s V8 and, <a href="https://microsoftedge.github.io/videotest/2017-04/BenchmarkMethodology.html">by the metrics of the Octane, jetstream, &amp; sunspider benchmarks, we won.</a> </p>
<p><img src="https://blogger.googleusercontent.com/img/a/AVvXsEg69j113NMYKp1qD1pduMrMV2_X_Ge2kXccVUe5oMuxsiPetZoiwbvqxr1qaLbrTBH54OtLLFh_8Z6Os5hrfffetvyu5zBuH29OVUowQbIPZuTdRqiqdJI_vr285ix46zAvCMTzbh_2Kl9KHGjxsyvu_diLK8xgRZ39JwmWV4OQ1vs2EQ5D17p6bibbDUE" alt="Chakra beating V8 in Google's Own Benchmark (Octan 2.0)" /></p>
<p>We built a world-class engine a feat of JIT optimization and memory management that could have defined the next decade of the web. Chakra was ahead in ES6 conformance and had elegant security mitigations like MemGC that even got the praise of <a href="https://projectzero.google/2017/09/the-great-dom-fuzz-off-of-2017.html">Google project zero </a>:</p>
<blockquote>
<p><em>"It is also interesting to observe the effect of MemGC, a use-after-free mitigation in Internet Explorer and Microsoft Edge. When this mitigation is disabled using the registry flag OverrideMemoryProtectionSetting, a lot more bugs appear. However, Microsoft considers these bugs strongly mitigated by MemGC and I agree with that assessment. Given that IE used to be plagued with use-after-free issues, MemGC is an example of a useful mitigation that results in a clear positive real-world impact. Kudos to Microsoft’s team behind it!"</em></p>
</blockquote>
<p>But while we were winning the technical battle, the war was already over. Microsoft had split the browser’s soul in two, drifting between the legacy of Internet Explorer and the fresh start of Edge. We were optimizing a masterpiece while the gallery was being demolished. It didn’t matter that our tech was superior; the market had moved, the trust had eroded, and the remaining market share was evaporating.</p>
<blockquote>
<p><strong>The Lesson</strong>: You can be the best in the world at something that no longer matters.</p>
</blockquote>
<h2>The Patent Trap: Groundbreaking vs. Market-Ready</h2>
<p>I saw the same ghost appear again at <strong>Ionic Security</strong>. We weren’t just building another app; we were creating groundbreaking security infrastructure. I have the patents to prove it. I have tangible evidence of innovation in its purest form. We solved problems others hadn't even identified.</p>
<p>Yet, a startup is a race between discovery and exhaustion. We had the breakthrough, but we couldn't find the "problem-shaped hole" in the market to fit it into. We had a solution in search of a customer base that wasn't ready to change. Again, I found myself holding a piece of "superior" technology that was destined to sit on a shelf.</p>
<h2>The Philosophy of the "Clean Exit"</h2>
<p>When you pour your life into a compiler or a startup, "giving up" feels like a betrayal of your own craft.  We fall into the <em><a href="https://en.wikipedia.org/wiki/Sunk_cost">Sunk Cost Fallacy</a></em>, believing that if we just optimize one more path or secure one more patent, the world will finally wake up and see the merit.</p>
<p>But there is a profound difference between <strong>failing</strong> and <strong>being a failure</strong>. Here is the framework I've adopted:</p>
<ul>
<li><strong>The Code is Ephemeral, the Engineer is Permanent</strong>: Chakra and Ionic were just containers for my growth. The containers leaked, and eventually, they broke. But the liquid, the expertise, the resilience, the ability to solve the "unsolvable" is still mine. I'm reminded of Bruce Lee "Be like water my friend."</li>
<li><strong>Context is King</strong>: You can write the most efficient loop in history, but if the power is cut to the building, the loop doesn't run. Moving on isn't an admission of poor quality; it’s an admission of changing context.</li>
<li><strong>Meaning vs. Utility</strong>: Just because a project didn't achieve market dominance doesn't mean it wasn't meaningful. The patents exist. The benchmarks were hit. The bridge was built perfectly; it’s not the engineer’s fault if the river changed course.</li>
</ul>
<h2>Knowing the Hour</h2>
<p>The hardest skill to learn in tech isn't a new language especially with LLMs these days; it’s the ability to look at a "perfect" piece of work and realize it’s time to walk away. We often stay too long because we want the world to validate our effort. We want the market share to reflect our IQ.</p>
<p>The world doesn't owe our code a living. When you realize the ship is split in two, or the customers aren't coming, the most logical thing you can do is take your tools and find a new shore.</p>
<p>You aren't abandoning your work. You are preserving your talent for a place where the wind is actually blowing. I have suffered from sticking around too long in the past. My rule for the last few years is give everything 18 months. If its still fun and you are seeing success stick with it. If you feel stuck move on.</p>
<blockquote>
<p>First published 4/22/26 on <a href="https://blog.farzon.org/2026/04/the-benchmarks-of-ghost-ship-on-knowing.html">blog.farzon.org</a></p>
</blockquote>
]]></content:encoded></item><item><title><![CDATA[The "Certainty Tax": Why Big Tech Will Never Use Wine or Darling  for CI]]></title><description><![CDATA[In the world of DevOps, there is an obvious, glaring financial inefficiency: macOS and Windows VMs are a rip-off. If you’re running GitHub Actions or CircleCI, a macOS runner can cost you 10x more per]]></description><link>https://codeblog.farzon.org/the-certainty-tax-why-big-tech-will-never-use-wine-or-darling-for-ci</link><guid isPermaLink="true">https://codeblog.farzon.org/the-certainty-tax-why-big-tech-will-never-use-wine-or-darling-for-ci</guid><category><![CDATA[big tech]]></category><category><![CDATA[darling]]></category><category><![CDATA[virtual machine]]></category><category><![CDATA[wine]]></category><dc:creator><![CDATA[Farzon Lotfi]]></dc:creator><pubDate>Sat, 02 May 2026 04:36:13 GMT</pubDate><content:encoded><![CDATA[<p>In the world of DevOps, there is an obvious, glaring financial inefficiency: macOS and Windows VMs are a rip-off. If you’re running GitHub Actions or CircleCI, a macOS runner can cost you <strong>10x more per minute</strong> than a standard Linux runner. For a Fortune 500 company running thousands of builds a day, that bill is staggering.</p>
<p>Theoretically, tools like <strong><a href="https://www.winehq.org/">Wine</a></strong> (for Windows apps) and <strong><a href="https://www.darlinghq.org/">Darling</a></strong> (for macOS apps) offer a "cheat code". They allow you to run native apps on dirt-cheap Linux hardware.</p>
<p>Yet, big corporations won't touch them. They’d rather set piles of cash on fire paying for native VMs. Why? Because in the modern era of software, <em>predictability is more valuable than capital</em>.</p>
<p><img src="https://blogger.googleusercontent.com/img/a/AVvXsEiT9NaaGodXo1LueKbKymJiu4RvmhrVdMoLVKgQrRDQ81t3IThr4juH8elYctH_18j6VIyc1MA-nuA54X4zv52sNB6YS9_lVKjDpIa9wUdnX3UScsnmaRCqp3Jg00CyxEc5ucnB1WiTf91XYl7Z7uWwyIMCo_0MoM_m4HbwP8old0AkfX9-CmEdRrIc5go=w397-h400" alt="Meme showing Big Techs need for Certainty" /></p>
<p>If you read my last two (<a href="https://blog.farzon.org/2026/04/the-warf-way-seamless-windows-testing.html">one</a> &amp; <a href="https://blog.farzon.org/2026/04/the-warf-way-part-ii-tackling-macos.html">two</a>) blog posts on using Wine and Darling for testing the conclusion of this post will surprise you. I know I left you with the impression that I am recommending putting these tools into your CI workflows. That is far from the truth. I think they help speed up development but should not be relied on up for behavioral correctness if you have the resources of big tech and I will explain why.</p>
<h2>1. The Death of the 80/20 Rule</h2>
<p>We used to live by the <a href="https://en.wikipedia.org/wiki/Pareto_principle">Pareto Principle</a>: focus on the 20% of code that handles 80% of the use cases. In the "99% Era," that logic is professional negligence.</p>
<p>When you have 100 million users, a "1-in-a-million" edge case happens 100 times a day. As scale increases, the "Long Tail" of software becomes the "Main Body."</p>
<p>If Wine has a slight discrepancy in how it handles a specific Windows GDI+ drawing call, and that discrepancy leads to a crash on actual Windows 11 hardware, you haven't saved money. You’ve just created the enviornment for a catastrophe.</p>
<p>For a giant like Adobe or Microsoft, an app that is "99% compatible" with its host OS is effectively broken.</p>
<h2>2. The Law of Leaky Abstractions</h2>
<p>In one of my favorite essay, <em><a href="https://www.joelonsoftware.com/2002/11/11/the-law-of-leaky-abstractions/">The Law of Leaky Abstractions</a></em>, Joel Spolsky noted that all non-trivial abstractions are, to some degree, leaky.</p>
<p>Wine and Darling are masterpieces of engineering, but they are cleanroom abstractions. They mimic how an OS <em>should</em> behave, not necessarily how it <em>does</em> behave under the stress of weird drivers, specific kernel patches, or proprietary Apple silicon quirks.</p>
<p>Corporations aren't just paying for a runner; they are paying for <strong><a href="https://ubuntu.com/blog/how-environmental-parity-accelerates-automotive-software-development">Environmental Parity</a></strong>. They need to know that if the code passes in CI, it will pass on a customer’s laptop.</p>
<p>The moment you introduce a translation layer, you introduce a "parity gap." If a test fails, your engineers now have two problems:</p>
<ul>
<li>Is the app broken?</li>
<li>Or is the abstraction (Wine/Darling) broken?</li>
</ul>
<p>Big Tech hates "fixing the test infrastructure" more than it hates high compute bills.</p>
<h2>3. The Math of Risk: Why 99.9% is a Failure</h2>
<p>To a startup, 99.9% uptime (three nines) sounds like a dream. To Amazon, it’s a nightmare.</p>
<p><strong>99.9% Uptime = 8.77 hours of downtime/year.</strong></p>
<p>The Cost: With Amazon’s revenue, an hour of downtime can cost upwards of $65 million.</p>
<p>If using a native Windows VM instead of Wine reduces the risk of a "blind spot" bug by even 0.01%, the VM has already paid for itself a thousand times over.</p>
<p>Corporations have a low-risk tolerance because their blast radius is massive. A botched release doesn't just annoy a few users; it triggers thousands of support tickets, legal SLA credits, and a permanent stain on brand equity.</p>
<h2>4. The "Certainty Tax"</h2>
<p>Ultimately, big corporations view expensive CI costs as a <strong>Certainty Tax</strong>.</p>
<p>They aren't looking for the most "clever" way to run a test; they are looking for the most "boring" way. A native macOS VM is boring. It is predictable. It is supported by a multi-billion dollar vendor you can escalate to if it breaks.</p>
<p>Wine and Darling are for the tinkers, the innovators, and the budget-conscious indies. But for the giants, the goal isn't to save a few pennies on compute. The goal is to ensure that when they hit "Deploy," the world doesn't break.</p>
<blockquote>
<p>First Published 4/21/26 on <a href="https://blog.farzon.org/2026/04/the-certainty-tax-why-big-tech-will.html">blog.farzon.org</a></p>
</blockquote>
]]></content:encoded></item><item><title><![CDATA[The Geometry of the Essential: A Look at the Seam Carving Algorithm]]></title><description><![CDATA[Consider the digital photograph. To the human eye, it is a continuous, evocative memory. May it be a face, a landscape, a fleeting moment of light and shadow. But beneath the veneer of human perceptio]]></description><link>https://codeblog.farzon.org/the-geometry-of-the-essential-a-look-at-the-seam-carving-algorithm</link><guid isPermaLink="true">https://codeblog.farzon.org/the-geometry-of-the-essential-a-look-at-the-seam-carving-algorithm</guid><category><![CDATA[C++]]></category><category><![CDATA[C]]></category><category><![CDATA[computer-photography]]></category><category><![CDATA[Computer Vision]]></category><category><![CDATA[opencv]]></category><dc:creator><![CDATA[Farzon Lotfi]]></dc:creator><pubDate>Sat, 02 May 2026 04:09:25 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/69f30a5b909e64ad078554d7/c8f02dd1-6098-4aa3-b522-a877edcab228.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Consider the digital photograph. To the human eye, it is a continuous, evocative memory. May it be a face, a landscape, a fleeting moment of light and shadow. But beneath the veneer of human perception, it is something entirely different. It is a rigid matrix. A vast, unyielding grid of pixels, each holding a specific mathematical value of light and color. It is a Cartesian plane. It is a vast, unyielding matrix of numerical values, each discrete pixel representing a specific frequency and intensity of captured light.</p>
<p>For the longest time, when we needed to alter the dimensions of these matrices to fit a new screen, we relied on the blunt tool of scaling and cropping. We would amputate the edges, or we would stretch the matrix, mathematically interpolating and distorting the very subjects we sought to preserve. It was an approach devoid of nuance.</p>
<p>But there is a far more elegant approach. It is a method that treats the image not as a static grid, but as a dynamic, topological surface. It is known as <strong>seam carving</strong> and it is one of my favorite algorithms I ever learned.</p>
<p>Instead of treating the image as a static grid, seam carving asks a deeply profound question: <em>What in this image is essential, and what is merely space?</em> By analyzing the gradient of the image. It identifies the features that draw the human eye. Then, it searches for a "seam"; a contiguous path of pixels stretching from one edge of the image to the other, winding its way exclusively through the lowest energy areas.</p>
<p>When I set out to engineer <a href="https://github.com/farzonl/SeamCarving">my implementation of this algorithm in C++</a>, my goal was to build an engine that deeply understood the anatomy of the data it was processing. I wanted to write a tool that could algorithmically discern the structural anchors of an image from the expendable, low-information expanses between them.</p>
<h3>The Topography of Light: Calculating the Gradient</h3>
<p>The first step in seam carving is a profound shift in perspective. We must teach the machine to stop looking at color, and start looking at <em>structural energy</em>.</p>
<p>In physics and mathematics, energy often reveals itself in the transitions. In an image, importance is dictated by contrast. It is where a dark shadow abruptly meets a bright cheekbone, or where the sharp geometry of a building cuts into the sky. To find these boundaries, we must apply the principles of calculus to our digital matrix. We must find the derivative.</p>
<p>I implemented this by converting the image to grayscale and passing it through <a href="https://en.wikipedia.org/wiki/Sobel_operator">Sobel filters.</a> This computes the gradient magnitude of the image, essentially generating a topographic map where high structural energy forms mountain peaks, and smooth, uniform areas form deep, quiet valleys.</p>
<p><img src="https://blogger.googleusercontent.com/img/a/AVvXsEgbZ9vpB6D0C8t1QOwgyCI98TaO0gHCF_nblsHz62GCl8MLnDli3ckRCL53m1WtohOcq7ngtixzks4R3ZjeVB2sGjujF0EGND7U-shyNa6lvSRFX8TN6Dq8vN8D690bLD0nZ9lkr0jdQ9PBCqvhqk8Y_gpNHke-eMy8SlznS8kx1L40i3N8cSJl0IsIABY" alt="Sobel filter showing energy of image" /></p>
<pre><code class="language-cpp">cv::Mat SeamCarving::computeGradientMagnitude(const cv::Mat &amp;frame) {

cv::Mat grayScale;
cv::cvtColor(frame, grayScale, cv::COLOR\_RGBA2GRAY);
cv::Mat drv = cv::Mat(grayScale.size(), CV\_16SC1);
cv::Mat drv32f = cv::Mat(grayScale.size(), CV\_32FC1);
cv::Mat mag = cv::Mat::zeros(grayScale.size(), CV\_32FC1);

// Calculate the partial derivative in the X direction
Sobel(grayScale, drv, CV\_16SC1, 1, 0);
drv.convertTo(drv32f, CV\_32FC1);
cv::accumulateSquare(drv32f, mag);

// Calculate the partial derivative in the Y direction
Sobel(grayScale, drv, CV\_16SC1, 0, 1);
drv.convertTo(drv32f, CV\_32FC1);
cv::accumulateSquare(drv32f, mag);

// The final energy map is the magnitude of the gradient vector
cv::sqrt(mag, mag);
return mag;
}
</code></pre>
<h3>The Path of Least Resistance: Dynamic Programming</h3>
<p>Once we have mapped the energy manifold of the image, the next mathematical challenge arises: how do we navigate it? We must find a "seam"—a contiguous thread of pixels stretching from the top of the matrix to the bottom, winding entirely through the paths of lowest energy.</p>
<p>This cannot be solved effectively with a greedy algorithm; choosing the lowest energy pixel at each immediate step often traps the path in a local minimum, missing the true optimal route. Instead, I utilized the profound elegance of <strong><a href="https://en.wikipedia.org/wiki/Dynamic_programming">Dynamic Programming</a></strong>.</p>
<p>The algorithm cascades down the matrix row by row. It does not just look at the present; it calculates the optimal historical path for every single node. For each pixel, it looks at the three adjacent pixels directly above it, finds the one that carries the lowest cumulative energy from the top, and incorporates it.</p>
<p><img src="https://blogger.googleusercontent.com/img/a/AVvXsEjEQZkkKuap1hbUFyOF0Ew_P1qbMxMlZ3nim3sguAlsE5ZEXZPwrMoqnhA058sTl-OPOkkOxuKA2BsdOpB6mFpL5p1PSILjYoV5jg-buocG9q1JvYroQkJIDEllHVYeK0oEEFEjkLveQOoo5JLZPbe6Dp9XxXt7tbtjRPx4pE1STsOKAMxvFNfHKs_zJdY" alt="pixel intensity image used for pathes of least resistance" /></p>
<pre><code class="language-cpp">// Within computePathIntensityMat:

// The intrinsic energy of the current pixel
float pixelIntensity = rawEnergyMap.at&lt;float&gt;(row, col);

// Retrieving the cumulative minimum intensity from the three possible upstream paths
float p1 = intensity(pathIntensityMap.at&lt;float&gt;(row-1, col-1), col - 1, pathIntensityMap.cols);
float p2 = intensity(pathIntensityMap.at&lt;float&gt;(row-1, col), col, pathIntensityMap.cols);
float p3 = intensity(pathIntensityMap.at&lt;float&gt;(row-1, col+1), col + 1, pathIntensityMap.cols);

float minIntensity = std::min(p1, p2);
minIntensity = std::min(minIntensity, p3);

// The new cumulative energy is recorded
pixelIntensity += minIntensity;
</code></pre>
<p>By the time the calculation reaches the final row, the entire matrix has been evaluated. The algorithm simply selects the absolute minimum value at the bottom boundary and traces the mathematical path of least resistance back up to the origin.</p>
<h3>Bare-Metal Architecture: Memory Manipulation</h3>
<p>Identifying the optimal seam is a triumph of mathematical logic, but executing its removal requires the brutal efficiency of computer science. To achieve real-time performance—allowing a user to dynamically scrub a slider and watch the image collapse and expand—high-level abstractions had to be discarded.</p>
<p>In my <code>removePixel</code> and <code>addPixel</code> functions, the code drops down to the bare-metal reality of pointer arithmetic and raw memory manipulation. Rather than copying arrays index by index, I calculate the exact byte offsets and use <code>memcpy</code> to shift entire contiguous blocks of memory, physically overwriting the data where the seam once existed.</p>
<p>But removing a seam leaves a mathematical discontinuity. To preserve the visual integrity of the matrix, the algorithm acts as a digital surgeon, averaging the raw byte values of the adjacent pixels to heal the seam:</p>
<pre><code class="language-cpp">// Snippet from removePixel showcasing the blending of the numerical values

int leftPixel = minCol - 1;
int rightPixel = minCol + 1;
  
// ... memory block shifting omitted for brevity ...
  
// Calculate the mean value of the surrounding bytes to close the gap gracefully

if (rightPixel &lt; width) {
  int byte1R = rawOrig[originRowStart + rightPixel \* channels];
  // ...
  rawOutput[newRowStart + minCol \* channels] = (unsigned char)((byte1 + byte1R) / 2);
}
  
if(leftPixel &gt;= 0) {
  int byte1L = rawOrig[originRowStart + leftPixel\*channels];
 // ...
 rawOutput[newRowStart + leftPixel\*channels] = (unsigned char) ((byte1 + byte1L)/2);
}
</code></pre>
<p>When you compile and run this code, you are watching a beautiful translation of concepts. You are watching calculus define the structural anchors of human perception. You are watching dynamic programming solve an immensely complex topological maze. And you are watching C++ manipulate raw memory with breathtaking speed to physically collapse the mundane spaces of the digital canvas, leaving only what is truly essential.</p>
<p>In more concrete words, seam carving finds the quiet spaces. The empty walls, the unbroken skies. And then, pixel by pixel, it delicately removes that single, imperceptible thread. The image shrinks, but the subjects remain untouched, their proportions perfectly preserved. It is resizing achieved through subtraction. Algorithms like this are a reminder that computer science is not just about making things faster or smaller; it is about finding the underlying truths of a system. Seam carving is a testament to the idea that the most profound solutions in science are those that do not fight against the nature of the data, but rather, understand it intimately, finding the path of least resistance to achieve something beautifully pristine.</p>
<blockquote>
<p>First published 4/18/26 on <a href="https://blog.farzon.org/2026/04/the-geometry-of-essential-look-at-seam.html">blog.farzon.org</a></p>
</blockquote>
]]></content:encoded></item><item><title><![CDATA[Automating C++ Code Coverage with LLVM and GitHub Actions]]></title><description><![CDATA[Setting up an automated coverage report is a powerful way to visualize the effectiveness of your test suite. This post breaks down how the warfLang repository generates and publishes its reports, movi]]></description><link>https://codeblog.farzon.org/automating-c-code-coverage-with-llvm-and-github-actions</link><guid isPermaLink="true">https://codeblog.farzon.org/automating-c-code-coverage-with-llvm-and-github-actions</guid><category><![CDATA[Clang]]></category><category><![CDATA[code coverage]]></category><category><![CDATA[GitHub Actions]]></category><category><![CDATA[LLVM-project]]></category><dc:creator><![CDATA[Farzon Lotfi]]></dc:creator><pubDate>Sat, 02 May 2026 03:47:35 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/69f30a5b909e64ad078554d7/f9b9ae24-e790-4280-98d7-7bbcfd54d344.jpg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Setting up an automated coverage report is a powerful way to visualize the effectiveness of your test suite. This post breaks down how the <a href="https://github.com/farzonl/warfLang">warfLang repository</a> generates and publishes its reports, moving from raw source code to a live site hosted on GitHub Pages.</p>
<p>We will look at how this is done using Clang and LLVM-Cov, which provides highly accurate source-based coverage.</p>
<p><img src="https://blogger.googleusercontent.com/img/a/AVvXsEh3UVv9cxst3ryptGXV2eDcrudftUH2zuJCaKUn7aABrpuKHm1xChDx5Y9JXPzsaoXtdcDIxfVzlIjlAf41AZgChxXxNfAJsd_EK8S0abcbpqv8WoVzP-JsGINvfhWf9sQQmmeTdZXjJduC_glNNaE7_1SlIwfCpWnA4FYjLTWrFrYhPRz10ds27r5KHyE" alt="Code Coverage results of WarfLang" /></p>
<h3>The Foundation: Clang and LLVM-Cov</h3>
<p>To understand the automation, we first need to look at what is happening under the hood. Unlike GCC, which traditionally uses <code>gcov</code>, Clang utilizes "Source-based Code Coverage." This method is generally more precise because it maps coverage directly to the <a href="https://en.wikipedia.org/wiki/Abstract_syntax_tree">Abstract Syntax Tree (AST)</a>.</p>
<p>To enable this, we use two critical compiler flags:</p>
<ul>
<li><strong><code>-fprofile-instr-generate</code></strong>: Tells the compiler to insert counters into the code to track how many times each block is executed.</li>
<li><strong><code>-fcoverage-mapping</code></strong>: Adds metadata to the binary that associates these counters with specific source code locations.</li>
</ul>
<blockquote>
<p><em>(Note: If you are migrating to Clang or want to understand how these flags interact with tools like CTest, <a href="https://www.kgmw.ch/posts/clang-coverage/">Kaspar Giger’s guide on Clang Coverage</a> is an excellent primer).</em></p>
</blockquote>
<h3>Step 1: Configuring the Build in GitHub Actions</h3>
<p>In the <a href="https://github.com/farzonl/warfLang/blob/master/.github/workflows/coverage-report.yml"><code>coverage-report.yml</code> workflow</a>, the first step is configuring CMake to use Clang and apply these flags.</p>
<pre><code class="language-cmake">cmake \(GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=\)BUILD_TYPE \
  -DCMAKE_CXX_FLAGS="-fprofile-instr-generate -fcoverage-mapping" \
  -DCMAKE_C_COMPILER=clang \
  -DCMAKE_CXX_COMPILER=clang++
</code></pre>
<p>It is crucial to remember that the linker also needs the <code>-fprofile-instr-generate</code> flag to ensure the final executable is capable of writing the coverage data at runtime.</p>
<h3>Step 2: Generating <code>.profraw</code> Files</h3>
<p>When you run a binary compiled with these flags, it doesn't output a readable report immediately. Instead, it produces a <code>.profraw</code> (Profile Raw) file. This is a highly efficient, compact binary format that contains the raw counter data.</p>
<p>The <code>warfLang</code> workflow uses the <code>LLVM_PROFILE_FILE</code> environment variable to explicitly name the output file so it isn't overwritten:</p>
<pre><code class="language-shell">LLVM_PROFILE_FILE="warfLang.profraw" ./build/test/warfLang_TEST
</code></pre>
<p>If you are curious about what exactly is happening inside these binary files, <a href="https://leodido.dev/demystifying-profraw/">Leo Di Donato wrote a fascinating deep-dive demystifying the <code>.profraw</code> format</a>, explaining how the headers, function hashes, and execution counters are structured.</p>
<h3>Step 3: Merging into <code>.profdata</code></h3>
<p>Because a project might involve multiple test runs (e.g., unit tests, CLI tests, integration tests), you often end up with multiple <code>.profraw</code> files. To create a unified report, you must merge them using <code>llvm-profdata</code>.</p>
<pre><code class="language-shell">llvm-profdata merge -sparse warfLang*.profraw -o warfLang.profdata
</code></pre>
<p>The <code>-sparse</code> flag is a useful optimization that reduces the size of the output <code>.profdata</code> file by omitting empty or zero-count blocks.</p>
<h3>Step 4: Creating the HTML Report</h3>
<p>Once we have the merged <code>.profdata</code>, we use <code>llvm-cov show</code> to generate the actual visual report. This step requires the original binary because the mapping between the counters and the source code is still stored within that executable.</p>
<pre><code class="language-shell">llvm-cov show -output-dir=build/out/report -format=html \
  -instr-profile=warfLang.profdata \
  -object=build/test/warfLang_TEST \
  build/src/cli/warfLang src
</code></pre>
<ul>
<li><strong><code>-object</code></strong> : Specifies the binary files to look in for coverage mapping.</li>
<li><strong><code>-format=html</code></strong> : Generates an interactive website.</li>
<li><strong><code>src</code></strong> : Tells the tool which directory contains the source code to be mapped.</li>
</ul>
<h3>Step 5: Publishing to GitHub Pages</h3>
<p>The final piece of the puzzle is making the <code>build/out/report</code> directory accessible online. The <code>warfLang</code> workflow achieves this by initializing a new git repository inside that directory, committing the HTML files, and force-pushing it to a dedicated branch (<code>gh-pages-coverage</code>).</p>
<pre><code class="language-yaml">- name: Force push to destination branch
  uses: ad-m/github-push-action@master
  with:
    github_token: ${{ secrets.GITHUB_TOKEN }}
    branch: gh-pages-coverage
    directory: ${{github.workspace}}/build/out/report
</code></pre>
<p>By pointing GitHub Pages to the <code>gh-pages-coverage</code> branch, the report becomes live at <a href="https://farzon.org/warfLang/coverage/"><strong>farzon.org/warfLang/coverage/</strong></a>. This creates a seamless CI/CD loop: every push to the master branch triggers a build, runs tests, generates a new report, and updates the public-facing coverage site automatically.</p>
<hr />
<h3>Resources for Deeper Learning</h3>
<p>If you want to explore the underlying tools and mechanics further, these articles provide excellent context:</p>
<ul>
<li><strong><a href="https://www.kgmw.ch/posts/clang-coverage/">Code Coverage with Clang</a> by Kaspar Giger</strong>: A great overview of the Clang compiler flags and how to integrate them cleanly using CMake.</li>
<li><strong><a href="https://leodido.dev/demystifying-profraw/">Demystifying the profraw format</a> by Leo Di Donato</strong>: A technical deep-dive into the LLVM source code to explain exactly what is written into a <code>.profraw</code> binary file.</li>
<li><strong><a href="https://medium.com/@sag50692/code-coverage-with-llvm-cov-16639b71f6a5">Code coverage with llvm-cov</a> by Anastasiia</strong>: A practical, step-by-step tutorial on local coverage generation, merging, and setting up CMake for GoogleTest.</li>
</ul>
<blockquote>
<p>First published 4/17/26 on <a href="https://blog.farzon.org/2026/04/automating-c-code-coverage-with-llvm.html">blog.farzon.org</a></p>
</blockquote>
]]></content:encoded></item><item><title><![CDATA[Bringing HLSL Support to Clangd: The HLSL teams  first GSoC project]]></title><description><![CDATA[I am thrilled my team is sponsoring our first of many featured project for the 2026 Google Summer of Code Enable Clangd support for HLSL.
If you are a student developer interested in compilers, develo]]></description><link>https://codeblog.farzon.org/bringing-hlsl-support-to-clangd-the-hlsl-teams-first-gsoc-project</link><guid isPermaLink="true">https://codeblog.farzon.org/bringing-hlsl-support-to-clangd-the-hlsl-teams-first-gsoc-project</guid><category><![CDATA[gsoc2026]]></category><category><![CDATA[#HLSL]]></category><category><![CDATA[LLVM-project]]></category><dc:creator><![CDATA[Farzon Lotfi]]></dc:creator><pubDate>Sat, 02 May 2026 03:30:33 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/69f30a5b909e64ad078554d7/880d1e3f-be7f-465a-aee5-d152b79c266a.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>I am thrilled my team is sponsoring our first of many featured project for the <strong>2026 Google Summer of Code</strong> <a href="https://llvm.org/OpenProjects.html#enable-clangd-hlsl-support">Enable Clangd support for HLSL</a>.</p>
<p>If you are a student developer interested in compilers, developer tooling, or graphics programming, this is a unique opportunity to contribute to the LLVM ecosystem and improve the lives of thousands of shader developers.</p>
<h3>What is HLSL and Clangd?</h3>
<p><strong><a href="https://learn.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl">HLSL</a></strong> (High-Level Shader Language) is the primary language used for GPU shader programming in <a href="https://devblogs.microsoft.com/directx/landing-page/">DirectX</a> and <a href="https://www.vulkan.org/">Vulkan</a> via <a href="https://www.khronos.org/spirv/">SPIR-V</a> environments. Currently, there is a massive effort underway to bring first-class HLSL support directly into Clang.</p>
<p><strong><a href="https://clangd.llvm.org/">Clangd</a></strong> is the language server (<a href="https://en.wikipedia.org/wiki/Language_Server_Protocol">LSP</a>) that provides IDE features like code completion, go-to-definition, and refactoring for C++. Since HLSL is built on the C++11 standard, clangd already "mostly" works, but it struggles with HLSL-specific constructs. This project aims to close that gap.</p>
<h3>The Project Goal</h3>
<p>The objective is to move from "semi-functional" to "holistic" support. This isn't just about writing code; it’s about understanding the nuances of a domain-specific language and designing how tools should interact with it.</p>
<h3>The Roadmap</h3>
<ol>
<li><strong>Survey</strong>: Identify exactly where clangd breaks when handling HLSL.</li>
<li><strong>Architect</strong>: Write an RFC (Request for Comments) to propose how clangd should handle these unique language constructs.</li>
<li><strong>Implement</strong>: Begin the groundwork and implementation to fix these gaps.</li>
</ol>
<h3>Project Details</h3>
<ul>
<li><strong>Size</strong>: Medium (~180 hours)</li>
<li><strong>Difficulty</strong>: Medium</li>
<li><strong>Mentors</strong>: My teammates Finn Plummer and Ashley Coleman</li>
<li><strong>Required Skills</strong>: Intermediate C++, an understanding of LSPs, and a hunger to learn the HLSL specification.</li>
</ul>
<h3>Why apply?</h3>
<p>By taking on this project, you’ll be mentored by two bright engineers who are deeply involved in the LLVM and HLSL space. You will gain hands-on experience with the LLVM codebase which is one of the most influential open-source projects in the world and your work will directly improve the developer experience for gpu compilers.</p>
<h3>How to Get Involved</h3>
<p>If you’re interested in applying, we encourage you to join the conversation early!</p>
<ul>
<li><a href="https://llvm.org/OpenProjects.html#enable-clangd-hlsl-support"><strong>Official LLVM Project Listing</strong></a></li>
<li><a href="https://discourse.llvm.org/t/gsoc-2026-enable-clangd-support-for-hlsl/89664"><strong>Discussion Thread</strong></a></li>
</ul>
<p>Feel free to reach out on the LLVM Discourse or Discord to introduce yourself and ask questions. We can’t wait to see what you’ll build!</p>
<blockquote>
<p>First published 4/17/26 on <a href="https://blog.farzon.org/2026/04/bringing-hlsl-support-to-clangd-hlsl.html">blog.farzon.org</a></p>
</blockquote>
]]></content:encoded></item><item><title><![CDATA[Intel’s Clean-Slate Bet on the Future of Linux Gaming]]></title><description><![CDATA[Intel recently merged “Jay” a clean-slate shader compiler backend into Mesa. While Intel already has a mature compiler stack in the legacy BRW backend, Jay represents a fundamental shift in how Intel ]]></description><link>https://codeblog.farzon.org/intel-s-clean-slate-bet-on-the-future-of-linux-gaming</link><guid isPermaLink="true">https://codeblog.farzon.org/intel-s-clean-slate-bet-on-the-future-of-linux-gaming</guid><category><![CDATA[gaming]]></category><category><![CDATA[Intel]]></category><category><![CDATA[Linux]]></category><category><![CDATA[mesa]]></category><dc:creator><![CDATA[Farzon Lotfi]]></dc:creator><pubDate>Sat, 02 May 2026 03:15:22 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/69f30a5b909e64ad078554d7/3336bc39-dd88-4993-bdbb-1195d932e9c3.jpg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Intel recently merged <a href="https://www.phoronix.com/news/Intel-Jay-Mesa-Shader-Compiler"><strong>“Jay”</strong></a> a clean-slate shader compiler backend into Mesa. While Intel already has a mature compiler stack in the <a href="https://github.com/intel/external-mesa/tree/master/src/mesa/drivers/dri/i965">legacy BRW backend</a>, Jay represents a fundamental shift in how Intel GPUs handle code on Linux. You can track the technical implementation in the <a href="https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40835">official merge request here</a>.</p>
<p><img src="https://blogger.googleusercontent.com/img/a/AVvXsEiiNCRFnpmA22oIhW5tJe-gj2pipt3l2z6xZfMuG5gJB58bxKo_taLWPkbntX-ErF8OAl7aFMPPfmrco1iLG0O9VHxfKz-H99BhtGGIRfFBordtRvCszIT0rMjPTt_PGaDMKalqtZu8JX1zMloDAkA9F0e3Dq4XQQgIPrmyGyHEcDrl-QKaHELlAFCcajw" alt="merged Intel Jay commit into Mesa" /></p>
<h3>The Problem: Architectural Evolution</h3>
<p>The existing BRW backend has been the workhorse of Intel's Linux drivers for years. However, it was designed for a different era of hardware. Over time, as GPUs moved toward more complex, "scalar" architectures, the legacy backend became increasingly difficult to extend.</p>
<ul>
<li><strong>The Core Issue</strong>: Modern shaders speak a language called <a href="https://docs.mesa3d.org/nir/index.html">NIR (New Intermediate Representation).</a> BRW, being older, requires significant translation logic to understand NIR, which adds complexity to the driver.</li>
<li><strong>The Solution</strong>: Jay is built to be native to NIR. By speaking the same language as the rest of the Mesa stack, it removes unnecessary translation layers and provides a direct path to the hardware.</li>
</ul>
<h3>Strategic Context: A Fresh Perspective</h3>
<p>The project is being led by <strong><a href="https://en.wikipedia.org/wiki/Alyssa_Rosenzweig">Alyssa Rosenzweig</a></strong>, known for her work on the <a href="https://asahilinux.org/">Asahi Linux</a> and <a href="https://www.vulkan.org/news/auto-22681-3f76831f0f74490061d335daccd0b544">Honeykrisp GPU drivers</a>. Her involvement brings a specific engineering philosophy to the table: building lean, "domain-specific" compilers.</p>
<p>This follows a successful industry blueprint. Much like <a href="https://www.phoronix.com/news/ACO-Scheduler-Heuristics">Valve’s <strong>ACO</strong> compiler</a>significantly improved AMD’s Vulkan performance on Linux by providing a specialized alternative to general-purpose tools, Jay is designed to give Intel hardware a high-speed lane optimized specifically for gaming and modern compute.</p>
<h3>Why not just use LLVM?</h3>
<p>It’s a fair question Intel’s Windows drivers use an LLVM-based stack and there are many GPU backends supported in llvm like <a href="https://github.com/llvm/llvm-project/tree/main/llvm/lib/Target/DirectX">DirectX</a>, <a href="https://github.com/llvm/llvm-project/tree/main/llvm/lib/Target/SPIRV">SPIR-V</a>, <a href="https://github.com/llvm/llvm-project/tree/main/llvm/lib/Target/AMDGPU">AMDGPU</a>, and <a href="https://github.com/llvm/llvm-project/tree/main/llvm/lib/Target/NVPTX">NVPTX</a>. However, as <a href="https://www.phoronix.com/news/Intel-Jay-Compiler-Merged-Mesa">Phoronix recently detailed</a>, the Linux ecosystem is built differently:</p>
<ol>
<li><strong>Streamlined Pipeline</strong>: Converting NIR --&gt; LLVM IR --&gt; Machine Code adds extra steps. Jay keeps everything "in-house," ensuring that optimizations aren't lost in translation.</li>
<li><strong>Swift Compilation</strong>: LLVM is a massive, multi-purpose framework. Jay is a precision tool designed to do one thing—generate Intel machine code—with as little latency as possible.</li>
</ol>
<h3>The Technical "Flare"</h3>
<p>What makes Jay actually exciting for the end user?</p>
<ul>
<li><strong>Snappier Gaming</strong>: Early testing suggests Jay can be <strong>up to 3x faster</strong> at compiling shaders than the old backend. In the world of modern gaming, this is the difference between a smooth launch and a stutter-filled first five minutes of gameplay. Does this perhaps mean Intel can ride the Linux Gaming wave Steam started? Time will tell.</li>
<li><strong>SSA</strong>: Jay remains in <strong>SSA (Static Single Assignment)</strong> form much deeper into the compilation process. This allows it to make incredibly "smart" decisions about where data lives, leading to more efficient execution on the GPU.</li>
<li><strong>Future-Proofing</strong>: A clean-slate codebase means Intel can bring support for new architectures, like Xe2 and beyond, to the Linux community much faster.</li>
</ul>
<h3>The Bottom Line</h3>
<p>Jay isn't a new driver; it’s a high-performance engine <em>inside</em> the existing driver stack. By trading legacy baggage for a design that fits the modern Mesa architecture, Intel is ensuring its Linux stack remains fast, lean, and ready for the next generation of hardware.</p>
<blockquote>
<p>First published 4/16/26 on <a href="https://blog.farzon.org/2026/04/intels-clean-slate-bet-on-future-of.html">blog.farzon.org</a></p>
</blockquote>
]]></content:encoded></item><item><title><![CDATA[Beyond Rosetta 2: Why the "Living Binary" Is the Future of Silicon]]></title><description><![CDATA[The tech world is currently witnessing the end of an era. Apple has officially updated its documentation to signal the beginning of the end for Rosetta 2. While we knew this day would come, it’s worth]]></description><link>https://codeblog.farzon.org/beyond-rosetta-2-why-the-living-binary-is-the-future-of-silicon</link><guid isPermaLink="true">https://codeblog.farzon.org/beyond-rosetta-2-why-the-living-binary-is-the-future-of-silicon</guid><category><![CDATA[Apple]]></category><category><![CDATA[iBOT,]]></category><category><![CDATA[Intel]]></category><category><![CDATA[Rosetta 2 Emulation]]></category><dc:creator><![CDATA[Farzon Lotfi]]></dc:creator><pubDate>Sat, 02 May 2026 03:03:19 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/69f30a5b909e64ad078554d7/3d90a5f3-66cc-44b7-9d03-24052c33b71d.webp" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>The tech world is currently witnessing the end of an era. Apple has officially updated its documentation to signal the <a href="https://developer.apple.com/documentation/apple-silicon/about-the-rosetta-translation-environment">beginning of the end for Rosetta 2</a>. While we knew this day would come, it’s worth pausing to appreciate the sheer technical wizardry that changed our expectations of software forever. Rosetta 2 wasn't just a bridge; it was the father of the <strong>"Living Binary."</strong></p>
<p><img src="https://blogger.googleusercontent.com/img/a/AVvXsEgLxvu5BG2d7tErQNGAxo9bd8QUMyzdFMiCozTCMmmB2V8dvFGXHEbaC9H12IKdeG1eZ4Wyb-D1w8cjK7Z98cnjUUrU2uVjVQUIWJXgQyxhxy4Da3oyIB5Ywxab2If9q0GAE2ZpUNdKwBoloiqOGcVCuxbVtfvA8-1WrVqVCk_7BMYkn8PsbcNCbgKG4LQ" alt="Rosetta2 graphic" /></p>
<p> When Apple moved to its own silicon, they shocked the industry with a solution that could transparently translate x64 binaries to Aarch64. You could take an old program, compiled years ago for an old CPU, and it just ran at high speed on a totally different architecture. It proved that code doesn't have to be a static snapshot of the past. </p>
<h2>The Magic of Rosetta 2: Why Was It So Fast?</h2>
<p>Translation layers were once synonymous with "sluggish." Rosetta 2 changed that narrative by marrying hardware and software in a way we hadn't seen before. As researcher <a href="https://dougallj.wordpress.com/2022/11/09/why-is-rosetta-2-fast/">Dougall Johnson</a> noted, the secret was a unique hardware-level support for <strong>Total Store Ordering (TSO)</strong>.</p>
<p>By building x86-style memory logic directly into the M-series chips, Apple eliminated the massive performance "tax" that usually kills translated apps. Combined with <strong>Ahead-of-Time (AOT)</strong> recompilation, and <strong>SSE2</strong> to <strong>NEON</strong> emulation Rosetta 2 effectively "re-authored" software at the moment of installation, ensuring that even ancient binaries felt like native, modern apps.</p>
<h2>The Rise of the "Living Binary"</h2>
<p>The true legacy of Rosetta 2 is the realization that software binaries don't have to be static.</p>
<p>Historically, developers have been forced to target "generic" CPUs; essentially a lowest-common-denominator approach to ensure their apps run on everything from a 2015 laptop to a 2026 workstation. The result? Modern CPUs have "fancy" features that software never uses. Developers lack the incentive to constantly re-optimize for every new chip iteration, and "old" software rarely benefits from "new" hardware features. This is a problem Apple does not have especially after two Instruction Set Architecture (ISA) migrations.</p>
<p>While Rosetta 2 did not pioneered this idea, it did prove that on-the-fly recompilation is a workable solution to take advantage of all the new silicon features. This idea is now being adopted by the rest of the industry. We are entering an era where the hardware manufacturer takes over the job of optimization.</p>
<h2>Intel iBOT: The Idea Lives On</h2>
<p>We are seeing this philosophy manifest in tools like <a href="https://www.intel.com/content/www/us/en/support/articles/000102604/processors.html"><strong>Intel’s iBOT (Intel Binary Optimization Tool)</strong></a>. Much like Rosetta 2, iBOT optimizes x64 binaries on the fly, taking advantage of more modern and performant instructions that the original developer never targeted.</p>
<ul>
<li><strong>Free Performance</strong>: Recent reports show an average <strong>8% performance boost</strong> on popular games just by using these optimization layers.</li>
<li><strong>Breaking the Generic Bottleneck</strong>: Instead of running generic code, the processor "re-writes" the binary to use the specific, powerful features of the latest silicon.</li>
<li><strong>Software Longevity</strong>: Your software is no longer "stuck" in the year it was compiled; it evolves to match the system it's running on.</li>
</ul>
<h2>The "Invisible Engine" Legacy</h2>
<p>As Apple begins to phase out Rosetta 2, its legacy is secured. It killed the idea that a binary is a finished, unchangeable product. It taught the industry that the best way to handle the gap between old code and new chips is to build a system smart enough to optimize itself.</p>
<p>Rosetta 2 is leaving the stage, but the <strong>"Living Binary"</strong> era it inspired is just beginning to run.</p>
<blockquote>
<p>First published 4/15/26 on <a href="https://blog.farzon.org/2026/04/beyond-rosetta-2-why-living-binary-is.html">blog.farzon.org</a></p>
</blockquote>
]]></content:encoded></item></channel></rss>