[{"data":1,"prerenderedAt":268},["ShallowReactive",2],{"project-34312335":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":33,"aspects":34,"strip":38,"post_text":41,"what":42,"said":51,"maker_in_thread":123,"shape":132,"grid":137,"attempts":228,"same_week":229,"maker_shows":259,"maker_hidden":260,"reader_version":261,"card":262},"34312335","zig-hyperloglog","HyperLogLog in Zig","title","Show HN: HyperLogLog in Zig","https:\u002F\u002Fgithub.com\u002Faxiomhq\u002Fzig-hyperloglog","github.com","seiflotfy",1673282500,2023,154,34,396,3109,13,"notable","languages","algorithm library","library",[24,25,26,27],"hyperloglog","cardinality estimation","zig","count distinct","curious",0.136,{"positive":31,"neutral":18,"mixed":32,"critical":32},2,0,15,{"design":35,"idea":36,"execution":37},{"positive":32,"critical":32},{"positive":32,"critical":32},{"positive":32,"critical":32},[39,39,32,39,32,32,32,32,39,39,39,32,40,32,32,32,32,32,32,32,32,32,32,32,40,39,32,39,32,39,39,39,39,39,32,32,32],3,5,null,{"problem":41,"audience":41,"pricing":41,"motivation":41,"time_to_build":41,"stack":43,"openness":50,"stage":50,"team_size":50},[44],{"value":45,"source":46,"evidence":47},"Zig","inferred",[48],{"id":49},"post","unknown",{"praise":52,"objections":64,"requests":79,"questions":84,"alternatives":108},[53],{"value":54,"source":55,"evidence":56},"Commenters find the project awesome and cool","commenter",[57,60],{"id":58,"by":11,"text":59},"34315829","This is awesome... question though: ```pub fn HyperLogLog(comptime p: u8) type { return struct { dense: [1\u003C\u003Cp]u6; ``` const Self = @This(); pub fn init() Self { var s = Self {};…",{"id":61,"by":62,"text":63},"34314249","extasia","Looks cool. What are some applications of a cardinality estimator?",[65,73],{"value":66,"source":55,"evidence":67},"Dense representation allocates 1\u003C\u003Cp bytes upfront, undermining the sparse representation",[68,69],{"id":58,"by":11,"text":59},{"id":70,"by":71,"text":72},"34315996","kristoff_it","> doesn't this allocate 1\u003C\u003Cp upfront though Yes, it does. The idea (see the last code snipped in that post), is that the user delays the creation of the HLL until they are ready…",{"value":74,"source":55,"evidence":75},"Heap allocation forced on the user is not idiomatic",[76],{"id":77,"by":71,"text":78},"34314781","One change to make this library more idiomatic would be to make HyperLogLog avoid forcing heap allocation on the user. So from this (simplified code): ``` pub fn…",[80],{"value":81,"source":55,"evidence":82},"Allow user to choose memory placement without forced heap allocation",[83],{"id":77,"by":71,"text":78},[85,97],{"value":86,"source":55,"evidence":87},"What are the applications of a cardinality estimator?",[88,89,93],{"id":61,"by":62,"text":63},{"id":90,"by":91,"text":92},"34314518","zX41ZdbW","Memory bound alternative for the COUNT(DISTINCT ...) aggregate function in SQL. ClickHouse[1] has a few functions for that, with different tradeoffs in memory usage, precision,…",{"id":94,"by":95,"text":96},"34314971","refset","Various aspects of query optimization like join planning and predicate selectivity estimation, e.g. as discussed in https:\u002F\u002Farxiv.org\u002Fabs\u002F2010.00728",{"value":98,"source":55,"evidence":99},"Why Zig rather than Go or V?",[100,104],{"id":101,"by":102,"text":103},"34314496","eatonphil","Awesome! Does Axiom use Zig? Most of your projects seem to be in Go. Why did you choose to do this in Zig?",{"id":105,"by":106,"text":107},"34314594","henry_viii","I'm also very curious to know this. HyperLogLog is written in Go: https:\u002F\u002Fgithub.com\u002Faxiomhq\u002Fhyperloglog I would expect V to be a more natural choice for a port than Zig.",[109,113,119],{"value":110,"source":55,"evidence":111},"Go HyperLogLog implementation by Axiom",[112],{"id":105,"by":106,"text":107},{"value":114,"source":55,"evidence":115},"Redis HyperLogLog",[116],{"id":117,"by":71,"text":118},"34315613","Or alternatively one could make good use of the existing buffer and use that to encode the sparse representation, like Antirez did in Redis:…",{"value":120,"source":55,"evidence":121},"ClickHouse uniqCombined and uniq functions",[122],{"id":90,"by":91,"text":92},{"comments":39,"answered":32,"key":124},[125,126,129],{"id":58,"text":59},{"id":127,"text":128},"34323483","Actually i found zig easier to read than rust… something that i found more appealing!",{"id":130,"text":131},"34314684","Author here, will publish my vlang take on it in the next couple of days.",{"commenters":133,"max_depth":134,"maker_replies":39,"first_comment_mins":135,"lifespan_hours":136},21,11,123,178,[138,140,141,144,145,149,152,153,155,157,159,160,161,164,168,170,173,175,178,180,182,184,186,188,190,192,196,199,202,204,205,208,211,215,218,220,224],[77,32,39,139,71,32],"project\u002Fneutral\u002Fdesign",[117,32,39,139,71,32],[58,32,32,142,11,143],"project\u002Fneutral\u002Fperformance",1,[70,32,39,139,71,32],[146,32,32,147,148,32],"34321019","other\u002Fneutral\u002Fnone","Alifatisk",[150,32,32,147,151,32],"34321414","int_19h",[127,32,32,147,11,143],[154,32,32,147,148,32],"34325159",[156,32,39,139,71,32],"34327686",[101,143,39,158,102,32],"maker\u002Fneutral\u002Fnone",[105,143,39,158,106,32],[130,143,32,158,11,143],[162,143,40,163,106,32],"34314786","maker\u002Fpositive\u002Fnone",[165,143,32,166,167,32],"34316113","commenter\u002Fneutral\u002Fnone","shilldetector",[169,143,32,166,106,32],"34322658",[171,143,32,166,172,32],"34335366","dang",[174,143,32,166,106,32],"34336291",[176,143,32,166,177,32],"34336774","pverghese",[179,143,32,166,106,32],"34337176",[181,143,32,166,177,32],"34349884",[183,143,32,166,106,32],"34351617",[185,143,32,166,172,32],"34363780",[187,143,32,166,172,32],"34363787",[189,143,32,166,172,32],"34335361",[61,31,40,191,62,32],"project\u002Fpositive\u002Fnone",[193,31,39,194,195,32],"34314344","project\u002Fneutral\u002Fidea","jedisct1",[197,31,32,166,198,32],"34319426","anacrolix",[200,31,39,194,201,32],"34320666","avinassh",[90,31,32,203,91,32],"other\u002Fneutral\u002Fidea",[94,31,39,194,95,32],[206,31,39,194,207,32],"34319347","cnlwsu",[209,31,39,194,210,32],"34321600","taepper",[212,39,39,213,214,32],"34320455","project\u002Fneutral\u002Fexecution","kjgkjhfkjf",[216,39,39,213,217,32],"34343459","nonsequitur",[219,39,32,166,214,32],"34408552",[221,222,32,147,223,32],"34318231",4,"VWWHFSfQ",[225,222,32,226,227,32],"34318681","other\u002Fneutral\u002Fperformance","whimsicalism",[],[230,235,240,245,250,254],{"id":231,"name":232,"points":233,"category":234},"34338629","Kandria",487,"games",{"id":236,"name":237,"points":238,"category":239},"34289581","Futurecoder",371,"learning_science",{"id":241,"name":242,"points":243,"category":244},"34279062","Tablane",352,"productivity",{"id":246,"name":247,"points":248,"category":249},"34343122","Val Town",332,"dev_tools",{"id":251,"name":252,"points":253,"category":249},"34262825","Vim online editor",316,{"id":255,"name":256,"points":257,"category":258},"34265206","ClickHouse-local",289,"data",12,false,"v2",{"id":263,"name":5,"line":6,"ai":260,"cat":20,"year":13,"points":14,"comments":15,"rec":28,"s":264,"top":18,"kw":265,"maker":11,"domain":10,"tier":19,"attempts":32,"strip":266,"url":9,"mix":267,"praise":54,"objection":66,"sub":21},34312335,0.14,[24,25,26,27],"3303000033305000000000005303033333000",[31,18,32,32],1794036629738]