‹ BackHN Continuity

Thread

Microsoft agentically ports Copilot runtime to Rust for $120K

48 points · 62 comments · pjmlp

Loading the complete thread in the background. This saved snapshot is available now. Refresh

  1. tecoholic · · focus · HN ↗

        One of the thorniest conversions was the session.ts file, which was over 30,000 lines of TypeScript that touched all aspects of the runtime.
    
    This can’t be real. Single file with 30K lines? Which human being is working on it and how much RAM does it take for a code editor to load that with full symbol tree? I am genuinely curious. Is this common? I think most files I come across stretch to maybe 2-3k lines max.
    1. smitty1e · · focus · HN ↗
      Was the documentation for each function a full-on essay?
    2. formerly_proven · · focus · HN ↗
      > Which human being is working on it

      If you've ever used that tool you wouldn't ask this question, since it's obviously fully vibecoded.

    3. wayvey · · focus · HN ↗
      I recently saw a ~60k lines / 3mb .cpp file in one vibe coded project (and yes I was a bit horrified) Surprised it works at all but it apparently does. Not really for a human though and even for an LLM it would be more beneficial for it to be split up.
      1. NewsaHackO · · focus · HN ↗
        This has to be 1) early LLM vibe coding or 2) “hand” vibe codingwhere the user asked the LLM to code sections and stitches them together manually, and the programmer is a novice. The second part I speak from experience; got to ~2k before realizing this is out of the script range and started to break it up. Regardless, it would be almost impossible to get an SOTA LLM agent to ever do this.
        1. applfanboysbgon · · focus · HN ↗
          It is very possible. Sol Max created a 17k line file in a prototype not long ago. If I didn't stop it and make it refactor everything it easily would have went to 60k. I think it's the default if you start a new project and don't define the architecture concretely with files and folders beforehand. Models have zero concept of architecture or long-term planning, they just band-aid the fastest immediate solution that gets them the reward.
          1. phoghed · · focus · HN ↗
            I find that specifically when you tell it you’re doing a prototype or POC, it takes that as a license to write huge single files and other shit coding practices.
      2. perching_aix · · focus · HN ↗
        [delayed]
        1. dgellow · · focus · HN ↗
          In the cpp that’s indeed relatively normal for complex projects
    4. Rexxar · · focus · HN ↗
      30000 is not that big in very old projects with many contributors. There are always one or two files that no one wants to take the time and responsibility to clean up. And 30000 is not a big number for RAM. The fact that you find it choking is more and of an indication of how bad our tools have become than anything else.

      For example, until recently the main file for donet runtime GC was more than 50000 lines (it has since been split).

      1. skrebbel · · focus · HN ↗
        Copilot isn’t very old.
        1. solarkraft · · focus · HN ↗
          I’m sure it has changed a lot since inception
    5. sajithdilshan · · focus · HN ↗
      The question should be how can they ever let that file grow that big. What kind of engineers were working on that, like I hate seeing any file more than 300-400 lines of code
      1. dgellow · · focus · HN ↗
        If well organized the number of lines of code in a file is really irrelevant. 300-400 loc is a tiny file in any professional project. Splitting in a large number of file doesn’t magically make things simpler to manage, in fact you fragment the context by doing that. And very likely end up with unnecessary abstractions
        1. sajithdilshan · · focus · HN ↗
          I disagree, that makes it more readable, maintainable and testable. Just because everything is in one file doesn’t mean you’ll be able to build the context, you’d forget what was at the start of the file when you get to the bottom of it if it’s like 3k lines
          1. dgellow · · focus · HN ↗
            We don’t read a source file as a book, from the first line to the last one. A file is just a set of classes, functions, types, constants, and you generally navigate it by blocks. Splitting multiple functions, classes into multiple files just to match an arbitrary number of lines is bad engineering, prioritizing a dogmatic approach instead of a thoughtful one. File units should have a meaning. And there are quite a lots of situation where keeping more things tied together in the same file is a meaningful thing to do, even if the file is itself large. There is an argument for avoiding extremely large files based on the impact on the resulting artifact, but lots of tiny files (400loc is really short) pretty much always results in duplicated logic and over engineering
    6. Zanfa · · focus · HN ↗
      Behold the View.java[0] at 34k lines of human code. IIRC it’s slimmed down a bit these days and used to be more.

      [0] <a href="https:&#x2F;&#x2F;android.googlesource.com&#x2F;platform&#x2F;frameworks&#x2F;base&#x2F;+&#x2F;master&#x2F;core&#x2F;java&#x2F;android&#x2F;view&#x2F;View.java" rel="nofollow">https:&#x2F;&#x2F;android.googlesource.com&#x2F;platform&#x2F;frameworks&#x2F;base&#x2F;+&#x2F;...

      1. tecoholic · · focus · HN ↗
        Wow. Somehow I feel my software creds just went by a notch by the mere existence of these files.
    7. brewmarche · · focus · HN ↗
      Until recently the .NET garbage collector used to be a single 30,000+ lines C++ file. And it was maintained by one person if I remember correctly.
      1. tecoholic · · focus · HN ↗
        Amazed and horrified at the same time.
        1. brewmarche · · focus · HN ↗
          Just checked it and I underestimated. Just before the split it was at 54k LOC: &lt;<a href="https:&#x2F;&#x2F;github.com&#x2F;dotnet&#x2F;runtime&#x2F;blob&#x2F;b96f3cc738f7fca9474fbe1116148b118eb6563e&#x2F;src&#x2F;coreclr&#x2F;gc&#x2F;gc.cpp" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;dotnet&#x2F;runtime&#x2F;blob&#x2F;b96f3cc738f7fca9474fb...&gt;

          I’ve also read that a first version of the file came from a Common Lisp to C++ code generation step: &lt;<a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=23295041">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=23295041&gt;

  2. Rexxar · · focus · HN ↗
    They don&#x27;t have to tell us they are vibe coding everything.

    - there are now ridiculous vibe coded localisation in VS2026

    - task manager started to not report cpu usage correctly recently (the number becomes stalled)

    - file explorer display the &quot;loading&quot; icon infinitely on some directories

    - and many other things!

    1. chrischen · · focus · HN ↗
      The line between vibe coding and just coding has now moved. Vibe coding is specifically when the output is not understood by the prompter. Even in the back in the days of the earlier models i used the models to do my basic typing because it was easier than me typing it out…
      1. Icathian · · focus · HN ↗
        Your reply misunderstands the parent comment, I think. MS devs clearly don&#x27;t understand their output given how garbage it is.
        1. fingerlocks · · focus · HN ↗
          We’re not allowed to understand it. Gotta hit your PR quota to keep your job. I wish I was joking.
    2. sharktheone · · focus · HN ↗
      Even if they wouldn&#x27;t be vibecoding. They were able to write slop before AI
    3. GrayShade · · focus · HN ↗
      &gt; file explorer display the &quot;loading&quot; icon infinitely on some directories

      Nautilus had that feature 10 years ago, good to hear they&#x27;ve reached parity.

      1. edg5000 · · focus · HN ↗
        I love Nautilus, but the one I run (42.6) still has that ocasionally. May be fixed in latest stable by now though.
    4. solarkraft · · focus · HN ↗
      That just sounds like normal Microsoft software to me, since way before vibe coding.
      1. szatkus · · focus · HN ↗
        Random infinite loading in Explorer has been there for years at least.
      2. pjmlp · · focus · HN ↗
        While I partially agree, it seems to have paid out, including among several key projects that Web development nowadays cannot live without.
  3. amelius · · focus · HN ↗
    Still hoping for a company to agentically port the python ecosystem to GIL-free python.
    1. andrewstuart · · focus · HN ↗
      I did a lot of benchmarking of Gil free python.

      Greenlets were much faster.

      Gil free python gets stuck on all sorts of python locks. It’s slow.

    2. rienbdj · · focus · HN ↗
      Easier to port the required libraries to another language at this point.
      1. amelius · · focus · HN ↗
        I&#x27;d certainly like to see more of this, yes. It would be great if scipy, numpy, pytorch, etc. would be available universally, if only because you&#x27;d use the same function names in every language.

        And if LLMs are as great as they make us believe they are, then this should be easily possible.

  4. andrewstuart · · focus · HN ↗
    Can we not say “agentically” please?
  5. perching_aix · · focus · HN ↗
    Is that why session compaction stopped working for me in VS Code at the end of this week, or is that just the integrated extension itself having a normal one?

    Though it&#x27;s the same extension that can&#x27;t keep its session timestamps straight, randomly hides sessions I was just in (then suddenly remembers them after going in and out of a session), and completely shits itself visually when using OpenAI&#x27;s models, so maybe it really is just the latter.

  6. dmix · · focus · HN ↗
    &gt; agents converted 430,000 lines of TypeScript into 800,000 lines of production Rust

    The +400k new lines were probably code comments the agents added to everything

    1. codegladiator · · focus · HN ↗
      I am betting on tests of tests and tests of comments and docs
    2. [deleted] · · focus · HN ↗

      [deleted]

    3. meerita · · focus · HN ↗
      832K + 469k of tests.
  7. hollowturtle · · focus · HN ↗
    &gt; The original TypeScript implementation completed 7.55 of those lifecycles per second, while Rust running in-process managed 120 per second - representing a 15.9x speedup on that particular workload.

    Does this impresses&#x2F;surprises anyone? Two folds: 1) I believe the most optimized JavaScript code could near the performance of this phase 1 port without optimizations. I would have gone with that first, many would think that would not be as cost efficient but: 2) optimizing the rust code will require 10x the effort of the 1 by 1 conversion, just because you now need idiomatic rust code that likely has nothing to do with a plain translation. So defeating the initial gain, there&#x27;s nothing to do the bottleneck gets just pushed elsewhere

  8. meerita · · focus · HN ↗
    I wrote to the post of Andrea (a dev from the Copilot team) about their 800K LoC: 128 PRs, shipped incrementally. Existing end-to-end tests ran against the new code at every step.

    Total: ~1,301,378 lines of Rust.

    Production: 832,378 Unit tests: ~469,000 Combined: ~1.30 million lines

    On top of the 832K LoC are mostly tests she answered:

    &gt; Yeap, 832,378 lines of production Rust. the +800K number is production only; unit tests are another +469K on top.

    <a href="https:&#x2F;&#x2F;x.com&#x2F;acolombiadev&#x2F;status&#x2F;2100660224298193081?s=20" rel="nofollow">https:&#x2F;&#x2F;x.com&#x2F;acolombiadev&#x2F;status&#x2F;2100660224298193081?s=20

    1. jsnell · · focus · HN ↗
      &gt; Half of the 832K LoC are mostly tests she answered:

      No? That quote is clearly saying the opposite of your summary.

      1. meerita · · focus · HN ↗
        True! I edited.
  9. iamgopal · · focus · HN ↗
    why golang lost to rust ?
    1. asp_hornet · · focus · HN ↗
      &gt; The software engine underpinning GitHub Copilot and a growing number of Microsoft products

      I’m guessing so it can interop easier with C&#x2F;C++ codebases? Just a stab in the dark, I have no idea.

    2. Havoc · · focus · HN ↗
      Either would have worked, but rust&#x27;s fussy compiler &amp; memory features is an advantage for LLMs. The more bug catching you can shift out of runtime and into compile time the better since the LLM can fix it
      1. hollowturtle · · focus · HN ↗
        go is even more straightforward for llms imo. It&#x27;s a dead simple language with a good garbage collector, where you can still do a lot memory management
        1. Havoc · · focus · HN ↗
          Simplicity is a feature too.

          &gt; you can still do a lot memory management

          That’s kinda my point - you don’t really want to trust the LLM to get any sort of memory management right. A system where hard constraints are baked into the language itself and the LLM fights the compiler at compile time removes a lot of hoping the LLM got it right.

          Ultimately either works though so use whatever you enjoy

    3. OutOfHere · · focus · HN ↗
      I wouldn&#x27;t say it has lost. Big firms like Microsoft and Amazon are just afraid to use Go since it&#x27;s by Google, a known evil firm.
  10. baxuz · · focus · HN ↗
    The fuck does &quot;agentically&quot; mean
    1. mg74 · · focus · HN ↗
      Probably that they used dynamic workflows to run long agent sessions to do the conversion, like Anthropic did when they ported Bun from Zig to Rust. Minimize Human in the Loop workflows, maximize Agents in the Loop workflows.
    2. dgellow · · focus · HN ↗
      That’s they used Claude
      1. OutOfHere · · focus · HN ↗
        Nope, that&#x27;s the incorrect answer. One can do agentic development without using Claude. Any coding model with tools will do.
        1. dgellow · · focus · HN ↗
          Obviously…
          1. [deleted] · · focus · HN ↗

            [deleted]

    3. supermatt · · focus · HN ↗
      It’s the adverb of agentic, which is an adjective to describe something as having agency.
    4. alex_duf · · focus · HN ↗
      Using agents?
    5. OutOfHere · · focus · HN ↗
      Did you just wake up after a multi year slumber? Agentically means using tools. It means the workflow isn&#x27;t predefined. It also spawned subagents.
  11. jdw64 · · focus · HN ↗
    Now I&#x27;m starting to really feel that I should use Rust, but I have no idea where to actually apply it.
  12. Havoc · · focus · HN ↗
    Can they port their m365 chat UI too?

    Don&#x27;t know what tech stack it is but I&#x27;m guessing electron judging by how buggy and slow it is

  13. aniceperson · · focus · HN ↗
    they ported their coding harness, something known for being simply an extensible http and subprocess wrapper, into a monolithic blob. They took their bloated and slow coding harness, and turned into an un-maintanable blob.
  14. blacklimetea · · focus · HN ↗

    [dead]

  15. pinkmoonx · · focus · HN ↗

    [dead]

  16. turowicz · · focus · HN ↗
    They really built that shit in TS? Mad!
  17. ChrisArchitect · · focus · HN ↗
    Source: <a href="https:&#x2F;&#x2F;github.blog&#x2F;ai-and-ml&#x2F;generative-ai&#x2F;migrating-the-github-copilot-runtime-to-rust-using-copilot&#x2F;" rel="nofollow">https:&#x2F;&#x2F;github.blog&#x2F;ai-and-ml&#x2F;generative-ai&#x2F;migrating-the-gi...
  18. mixxit · · focus · HN ↗
    I&#x27;m slowing moving everything to kubuntu and have for some time has it in my non work life

    Really nothing works anymore as great a product full fat visual studio and windows 7 was I don&#x27;t have time to deal with your bugs

Open on Hacker News to reply ↗

Unofficial Hacker News client; not affiliated with Y Combinator.