[{"data":1,"prerenderedAt":275},["ShallowReactive",2],{"project-22389239":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":27,"sentiment":28,"stance_mix":29,"scored_comments":33,"aspects":34,"strip":40,"post_text":43,"what":44,"said":76,"maker_in_thread":151,"shape":161,"grid":165,"attempts":239,"same_week":240,"maker_shows":30,"maker_hidden":267,"reader_version":268,"card":269},"22389239","exchange","A first project in Rust – in-memory order book","title","Show HN: A first project in Rust – in-memory order book","https:\u002F\u002Fgithub.com\u002Fconnorwstein\u002Fexchange","github.com","cstein2",1582342582,2020,91,33,709,3028,24,"notable","finance_crypto","order book","library",[21,24,25,26],"rust","in-memory","matching engine","curious",-0.018,{"positive":30,"neutral":31,"mixed":32,"critical":32},1,10,2,15,{"idea":35,"design":37,"performance":38,"execution":39},{"positive":30,"critical":36},0,{"positive":36,"critical":30},{"positive":36,"critical":30},{"positive":36,"critical":36},[36,36,36,36,41,41,36,30,36,41,41,41,36,42,41,41,36,41,36,36,41,36,36,41,36,36,41,30,41,36,36,36,36],3,5,null,{"problem":45,"audience":43,"pricing":43,"motivation":54,"time_to_build":43,"stack":60,"openness":73,"stage":74,"team_size":75},{"value":46,"source":47,"evidence":48},"Maintaining and matching buy and sell orders in memory.","inferred",[49,51],{"id":50},"post",{"id":52,"by":11,"text":53},"22389246","Feedback welcome! I'm sure I'm missing loads of Rust patterns and idioms...",{"value":55,"source":56,"evidence":57},"Learning Rust as a first project.","maker",[58,59],{"id":50},{"id":52,"by":11,"text":53},[61,65],{"value":62,"source":56,"evidence":63},"Rust",[64],{"id":50},{"value":66,"source":67,"evidence":68},"hyper","commenter",[69],{"id":70,"by":71,"text":72},"22389835","ShorsHammer","Some comments: Async\u002Fawait syntax is poorly documented across the ecosystem but has landed now and is useful, without it codebases will look outdated soon enough, hyper itself…","unknown","prototype","solo",{"praise":77,"objections":96,"requests":115,"questions":126,"alternatives":137},[78,85],{"value":79,"source":67,"evidence":80},"Readable code.",[81],{"id":82,"by":83,"text":84},"22389873","asplake","I don’t do Rust but that was nicely readable. One comment: using Enums for stock symbols presumably forces a recompile on each new symbol. What would be the idiomatic…",{"value":86,"source":67,"evidence":87},"Interesting project for learning Rust.",[88,92],{"id":89,"by":90,"text":91},"22391481","aloukissas","Great stuff! Since we're working on things like that on the daily, you have inspired me to do something like that in elixir :)",{"id":93,"by":94,"text":95},"22389910","seanhunter","They aren't that unusual on an absolute basis but relative to the number of orders in a stock they are quite rare (iirc - it's been a while since I was directly involved in…",[97,104],{"value":98,"source":67,"evidence":99},"Storing full order struct in book is wasteful.",[100],{"id":101,"by":102,"text":103},"22391667","Misdicorl","If this is intended as anything more than a toy, you don't want to store the full OpenLimitOrder in the book data structure. The symbol should be allocated once on the book. The…",{"value":105,"source":67,"evidence":106},"Vec is a poor choice versus a B-tree for price levels.",[107,111],{"id":108,"by":109,"text":110},"22389712","evdubs","Why use a Vec instead of a B-Tree?",{"id":112,"by":113,"text":114},"22390228","globular-toast","Why a B-tree if it's supposed to be in-memory? A heap would be easier to implement and more efficient.",[116,120],{"value":117,"source":67,"evidence":118},"Explain how Vec vs B-tree choice was made.",[119],{"id":108,"by":109,"text":110},{"value":121,"source":67,"evidence":122},"Feed real market data to test performance.",[123],{"id":124,"by":109,"text":125},"22390428","Are you planning to hook your order book up to a data feed like, for example, binance[1] to see how your book performs? [1]…",[127,133],{"value":128,"source":67,"evidence":129},"Why use UUIDs instead of user and order ids?",[130],{"id":131,"by":109,"text":132},"22389722","Also, why use Uuids instead of a pair of user_id: u64, order_id: u64?",{"value":134,"source":67,"evidence":135},"How would enums for stock symbols work in Rust?",[136],{"id":82,"by":83,"text":84},[138,144],{"value":139,"source":67,"evidence":140},"BTreeMap from Rust std library.",[141],{"id":142,"by":109,"text":143},"22390450","Rust provides a built in B-tree[1] and it offers this over a binary search tree to avoid pointer chasing. With respect to heaps, are you thinking that a BinaryHeap[2] could be…",{"value":145,"source":67,"evidence":146},"once_cell Lazy instead of lazy_static.",[147],{"id":148,"by":149,"text":150},"22390083","roblabla","Instead of lazy static, use once_cell’s Lazy type[0]! It is a replacement that does away with the macro-based approach, possible thanks to improvements in const fn. This leads to…",{"comments":152,"answered":41,"key":153},7,[154,155,158],{"id":52,"text":53},{"id":156,"text":157},"22392047","Thanks! What would you suggest instead of a global\u002Flazy static in this situation though? I recall struggling to pass some dynamically allocated structure into the hyper service…",{"id":159,"text":160},"22392142","I suspect it will remain a toy, but agreed on those optimizations",{"commenters":162,"max_depth":163,"maker_replies":152,"first_comment_mins":32,"lifespan_hours":164},14,8,83,[166,170,173,176,178,180,182,184,186,187,189,191,194,197,200,201,202,204,206,208,210,212,214,216,217,219,221,225,228,230,232,234,237],[167,36,36,168,169,36],"22389865","commenter\u002Fneutral\u002Fnone","jansc",[171,36,36,168,172,36],"22391918","kenshi",[174,36,36,175,169,36],"22392378","other\u002Fneutral\u002Fnone",[52,30,36,177,11,30],"maker\u002Fneutral\u002Fnone",[70,30,41,179,71,36],"maker\u002Fmixed\u002Fidea",[148,30,41,181,149,36],"maker\u002Fneutral\u002Fidea",[156,30,36,183,11,30],"maker\u002Fneutral\u002Fdesign",[101,32,30,185,102,36],"project\u002Fcritical\u002Fdesign",[159,32,36,177,11,30],[82,41,41,188,83,36],"project\u002Fneutral\u002Fdesign",[190,41,41,188,149,36],"22390076",[192,41,41,188,193,36],"22390906","jimbo1qaz",[195,41,36,168,196,36],"22394058","usefulcat",[89,198,42,199,90,36],4,"project\u002Fpositive\u002Fidea",[108,42,41,188,109,36],[131,42,41,188,109,36],[203,42,36,183,11,30],"22389777",[124,42,41,205,109,36],"maker\u002Fneutral\u002Fperformance",[207,42,36,205,11,30],"22392064",[209,42,36,188,11,30],"22389776",[93,42,41,211,94,36],"project\u002Fmixed\u002Fexecution",[213,42,36,177,11,30],"22392003",[215,42,36,175,94,36],"22413639",[112,42,41,188,113,36],[142,42,36,218,109,36],"commenter\u002Fneutral\u002Fperformance",[220,42,36,168,113,36],"22393647",[222,42,41,223,224,36],"22390386","project\u002Fneutral\u002Fperformance","logicchains",[226,42,30,227,109,36],"22390476","project\u002Fcritical\u002Fperformance",[229,42,41,223,224,36],"22390511",[231,42,36,218,109,36],"22390568",[233,42,36,218,224,36],"22390585",[235,42,36,236,109,36],"22390597","other\u002Fneutral\u002Fperformance",[238,42,36,218,224,36],"22390640",[],[241,246,250,254,259,263],{"id":242,"name":243,"points":244,"category":245},"22396824","grep.app",614,"dev_tools",{"id":247,"name":248,"points":249,"category":245},"22374991","Kasaya",386,{"id":251,"name":252,"points":253,"category":245},"22416258","Helium",191,{"id":255,"name":256,"points":257,"category":258},"22385408","MDAnki",179,"learning_science",{"id":260,"name":261,"points":262,"category":245},"22425080","Opensource.builders",161,{"id":264,"name":265,"points":266,"category":245},"22415042","Shox",99,false,"v2",{"id":270,"name":5,"line":6,"ai":267,"cat":20,"year":13,"points":14,"comments":15,"rec":27,"s":271,"top":18,"kw":272,"maker":11,"domain":10,"tier":19,"attempts":36,"strip":273,"url":9,"mix":274,"praise":79,"objection":98,"sub":21},22389239,-0.02,[21,24,25,26],"000033010333053303003003003130000",[30,31,32,32],1794036586793]