[{"data":1,"prerenderedAt":362},["ShallowReactive",2],{"project-38650570":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":34,"aspects":35,"strip":43,"post_text":44,"what":45,"said":83,"maker_in_thread":166,"shape":178,"grid":183,"attempts":323,"same_week":324,"maker_shows":42,"maker_hidden":354,"reader_version":355,"card":356},"38650570","go-sqlite3","My Go SQLite driver did poorly on a benchmark, so I fixed it","title","Show HN: My Go SQLite driver did poorly on a benchmark, so I fixed it","https:\u002F\u002Fgithub.com\u002Fncruces\u002Fgo-sqlite-bench","github.com","ncruces",1702608263,2023,234,58,220,3109,8,"notable","languages","database driver library","library",[24,25,26,27],"go sqlite driver","sqlite wasm","go no cgo","wazero","debated",0.064,{"positive":31,"neutral":31,"mixed":32,"critical":33},6,0,5,17,{"execution":36,"idea":39,"performance":40,"docs":41},{"positive":37,"critical":38},2,1,{"positive":32,"critical":38},{"positive":32,"critical":32},{"positive":37,"critical":42},3,[33,33,33,32,38,32,38,32,32,32,32,32,32,32,32,42,38,32,32,32,32,32,33,32,42,33,32,32,38,33,38,32,42,42,32,32,32,32,32,32],"https:\u002F\u002Fgithub.com\u002Fncruces\u002Fgo-sqlite3 was doing poorly on this benchmark that was posted yesterday to HackerNews [1].\n\nWith the help of some pprof, I was able to trace it to a serious performance regression introduced two weeks ago, and come up with the fix (happy to field questions, if you're interested in the nitty gritty).\n\nIt's not the fastest driver around, but it's no longer the slowest: comfortably middle of the pack.\nIt's based on a WASM build of SQLite, and thanks to https:\u002F\u002Fwazero.io doesn't need CGO.\n\n[1]: https:\u002F\u002Fnews.ycombinator.com\u002Fitem?id=38626698",{"problem":46,"audience":52,"pricing":63,"motivation":64,"time_to_build":63,"stack":68,"openness":80,"stage":81,"team_size":82},{"value":47,"source":48,"evidence":49},"Go apps need SQLite without CGO, and the driver was slow on a benchmark.","maker",[50],{"id":51},"post",{"value":53,"source":54,"evidence":55},"Go developers who want SQLite without CGO.","inferred",[56,59],{"id":57,"by":11,"text":58},"38652937","The major one is (cross) compilation and portability. You can (e.g.) easily whip up a small CLI that embeds an SQLite database in the binary [1], cross compile this to all the…",{"id":60,"by":61,"text":62},"38651830","jchw","Hey, that's awesome. I think if I wanted a CGo-less solution, I would've probably picked the modernc variation, but honestly this looks very polished + the modernc version is…",null,{"value":65,"source":48,"evidence":66},"Fix a serious performance regression that made the driver look bad on a benchmark.",[67],{"id":51},[69,73,77],{"value":70,"source":48,"evidence":71},"Go",[72],{"id":51},{"value":74,"source":48,"evidence":75},"WebAssembly (SQLite WASM build)",[76],{"id":51},{"value":27,"source":48,"evidence":78},[79],{"id":51},"open_source","launched","unknown",{"praise":84,"objections":97,"requests":119,"questions":128,"alternatives":140},[85,93],{"value":86,"source":87,"evidence":88},"Good portability and no-CGO cross compilation.","commenter",[89,90],{"id":57,"by":11,"text":58},{"id":91,"by":11,"text":92},"38653625","To compile C for a given platform, you need a C compiler for that platform. Which definitely exists but you may not have it at hand. To cross compile from your platform A to that…",{"value":94,"source":87,"evidence":95},"Polished project and fix explanation appreciated.",[96],{"id":60,"by":61,"text":62},[98,109],{"value":99,"source":87,"evidence":100},"README is hard to understand for newcomers.",[101,105],{"id":102,"by":103,"text":104},"38651395","carbocation","Basically a throwaway comment that is somewhat off topic, but your current Github README is very \"inside baseball.\" I think it would be worth a one-sentence introduction to what…",{"id":106,"by":107,"text":108},"38652030","KingOfCoders","Agree, 4. Someone following a link from HN I'm often confused when clicking through from HN and can't figure out from the website or README what the project is doing.",{"value":110,"source":87,"evidence":111},"Unclear why WASM beats native C SQLite.",[112,116],{"id":113,"by":114,"text":115},"38652790","acqq","I'd like to read what the actual benefits of not linking to C sqlite implementation are. I can imagine using wazero.io for libraries, but I fail to understand _why_ would anybody…",{"id":117,"by":114,"text":118},"38653332","I'm still missing some details to understand that story, as I don't believe that there is any platform that Go supports on which C sqlite would not run, more the opposite, the…",[120,124],{"value":121,"source":87,"evidence":122},"Include benchmarks in the repo to prevent regressions.",[123],{"id":60,"by":61,"text":62},{"value":125,"source":87,"evidence":126},"Explain the performance fix in more detail.",[127],{"id":60,"by":61,"text":62},[129,133],{"value":130,"source":87,"evidence":131},"Is there a strategy to prevent future performance regressions?",[132],{"id":60,"by":61,"text":62},{"value":134,"source":87,"evidence":135},"Can it support vector search via sqlite-vss?",[136],{"id":137,"by":138,"text":139},"38655928","koeng","Very cool! I’ve been looking at using SQLite-vss for fast vector sorting, but it requires CGO. I imagine if I do WASM compilation directly from C, I might be able to get around…",[141,148,152,159],{"value":142,"source":87,"evidence":143},"mattn go-sqlite3 (CGO)",[144],{"id":145,"by":146,"text":147},"38652951","willi59549879","I use the Mattn library. I don't care as much about not having Cho in my program. Sqlite project uses c and they have rigourous testing for each release. With a driver written in…",{"value":149,"source":87,"evidence":150},"modernc sqlite",[151],{"id":60,"by":61,"text":62},{"value":153,"source":87,"evidence":154},"zombiezen and crawshaw drivers",[155],{"id":156,"by":157,"text":158},"38653935","euroderf","Can someone explain what is the essential, practical difference between a library that implements package database\u002Fsql (such as mattn's) and one that does not (such as zombiezen…",{"value":160,"source":87,"evidence":161},"sqinn-go",[162],{"id":163,"by":164,"text":165},"38651177","38","Note that Squinn is not \"native go\" or \"go only\", but the owner insists on misleading people: https:\u002F\u002Fgithub.com\u002Fcvilsmeier\u002Fsqinn-go\u002Fissues\u002F8",{"comments":167,"answered":18,"key":168},18,[169,172,175],{"id":170,"text":171},"38652960","One thing I tried to make sure, to avoid the pitfall modernc is having, is to make sure building \"the WASM BLOB\" is easily reproducible with widely available tools:…",{"id":173,"text":174},"38652675","The nitty gritty is in another answer. The commits implementing the new function cache are these two: https:\u002F\u002Fgithub.com\u002Fncruces\u002Fgo-sqlite3\u002Fcompare\u002F0b093b7c...98660677 Creating…",{"id":176,"text":177},"38654460","It's not just about cross compilation. There's also debuggability and other aspects of development. It's an anecdote, but I've had a better experience debugging issues while…",{"commenters":179,"max_depth":180,"maker_replies":167,"first_comment_mins":181,"lifespan_hours":182},24,10,140,44,[184,186,190,192,194,195,197,200,201,204,207,210,212,214,216,219,221,224,227,229,231,233,237,239,243,246,247,250,252,255,257,259,264,266,268,270,273,277,281,284,288,289,292,294,295,297,300,301,303,304,305,307,310,312,314,316,318,320],[60,32,33,185,61,32],"project\u002Fpositive\u002Fexecution",[187,32,33,188,189,32],"38652637","project\u002Fpositive\u002Fnone","shabbyrobe",[191,32,33,188,61,32],"38652834",[170,32,32,193,11,38],"maker\u002Fneutral\u002Fexecution",[173,32,32,193,11,38],[145,38,38,196,146,32],"project\u002Fcritical\u002Fidea",[198,38,32,199,114,32],"38653879","commenter\u002Fneutral\u002Fnone",[176,38,32,185,11,38],[202,38,38,203,114,32],"38654777","project\u002Fcritical\u002Fexecution",[205,38,32,206,11,38],"38654962","project\u002Fpositive\u002Fdesign",[208,38,32,199,209,32],"38656288","electroly",[211,38,32,199,11,38],"38658353",[213,38,32,199,209,32],"38658882",[215,38,32,199,11,38],"38659098",[217,38,32,218,209,32],"38662223","other\u002Fneutral\u002Fnone",[220,38,32,218,11,38],"38668443",[222,38,32,218,223,32],"38662677","pjmlp",[225,38,32,218,226,32],"38657139","neonsunset",[228,38,32,218,11,38],"38657388",[230,38,32,199,226,32],"38657430",[232,38,32,199,114,32],"38657706",[234,37,42,235,236,32],"38651212","project\u002Fneutral\u002Fperformance","ridiculous_fish",[238,37,32,235,11,38],"38652566",[240,37,38,241,242,32],"38657528","project\u002Fcritical\u002Fdocs","tedunangst",[244,37,32,245,11,38],"38660070","project\u002Fneutral\u002Fexecution",[156,42,32,218,157,32],[248,42,32,218,249,32],"38654002","gunapologist99",[251,42,32,218,157,32],"38654187",[253,42,32,254,11,38],"38654349","project\u002Fneutral\u002Fdesign",[256,42,32,218,157,32],"38656017",[258,42,32,254,11,38],"38660317",[260,261,33,262,263,32],"38651394",4,"maker\u002Fpositive\u002Fexecution","nicetryguy",[137,33,42,265,138,32],"project\u002Fneutral\u002Fnone",[267,33,32,265,11,38],"38657520",[269,33,42,265,138,32],"38658178",[271,33,32,272,11,38],"38658244","project\u002Fneutral\u002Fidea",[274,31,33,275,276,32],"38654428","project\u002Fpositive\u002Fdocs","blitz_skull",[278,31,32,279,280,32],"38654719","other\u002Fneutral\u002Fdocs","acatton",[282,31,32,279,283,32],"38659226","galleywest200",[285,286,32,218,287,32],"38653418",7,"emmanueloga_",[102,18,38,241,103,32],[290,18,42,291,107,32],"38651500","maker\u002Fneutral\u002Fdocs",[293,18,33,275,103,32],"38651532",[106,18,38,241,107,32],[296,18,32,291,11,38],"38652880",[298,18,32,279,299,32],"38652595","trevyn",[113,18,42,272,114,32],[57,18,32,302,11,38],"project\u002Fpositive\u002Fidea",[117,18,42,272,114,32],[91,18,32,272,11,38],[306,18,32,218,114,32],"38653708",[308,18,32,218,309,32],"38655769","glenjamin",[311,18,32,218,114,32],"38656820",[313,18,32,265,11,38],"38657558",[315,18,32,218,114,32],"38664820",[317,18,32,218,287,32],"38653331",[163,319,32,218,164,32],9,[321,319,32,279,322,32],"38651355","ARandomerDude",[],[325,330,335,340,345,349],{"id":326,"name":327,"points":328,"category":329},"38706299","moddio2",318,"games",{"id":331,"name":332,"points":333,"category":334},"38647938","Airdraw",269,"creative",{"id":336,"name":337,"points":338,"category":339},"38679453","Microagents",221,"ai",{"id":341,"name":342,"points":343,"category":344},"38673973","Google Earth as glTF",177,"dev_tools",{"id":346,"name":347,"points":348,"category":339},"38705535","AI Video Search Engine (avse)",145,{"id":350,"name":351,"points":352,"category":353},"38669781","NowDo",103,"productivity",false,"v2",{"id":357,"name":5,"line":6,"ai":354,"cat":20,"year":13,"points":14,"comments":15,"rec":28,"s":358,"top":18,"kw":359,"maker":11,"domain":10,"tier":19,"attempts":32,"strip":360,"url":9,"mix":361,"praise":86,"objection":99,"sub":21},38650570,0.06,[24,25,26,27],"5550101000000003100000503500151033000000",[31,31,32,33],1793991080167]