[{"data":1,"prerenderedAt":325},["ShallowReactive",2],{"project-43632373":3},{"id":4,"name":5,"line":6,"line_source":7,"title":8,"url":9,"domain":10,"maker":11,"posted_at":12,"year":13,"points":14,"comments":15,"rank_in_year":16,"shown_in_year":17,"top":18,"tier":19,"category":20,"subcategory":21,"format":22,"keywords":23,"reception":28,"sentiment":29,"stance_mix":30,"scored_comments":35,"aspects":36,"strip":44,"post_text":46,"what":47,"said":90,"maker_in_thread":190,"shape":202,"grid":207,"attempts":290,"same_week":291,"maker_shows":31,"maker_hidden":318,"reader_version":319,"card":320},"43632373","Function","Python at the Speed of Rust","title","Show HN: Python at the Speed of Rust","https:\u002F\u002Fblog.fxn.ai\u002Fpython-at-the-speed-of-rust\u002F","blog.fxn.ai","olokobayusuf",1744207929,2025,68,40,1026,3837,27,"notable","dev_tools","python compiler","cli",[21,24,25,26,27],"native binary","python to rust","on-device inference","ahead of time compilation","roasted",-0.41,{"positive":31,"neutral":32,"mixed":33,"critical":34},2,8,0,10,20,{"idea":37,"privacy":40,"performance":41,"execution":43},{"positive":38,"critical":39},1,4,{"positive":33,"critical":38},{"positive":33,"critical":42},3,{"positive":38,"critical":31},[38,42,33,42,33,38,33,38,33,38,33,38,33,38,33,42,33,45,42,33,33,42,33,42,33,45,33,38,33,38,33,38,33,42,33,33,42,33,38,33],5,"I’m sure many of you are familiar, but there’s a treacherous gap between finding (or building) a model that works in PyTorch, and getting that deployed into your application, especially in consumer-facing applications.\n\nI’ve been very interested in solving this problem with a great developer experience. Over time, I gradually realized that the highest-impact thing to have was a way to go from existing Python code to a self-contained native binary—in other words, a Python compiler.\n\nI was already pretty familiar with a successful attempt: when Apple introduced armv8 on the iPhone 5s, they quick",{"problem":48,"audience":54,"pricing":60,"motivation":61,"time_to_build":60,"stack":65,"openness":88,"stage":89,"team_size":88},{"value":49,"source":50,"evidence":51},"Getting PyTorch-style models and Python code deployed as fast native code inside applications.","maker",[52],{"id":53},"post",{"value":55,"source":50,"evidence":56},"Developers deploying on-device AI inference across mobile, desktop and web apps.",[57],{"id":58,"by":11,"text":59},"43672322","We're focused specifically on on-device AI inference (and related compute-bound algorithms, like computer vision or scientific computing). We want devs to find or develop…",null,{"value":62,"source":50,"evidence":63},"Make deploying Python-built models into consumer applications easier and faster.",[64],{"id":53},[66,70,76,80,84],{"value":67,"source":50,"evidence":68},"Python",[69],{"id":53},{"value":71,"source":50,"evidence":72},"C++",[73],{"id":74,"by":11,"text":75},"43672373","We use LLVM! We're not translating Python directly to LLVM IR (I think I've seen other projects do this). We translate Python to C++\u002FRust first, where we have rigorous unit tests…",{"value":77,"source":50,"evidence":78},"Rust",[79],{"id":74,"by":11,"text":75},{"value":81,"source":50,"evidence":82},"LLVM",[83],{"id":74,"by":11,"text":75},{"value":85,"source":50,"evidence":86},"PyTorch",[87],{"id":53},"unknown","prototype",{"praise":91,"objections":100,"requests":135,"questions":147,"alternatives":166},[92],{"value":93,"source":94,"evidence":95},"Useful for on-device ML inference, including edge hardware and browsers.","commenter",[96],{"id":97,"by":98,"text":99},"43633531","shannonclaude","Super cool! Have been a fan of this project for a while. I think this is super important for anyone who is trying to do ml inference on edge hardware, but also the browser too.",[101,112,122,129],{"value":102,"source":94,"evidence":103},"Performance claims are unrigorous; microbenchmark may be misleading.",[104,108],{"id":105,"by":106,"text":107},"43664763","cbondurant","I think that the compilation flags utilized are needed in order to properly justify the validity of the microbenchmark here. At opt-level 2 and 3 rust completely optimizes away…",{"id":109,"by":110,"text":111},"43632915","nsethi89","how come performance is worse than Rust? Isn’t this misleading",{"value":113,"source":94,"evidence":114},"Compiling Python requires reimplementing libraries and stdlib, which is hard to cover.",[115,119],{"id":116,"by":117,"text":118},"43674176","adsharma","Much of the stdlib is written in C. What happens when you use @compile on a function that calls into stdlib directly or indirectly? How do you deal with existing extensions, GIL…",{"id":120,"by":11,"text":121},"43633097","Spot on! We're starting from specific functions for now, and will expand the scope if\u002Fwhen feasible. The challenges exist across two axes: language coverage and library coverage.…",{"value":123,"source":94,"evidence":124},"Uploading user code to cloud servers and API key concerns.",[125],{"id":126,"by":127,"text":128},"43663903","croemer","I'm confused about the introduction mentioning API keys? The function is compiled on and\u002For uploaded to your servers? The introduction could benefit from discussing a less toyish…",{"value":130,"source":94,"evidence":131},"Prior projects have tried this; the language spec and C-API are hard.",[132],{"id":133,"by":117,"text":134},"43665402","Others have been here before. You'll have to deal with: ``` * C-API * Have a language spec * Deal with differences in pattern matching * Translating library calls * Compete with…",[136,143],{"value":137,"source":94,"evidence":138},"Support NumPy and other scientific libraries.",[139],{"id":140,"by":141,"text":142},"43664134","j_bum","So will this only work with standard Python? If I start pulling in Numpy, igraph, scikit, etc, will it still work? The article mentions Numpy as a gang up when trying to use…",{"value":144,"source":94,"evidence":145},"Better benchmarks, such as a quicksort example.",[146],{"id":105,"by":106,"text":107},[148,159],{"value":149,"source":94,"evidence":150},"How does this compare to Mojo?",[151,155],{"id":152,"by":153,"text":154},"43632474","ModernMech","How does this compare to a project like Mojo, which also seems to aim at filling that \"treacherous gap\" you note? They seem to believe that they can't just write a Python…",{"id":156,"by":157,"text":158},"43665535","thatxliner","Have you seen Mojo?",{"value":160,"source":94,"evidence":161},"Can it compile full programs or frameworks like Django?",[162],{"id":163,"by":164,"text":165},"43664325","DeathArrow","What's the end goal of this? Would I be able to compile any Python program? Will I be able to compile Django or FastApi apps?",[167,172,179,183],{"value":168,"source":94,"evidence":169},"Mojo",[170,171],{"id":152,"by":153,"text":154},{"id":156,"by":157,"text":158},{"value":173,"source":94,"evidence":174},"Numba",[175],{"id":176,"by":177,"text":178},"43664794","grandma_tea","I'm with you. I thought this was going to be an article about Numba.",{"value":180,"source":94,"evidence":181},"py2many",[182],{"id":116,"by":117,"text":118},{"value":184,"source":94,"evidence":185},"Python C-API with C extensions",[186],{"id":187,"by":188,"text":189},"43667318","UncleEntity","> Get Rust performance without having to learn Rust I do that by using the Python C-API, no rust, no fuss... Thinking about it, I haven't tried to see how well the robots do with…",{"comments":35,"answered":191,"key":192},11,[193,196,199],{"id":194,"text":195},"43673987","Spot on! The majority of the innovation here is in building enough rails (specifically around lowering Python's language features to native code) so that LLM codegen can help you…",{"id":197,"text":198},"43673976","I think a more pedantic way to describe what I mean is: \"What if we could compile Python into raw native code *without having a Python interpreter*?\" The key distinguishing…",{"id":200,"text":201},"43673962","Yes, we upload user code to a cloud sandbox in order to run our symbolic tracing and code generation algorithm. Beyond that, we also compile the generated native code in the…",{"commenters":203,"max_depth":204,"maker_replies":35,"first_comment_mins":205,"lifespan_hours":206},17,6,9,105,[208,212,216,218,219,220,222,223,225,228,229,232,233,235,237,239,241,244,246,247,249,251,253,254,256,258,261,264,267,268,269,271,274,276,277,280,282,283,284,288],[209,33,38,210,211,33],"43664396","project\u002Fcritical\u002Fidea","ratatoskrt",[213,33,42,214,215,33],"43664465","project\u002Fneutral\u002Fidea","6r17",[194,33,33,217,11,38],"maker\u002Fneutral\u002Fexecution",[176,33,42,214,177,33],[197,33,33,214,11,38],[126,38,38,221,127,33],"project\u002Fcritical\u002Fprivacy",[200,38,33,217,11,38],[105,31,38,224,106,33],"project\u002Fcritical\u002Fperformance",[226,31,33,227,11,38],"43672434","maker\u002Fneutral\u002Fperformance",[187,42,38,210,188,33],[230,42,33,231,11,38],"43672292","maker\u002Fneutral\u002Fidea",[133,39,38,210,117,33],[234,39,33,217,11,38],"43674073",[116,39,38,236,117,33],"project\u002Fcritical\u002Fexecution",[238,39,33,217,11,38],"43676561",[140,45,42,240,141,33],"project\u002Fneutral\u002Fexecution",[242,45,33,243,11,38],"43674051","maker\u002Fpositive\u002Fexecution",[245,45,45,243,141,33],"43674064",[152,204,42,214,153,33],[248,204,33,231,11,38],"43632515",[250,204,33,231,11,38],"43632544",[252,204,42,240,153,33],"43633030",[120,204,33,217,11,38],[255,204,42,240,164,33],"43664334",[257,204,33,217,11,38],"43674034",[97,259,45,260,98,33],7,"project\u002Fpositive\u002Fidea",[262,259,33,263,11,38],"43634692","maker\u002Fpositive\u002Fnone",[265,32,38,210,266,33],"43664968","KeplerBoy",[74,32,33,217,11,38],[109,205,38,224,110,33],[270,205,33,227,11,38],"43632974",[272,205,38,224,273,33],"43664931","IshKebab",[275,205,33,227,11,38],"43672354",[156,34,42,214,157,33],[278,34,33,279,11,38],"43672326","maker\u002Fneutral\u002Fnone",[281,34,33,231,11,38],"43672412",[163,191,42,214,164,33],[58,191,33,231,11,38],[285,286,38,236,287,33],"43668468",12,"nzzn",[289,286,33,227,11,38],"43672273",[],[292,296,301,306,310,314],{"id":293,"name":294,"points":295,"category":20},"43613194","Browser MCP",616,{"id":297,"name":298,"points":299,"category":300},"43593789","Whatsit",513,"games",{"id":302,"name":303,"points":304,"category":305},"43569190","OpenNutrition",311,"data",{"id":307,"name":308,"points":309,"category":20},"43614285","Lux",268,{"id":311,"name":312,"points":313,"category":20},"43627758","DrawDB",263,{"id":315,"name":316,"points":317,"category":20},"43573539","GitMCP",185,false,"v2",{"id":321,"name":5,"line":6,"ai":318,"cat":20,"year":13,"points":14,"comments":15,"rec":28,"s":29,"top":18,"kw":322,"maker":11,"domain":10,"tier":19,"attempts":33,"strip":323,"url":9,"mix":324,"praise":93,"objection":102,"sub":21},43632373,[21,24,25,26,27],"1303010101010103053003030501010103003010",[31,32,33,34],1794036672585]