[{"data":1,"prerenderedAt":408},["ShallowReactive",2],{"project-33247155":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":29,"sentiment":30,"stance_mix":31,"scored_comments":35,"aspects":36,"strip":45,"post_text":46,"what":47,"said":75,"maker_in_thread":179,"shape":186,"grid":191,"attempts":368,"same_week":369,"maker_shows":233,"maker_hidden":400,"reader_version":401,"card":402},"33247155","Watcher","Filesystem Watcher","title","Show HN: Filesystem Watcher","https:\u002F\u002Fgithub.com\u002Fe-dant\u002Fwatcher","github.com","e-dant",1666101249,2022,91,73,652,2570,26,"notable","dev_tools","file watcher library","library",[24,25,26,27,28],"filesystem watcher","file change events","c++ header only","inotify alternative","kqueue","curious",-0.238,{"positive":32,"neutral":33,"mixed":32,"critical":34},1,20,9,31,{"performance":37,"idea":40,"execution":42,"design":43,"docs":44},{"positive":38,"critical":39},0,3,{"positive":38,"critical":41},5,{"positive":38,"critical":32},{"positive":38,"critical":38},{"positive":38,"critical":38},[39,38,38,39,39,38,32,32,32,32,38,39,32,41,38,38,38,38,39,39,38,38,38,38,38,39,32,38,39,39,38,39,39,32,38,39,39,32,32,38],"An arbitrary filesystem event watcher which is:\n\n- simple\n\n- efficient\n\n- dependency free\n\n- runnable anywhere with a filesystem\n\n- header only\n\nWatcher is extremely efficient. In most cases, even when scanning millions of paths, this library uses a near-zero amount of resources.\n\nWatcher is simple. The library exposes a single function and a single object. That is all.\n\nHappy hacking.",{"problem":48,"audience":54,"pricing":54,"motivation":54,"time_to_build":54,"stack":55,"openness":73,"stage":74,"team_size":73},{"value":49,"source":50,"evidence":51},"Reports filesystem change events for arbitrary paths with low resource use","maker",[52],{"id":53},"post",null,[56,64],{"value":57,"source":58,"evidence":59},"C++","commenter",[60],{"id":61,"by":62,"text":63},"33250263","waynesonfire","forgot \"written in C++\" .. unless you're trying to get views, better to leave that part out.",{"value":65,"source":50,"evidence":66},"std::filesystem",[67,70],{"id":68,"by":11,"text":69},"33252230","Near-zero is a bit loose. It keeps a relatively compact in-memory representation. You’re about right with your estimate. Having measured just now, it’s about 30mb for 1 million…",{"id":71,"by":11,"text":72},"33252316","When I began this project, I started with kqueue. The performance was wanting and there were bugs with very large file trees. I moved to a minimal std::filesystem-based watcher…","unknown","beta",{"praise":76,"objections":84,"requests":108,"questions":134,"alternatives":153},[77],{"value":78,"source":58,"evidence":79},"Useful for fast feedback loops and file watching in general",[80],{"id":81,"by":82,"text":83},"33250618","MichaelCollins","I don't know about efficient, but at least it sounds reliable. I'm at my wit's end with trying to figure out why KDE's Dolphin can't reliably watch a directory for new files,…",[85,99],{"value":86,"source":58,"evidence":87},"Efficiency claims are unsubstantiated; the Windows implementation scans directories periodically",[88,92,95],{"id":89,"by":90,"text":91},"33248263","mikulas_florek","Looking at Win32, it scans the whole directory periodically, right? I must miss something, but how can that be called efficient?",{"id":93,"by":90,"text":94},"33254078","I only mentioned Win32. There this library is very inefficient compared to ReadDirectoryChangesW, which consumes no CPU times when nothing changes.",{"id":96,"by":97,"text":98},"33251231","dyerjohn","\"Watcher is extremely efficient. In most cases, even when scanning millions of paths, this library uses a near-zero amount of resources.\" Yea, maybe or maybe not and my first…",{"value":100,"source":50,"evidence":101},"Event accuracy is not guaranteed; platform backends are incomplete",[102,105],{"id":103,"by":11,"text":104},"33251048","It’s difficult to get it perfectly right. There is ongoing work attempting to make it more perfect. I expect a year or two before this is complete. For now though, it does do…",{"id":106,"by":11,"text":107},"33251249","More technically, here’s what we have: A “baseline” filesystem watcher which uses only the standard library. It has been made to beat kqueue. And it does. A platform filesystem…",[109,116,123],{"value":110,"source":58,"evidence":111},"Document how it achieves low resource use in the readme",[112,113],{"id":96,"by":97,"text":98},{"id":114,"by":11,"text":115},"33251286","You are right. I’ll make sure to give a deeper breakdown in the readme.",{"value":117,"source":58,"evidence":118},"Use native Windows APIs such as ReadDirectoryChangesW",[119,120],{"id":93,"by":90,"text":94},{"id":121,"by":11,"text":122},"33247735","All are supported. Although, to be more efficient, I need to write system API calls for Windows. That will be the 1.0 release.",{"value":124,"source":58,"evidence":125},"Handle atomic overwrite by move",[126,130],{"id":127,"by":128,"text":129},"33248384","remram","Does it keep working when files get overwritten by moving another over it, like some Linux text editors do?",{"id":131,"by":132,"text":133},"33290620","sgerenser","This was a case that tripped me up when using Qt's QFileSystemWatcher. Many apps implement \"atomic updates\" to files by writing out to a new file (e.g. foo.txt.temp), then moving…",[135,146],{"value":136,"source":58,"evidence":137},"How does it work under the hood on Linux, is it inotify?",[138,142],{"id":139,"by":140,"text":141},"33248147","GordonS","How does this work under the covers on Linux? Is it using eBPF, or is it simply an abstraction over inotify? I'm particularly interested in something like this, but which will…",{"id":143,"by":144,"text":145},"33248530","bertman",">or is it simply an abstraction over inotify? Looks like it:…",{"value":147,"source":58,"evidence":148},"Does it work over NFS or SMB?",[149],{"id":150,"by":151,"text":152},"33251638","roeles","Should this work over NFS or SMB?",[154,161,168,172],{"value":155,"source":58,"evidence":156},"watchexec",[157],{"id":158,"by":159,"text":160},"33248753","awestroke","See also: sane - for node watchexec - rust based, static binary",{"value":162,"source":58,"evidence":163},"fswatch",[164],{"id":165,"by":166,"text":167},"33258728","POPOSYS","Well, I am not too lazy to search but I was interested in your experience, especially with reliability. This one looks interesting: https:\u002F\u002Fgithub.com\u002Femcrisostomo\u002Ffswatch",{"value":169,"source":58,"evidence":170},"sane",[171],{"id":158,"by":159,"text":160},{"value":173,"source":58,"evidence":174},"systemd path units and inotifywait",[175],{"id":176,"by":177,"text":178},"33251539","chasil","Is this just using inotify on Linux? If so, there are equivalent options, including systemd path units, incron, and the inotifywait utility, in addition to the C API. The \"man…",{"comments":180,"answered":181,"key":182},15,10,[183,184,185],{"id":103,"text":104},{"id":68,"text":69},{"id":106,"text":107},{"commenters":187,"max_depth":188,"maker_replies":180,"first_comment_mins":189,"lifespan_hours":190},37,8,28,168,[192,196,198,201,203,205,207,208,211,215,219,222,225,227,229,231,232,234,237,239,241,244,246,247,249,252,255,257,259,261,263,265,267,270,272,274,279,282,285,288,292,294,296,299,302,305,308,309,313,315,317,319,321,323,325,326,329,332,335,336,339,341,344,347,349,352,353,355,357,360,363,366],[193,38,39,194,195,38],"33250420","project\u002Fneutral\u002Fperformance","diffxx",[103,38,38,197,11,32],"maker\u002Fneutral\u002Fnone",[199,38,38,200,195,38],"33251361","commenter\u002Fneutral\u002Fperformance",[68,38,38,202,11,32],"maker\u002Fneutral\u002Fperformance",[106,38,38,204,11,32],"project\u002Fneutral\u002Fexecution",[206,38,39,194,195,38],"33251437",[71,38,38,194,11,32],[209,38,38,210,195,38],"33253404","other\u002Fneutral\u002Fnone",[212,38,39,213,214,38],"33255809","project\u002Fneutral\u002Fnone","marwis",[216,38,38,217,218,38],"33251529","other\u002Fneutral\u002Fidea","commandlinefan",[220,38,32,221,195,38],"33251984","project\u002Fcritical\u002Fidea",[223,38,39,213,224,38],"33252192","nomel",[226,38,38,210,195,38],"33252259",[96,32,32,228,97,38],"project\u002Fcritical\u002Fperformance",[114,32,38,230,11,32],"maker\u002Fneutral\u002Fdocs",[176,32,32,221,177,38],[89,233,32,228,90,38],2,[235,233,39,194,236,38],"33248656","rasz",[238,233,38,204,11,32],"33249639",[240,233,39,213,90,38],"33254034",[242,233,39,194,243,38],"33248965","dwringer",[245,233,38,194,11,32],"33249716",[93,233,32,228,90,38],[81,233,41,248,82,38],"project\u002Fpositive\u002Fnone",[250,39,39,251,236,38],"33248615","project\u002Fmixed\u002Fperformance",[253,39,38,210,254,38],"33248663","mellosouls",[256,39,38,210,236,38],"33248727",[258,39,38,210,254,38],"33248897",[260,39,38,210,236,38],"33249309",[262,39,38,210,254,38],"33250515",[264,39,38,210,236,38],"33251544",[266,39,38,210,254,38],"33330677",[268,39,39,204,269,38],"33249003","who23",[271,39,38,210,236,38],"33249331",[273,39,38,230,11,32],"33249613",[275,276,39,277,278,38],"33249386",4,"project\u002Fneutral\u002Fdesign","cmovq",[280,276,38,281,11,32],"33250801","maker\u002Fneutral\u002Fdesign",[283,41,38,217,284,38],"33249922","queuebert",[286,41,38,210,287,38],"33250698","stonogo",[289,290,38,210,291,38],"33252129",6,"bigmattystyles",[293,290,38,210,224,38],"33252155",[295,290,38,210,291,38],"33252369",[297,290,38,210,298,38],"33252697","0xJRS",[300,290,38,210,301,38],"33279943","hackarama",[303,290,38,210,304,38],"33254489","infogulch",[139,306,39,307,140,38],7,"project\u002Fneutral\u002Fidea",[143,306,39,204,144,38],[310,306,32,311,312,38],"33248959","project\u002Fcritical\u002Fexecution","tleb_",[314,306,38,230,11,32],"33249683",[316,306,38,230,11,32],"33250868",[318,306,39,230,140,38],"33250957",[320,306,38,230,11,32],"33251080",[322,306,39,307,140,38],"33251291",[324,188,38,210,166,38],"33258393",[165,188,38,210,166,38],[327,34,39,194,328,38],"33252174","jonhohle",[330,181,39,213,331,38],"33247625","widdershins",[333,181,39,213,334,38],"33247713","dljsjr",[121,181,38,204,11,32],[337,181,39,204,338,38],"33249974","OnlyMortal",[61,340,32,221,62,38],11,[342,340,38,343,11,32],"33250824","commenter\u002Fneutral\u002Fnone",[345,340,38,210,346,38],"33259008","saagarjha",[127,348,39,204,128,38],12,[350,348,38,351,11,32],"33249681","maker\u002Fneutral\u002Fexecution",[131,348,39,204,132,38],[150,354,39,204,151,38],13,[158,356,32,221,159,38],14,[358,356,32,221,359,38],"33249684","christophilus",[361,356,38,210,362,38],"33250234","kevincox",[364,356,38,343,365,38],"33253471","matijs",[367,356,38,343,362,38],"33253646",[],[370,375,380,385,390,395],{"id":371,"name":372,"points":373,"category":374},"33217395","America",663,"games",{"id":376,"name":377,"points":378,"category":379},"33251954","Swurl",572,"web_saas",{"id":381,"name":382,"points":383,"category":384},"33261494","Palette",472,"ai",{"id":386,"name":387,"points":388,"category":389},"33205282","FrankenPHP",368,"infrastructure",{"id":391,"name":392,"points":393,"category":394},"33248488","Linen",292,"productivity",{"id":396,"name":397,"points":398,"category":399},"33228533","screenplays",266,"learning_science",false,"v2",{"id":403,"name":5,"line":6,"ai":400,"cat":20,"year":13,"points":14,"comments":15,"rec":29,"s":404,"top":18,"kw":405,"maker":11,"domain":10,"tier":19,"attempts":38,"strip":406,"url":9,"mix":407,"praise":78,"objection":86,"sub":21},33247155,-0.24,[24,25,26,27,28],"3003301111031500003300000310330331033110",[32,33,32,34],1794036626259]