[{"data":1,"prerenderedAt":643},["ShallowReactive",2],{"project-7937258":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":36,"aspects":37,"strip":47,"post_text":50,"what":51,"said":66,"maker_in_thread":156,"shape":168,"grid":172,"attempts":605,"same_week":606,"maker_shows":43,"maker_hidden":635,"reader_version":636,"card":637},"7937258","Fast.js","faster reimplementations of native JavaScript functions","title","Show HN: Fast.js – faster reimplementations of native JavaScript functions","https:\u002F\u002Fgithub.com\u002Fcodemix\u002Ffast.js","github.com","phpnode",1403612069,2014,323,162,42,2272,2,"legend","languages","javascript utility library","library",[24,25,26,27,28],"javascript","array methods","performance","foreach","map","roasted",-0.367,{"positive":32,"neutral":33,"mixed":34,"critical":35},8,20,3,31,62,{"performance":38,"design":40,"idea":42,"execution":44,"docs":46},{"positive":18,"critical":39},11,{"positive":41,"critical":41},0,{"positive":34,"critical":43},4,{"positive":18,"critical":45},12,{"positive":41,"critical":43},[41,41,41,41,48,41,34,41,41,41,18,18,49,48,48,48,18,41,48,48,18,48,41,48,48,48,18,34,18,48,34,34,34,34,34,18,34,34,48,41],1,5,null,{"problem":52,"audience":50,"pricing":50,"motivation":50,"time_to_build":50,"stack":59,"openness":64,"stage":65,"team_size":65},{"value":53,"source":54,"evidence":55},"Native JavaScript array and utility functions are slower than needed.","maker",[56],{"id":57,"by":11,"text":58},"7937345","author of the library here. The native implementations have to follow the spec exactly, which means that they have to guard against specific edge cases. The reimplementations in…",[60],{"value":61,"source":54,"evidence":62},"JavaScript",[63],{"id":57,"by":11,"text":58},"open_source","unknown",{"praise":67,"objections":76,"requests":114,"questions":129,"alternatives":141},[68],{"value":69,"source":70,"evidence":71},"Useful for performance-sensitive algorithms using typed arrays and loops","commenter",[72],{"id":73,"by":74,"text":75},"7937845","thegeomaster","I used this in a Firefox OS app, inside an implementation of Dijkstra's algorithm and an accompanying binary heap, and while I haven't run any rigorous benchmarks, I can say the…",[77,92,103],{"value":78,"source":70,"evidence":79},"Skips spec edge cases such as sparse arrays without documenting them",[80,84,88],{"id":81,"by":82,"text":83},"7937394","cordite","I'm interested in what those edge cases are, to say it works in 99% of the cases but provide no caveats makes me think that I might be surprised by something if I use it.",{"id":85,"by":86,"text":87},"7938651","gpvos","It would have been nice though if they would have documented exactly which edge cases they're neglecting.",{"id":89,"by":90,"text":91},"7938897","peterkelly","I think the forEach issue is a bad example, and something that could (and arguably should) be handled by the native implementation. The reason they get faster execution here is…",{"value":93,"source":70,"evidence":94},"Benchmarks use tiny inputs and lack comparison with Lo-Dash",[95,99],{"id":96,"by":97,"text":98},"7937681","grhmc","Amazing, the \"performance tests\" here operate on a list of only ten items long: https:\u002F\u002Fgithub.com\u002Fcodemix\u002Ffast.js\u002Fblob\u002Fmaster\u002Fbench\u002Ffor-each.js I'm sure that is a statistically…",{"id":100,"by":101,"text":102},"7937344","idbehold","Can you provide benchmarks against Lo-Dash?",{"value":104,"source":70,"evidence":105},"Speedup mostly comes from ignoring holes, so it is not a real native replacement",[106,110],{"id":107,"by":108,"text":109},"7939635","olliej","As a person who works on a JS engine I can say that a lot of the speed up in this library is the failure to handle holes correctly - it's surprisingly expensive to do a hole…",{"id":111,"by":112,"text":113},"7938218","Kiro","So the forEach magic that is so much faster is... a normal for loop: ``` exports.forEach = function fastForEach (subject, fn, thisContext) { var length = subject.length, i; for…",[115,124],{"value":116,"source":70,"evidence":117},"Benchmarks against lodash and larger input sizes",[118,119,120],{"id":100,"by":101,"text":102},{"id":96,"by":97,"text":98},{"id":121,"by":122,"text":123},"7938101","jrajav","Here's a jsperf of fast.js \u002F lodash \u002F native: http:\u002F\u002Fjsperf.com\u002Ffast-vs-lodash",{"value":125,"source":70,"evidence":126},"Document the edge cases the library ignores",[127,128],{"id":85,"by":86,"text":87},{"id":81,"by":82,"text":83},[130],{"value":131,"source":70,"evidence":132},"How can a JS reimplementation beat the native function?",[133,137],{"id":134,"by":135,"text":136},"7937321","aikah","Some V8 people here ? how can a JS re-implementation be faster than the native implementation of a function ?",{"id":138,"by":139,"text":140},"7937988","dabernathy89","> there is essentially no performance difference between native functions and their JavaScript equivalents > native functions often have to cover complicated edge cases from the…",[142,149],{"value":143,"source":70,"evidence":144},"lodash \u002F underscore.js",[145,148],{"id":146,"by":11,"text":147},"7937708","This is actually unlikely to be a problem. The edge cases ignored here are actually the same as those ignored by underscore.js, which is obviously a very popular library.",{"id":100,"by":101,"text":102},{"value":150,"source":70,"evidence":151},"Bluebird",[152],{"id":153,"by":154,"text":155},"7938221","danabramov","Reminds me of this comment by Petka Antonov on native V8 Promises being way slower than Bluebird[1]: >I'd expect native browser methods to be an order of magnitude faster.…",{"comments":157,"answered":49,"key":158},14,[159,162,165],{"id":160,"text":161},"7937977","regarding your edit, you're exactly right, of course a for loop will be faster. Sometimes you really do need a function call though, in which case fast forEach and map…",{"id":163,"text":164},"7939648","the only issue is i'd like to differentiate between iterating arrays and objects at the syntax level. Coffeescript uses `in` for arrays and `of` for objects, but I agree that…",{"id":166,"text":167},"7943776","The issue with coffeescript is that it uses the opposite syntax to JS - `in` for arrays instead of objects. ES6 introduces the `of` keyword for real iterators so i don't really…",{"commenters":169,"max_depth":32,"maker_replies":157,"first_comment_mins":170,"lifespan_hours":171},94,24,35,[173,175,179,182,186,189,192,195,199,203,206,208,211,214,216,219,221,224,227,230,231,233,235,238,241,243,245,248,252,255,257,259,262,264,265,267,269,272,274,277,279,282,285,289,292,295,297,300,302,305,307,309,312,315,318,322,325,328,330,333,334,337,340,343,344,347,350,355,359,361,364,367,370,372,374,377,379,382,385,388,390,393,396,398,402,404,407,409,411,414,418,420,422,425,428,431,433,436,439,441,444,447,450,451,454,456,459,462,464,466,468,472,474,478,480,483,485,486,490,493,496,499,502,505,509,511,513,515,518,521,523,526,528,530,534,538,539,541,544,546,548,551,554,556,559,561,565,569,571,574,578,582,584,588,592,594,597,599,601,603],[153,41,41,174,154,41],"commenter\u002Fneutral\u002Fperformance",[176,41,41,177,178,41],"7938312","commenter\u002Fneutral\u002Fnone","sheetjs",[180,41,41,174,181,41],"7938525","JoshTriplett",[183,41,41,184,185,41],"7942957","commenter\u002Fneutral\u002Fidea","babby",[187,41,41,174,188,41],"7943640","couchand",[190,41,41,174,191,41],"7938533","illumen",[193,41,41,174,194,41],"7941387","AshleysBrain",[196,48,41,197,198,41],"7940034","other\u002Fneutral\u002Fperformance","Joeri",[200,48,41,201,202,41],"7940199","other\u002Fneutral\u002Fnone","throwaway_yy2Di",[204,48,41,201,205,41],"7940261","felxh",[207,48,41,201,202,41],"7940285",[209,48,41,201,210,41],"7940337","timmclean",[212,48,41,201,213,41],"7942744","vidarh",[215,48,41,201,205,41],"7940372",[217,48,41,197,218,41],"7941891","BrandonLive",[220,48,41,197,194,41],"7941399",[222,48,41,174,223,41],"7943901","ulisesrmzroche",[225,48,41,197,226,41],"7942882","cel1ne",[228,18,48,229,202,41],"7937761","project\u002Fcritical\u002Fperformance",[73,18,41,197,74,41],[160,18,41,232,11,48],"maker\u002Fneutral\u002Fidea",[234,18,41,174,202,41],"7938026",[236,18,41,197,237,41],"7938151","k__",[239,18,41,174,240,41],"7939223","warfangle",[242,18,41,174,237,41],"7941289",[244,18,41,174,240,41],"7944104",[246,18,41,174,247,41],"7939672","bzbarsky",[249,18,34,250,251,41],"7939581","project\u002Fneutral\u002Fdesign","Excavator",[253,18,41,254,108,41],"7939646","commenter\u002Fneutral\u002Fexecution",[256,18,41,177,251,41],"7940297",[163,18,41,258,11,48],"maker\u002Fneutral\u002Fdesign",[260,18,41,261,251,41],"7940447","commenter\u002Fneutral\u002Fdesign",[263,18,41,261,188,41],"7943684",[166,18,41,258,11,48],[266,18,41,261,251,41],"7946300",[268,18,41,258,11,48],"7947343",[270,18,41,174,271,41],"7938108","netghost",[273,18,41,174,202,41],"7938143",[275,18,41,174,276,41],"7939707","WickyNilliams",[278,18,41,197,218,41],"7941926",[280,18,41,174,281,41],"7938174","nawitus",[283,34,48,284,178,41],"7937725","project\u002Fcritical\u002Fidea",[286,34,49,287,288,41],"7938017","project\u002Fpositive\u002Fidea","xahrepap",[290,34,48,229,291,41],"7938105","thathonkey",[293,34,48,294,281,41],"7938157","project\u002Fcritical\u002Fexecution",[296,34,48,229,178,41],"7938173",[298,34,49,287,299,41],"7938527","NathanKP",[301,34,41,197,240,41],"7939241",[303,34,41,174,304,41],"7939811","_greim_",[306,34,41,174,240,41],"7940666",[308,34,49,287,218,41],"7941960",[310,34,41,174,311,41],"7942423","codygman",[313,34,48,229,314,41],"7938199","pdpi",[316,34,48,294,317,41],"7938652","CJefferson",[319,34,49,320,321,41],"7938949","project\u002Fpositive\u002Fexecution","ufo",[323,34,48,294,324,41],"7941706","rok3",[326,34,41,177,327,41],"7938484","driverdan",[329,34,48,229,178,41],"7938515",[331,34,41,174,332,41],"7942723","ajanuary",[107,43,48,294,108,41],[335,43,41,197,336,41],"7940069","mmastrac",[338,43,41,197,339,41],"7940164","gsnedders",[341,43,41,197,342,41],"7940421","mraleph",[96,49,48,229,97,41],[345,49,41,346,11,48],"7937694","maker\u002Fneutral\u002Fexecution",[348,49,48,229,349,41],"7937795","alttab",[351,352,34,353,354,41],"7937328",6,"project\u002Fneutral\u002Fperformance","netcraft",[356,352,34,357,358,41],"7937663","project\u002Fneutral\u002Fidea","spyder",[360,352,41,201,354,41],"7937734",[362,352,41,201,363,41],"7937783","platz",[365,352,41,201,366,41],"7938184","turbohz",[368,352,41,201,369,41],"7938631","recursive",[371,352,41,201,122,41],"7938082",[121,373,34,353,122,41],7,[375,373,41,376,11,48],"7938131","maker\u002Fneutral\u002Fperformance",[378,373,48,229,247,41],"7939659",[380,373,41,201,381,41],"7938654","megawac",[383,373,34,384,247,41],"7939092","project\u002Fmixed\u002Fperformance",[386,373,41,201,387,41],"7940422","garthk",[389,373,48,229,226,41],"7942909",[391,32,34,353,392,41],"7937768","dgreensp",[394,32,34,353,395,41],"7939669","nijiko",[111,397,48,294,112,41],9,[399,400,41,197,401,41],"7937792",10,"simonsarris",[403,400,48,294,178,41],"7937819",[405,400,48,294,406,41],"7938565","al2o3cr",[408,400,41,197,342,41],"7940459",[410,39,41,197,191,41],"7937679",[412,45,41,197,413,41],"7941328","syg",[415,416,41,201,417,41],"7937463",13,"VeejayRampay",[419,416,41,353,11,48],"7937484",[421,416,41,174,417,41],"7937580",[423,416,41,177,424,41],"7937590","kristiandupont",[426,416,48,427,417,41],"7937648","project\u002Fcritical\u002Fdocs",[429,416,34,353,430,41],"7937627","jdc0589",[432,416,41,201,74,41],"7937513",[434,416,48,294,435,41],"7937572","jaredmcateer",[437,416,41,197,438,41],"7937833","mnemonik",[440,416,41,177,223,41],"7938007",[442,157,48,294,443,41],"7937569","nathanb",[445,157,48,427,446,41],"7937608","VMG",[448,157,48,427,449,41],"7937643","Isofarro",[146,157,41,320,11,48],[452,157,41,197,453,41],"7937911","cwmma",[455,157,48,294,443,41],"7939534",[457,157,41,458,11,48],"7939600","maker\u002Fpositive\u002Fexecution",[460,157,49,320,461,41],"7937717","tekacs",[463,157,48,284,349,41],"7937789",[465,157,41,177,461,41],"7937812",[467,157,41,177,188,41],"7943735",[469,470,34,353,471,41],"7937924",15,"MokiD",[134,473,34,353,135,41],16,[475,473,34,476,477,41],"7937330","project\u002Fneutral\u002Fdocs","GvS",[479,473,34,476,332,41],"7937332",[481,473,48,294,482,41],"7937334","fyolnish",[484,473,34,476,354,41],"7937335",[57,473,41,346,11,48],[487,473,34,488,489,41],"7937547","maker\u002Fneutral\u002Fdocs","sp332",[491,473,48,229,492,41],"7937350","chrisseaton",[494,473,41,177,495,41],"7937382","basicallydan",[497,473,41,174,498,41],"7937391","nixarn",[500,473,41,174,501,41],"7937430","dspillett",[503,473,41,177,504,41],"7937441","coldtea",[506,473,34,507,508,41],"7937703","project\u002Fmixed\u002Fidea","coldnebo",[510,473,41,184,504,41],"7937948",[512,473,48,294,449,41],"7937727",[514,473,41,254,11,48],"7937742",[516,473,49,517,504,41],"7937899","project\u002Fpositive\u002Fperformance",[519,473,34,507,520,41],"7937352","oneeyedpigeon",[522,473,34,353,504,41],"7937420",[524,473,41,177,525,41],"7937501","kosinus",[81,527,34,476,82,41],17,[529,527,41,476,11,48],"7937414",[531,532,41,201,533,41],"7940436",18,"seanewest",[535,536,41,201,537,41],"7938386",19,"franze",[138,33,34,353,139,41],[540,33,41,376,11,48],"7938080",[542,33,49,543,139,41],"7938593","maker\u002Fpositive\u002Fnone",[100,545,34,353,101,41],21,[89,547,48,229,90,41],22,[549,547,41,550,11,48],"7938904","project\u002Fneutral\u002Fexecution",[552,547,49,517,553,41],"7938962","scott_s",[85,555,48,427,86,41],23,[557,170,48,284,558,41],"7939453","talles",[560,170,34,357,395,41],"7939680",[562,563,34,353,564,41],"7937593",25,"CountHackulus",[566,567,41,177,568,41],"7941834",26,"hexleo",[570,567,41,177,568,41],"7942164",[572,573,34,353,395,41],"7939656",27,[575,576,41,201,577,41],"7938586",28,"webXL",[579,576,41,580,581,41],"7938985","other\u002Fneutral\u002Fidea","grumblestumble",[583,576,41,174,387,41],"7940496",[585,586,41,201,587,41],"7942013",29,"golem_de",[589,590,48,284,591,41],"7937521",30,"cristiantincu",[593,590,41,184,489,41],"7937541",[595,590,41,184,596,41],"7937595","pestaa",[598,590,41,184,489,41],"7937602",[600,590,41,184,596,41],"7938629",[602,590,41,177,223,41],"7937936",[604,590,41,184,596,41],"7938668",[],[607,612,617,622,627,631],{"id":608,"name":609,"points":610,"category":611},"7926005","Scholar Ninja",98,"learning_science",{"id":613,"name":614,"points":615,"category":616},"7944540","Hashcash",89,"security_privacy",{"id":618,"name":619,"points":620,"category":621},"7940030","Seed-DB funding visualization",85,"data",{"id":623,"name":624,"points":625,"category":626},"7937476","Checkr.io",79,"web_saas",{"id":628,"name":629,"points":630,"category":626},"7917408","BillForward",73,{"id":632,"name":633,"points":634,"category":621},"7931659","SeeYourVisitors",69,false,"v2",{"id":638,"name":5,"line":6,"ai":635,"cat":20,"year":13,"points":14,"comments":15,"rec":29,"s":639,"top":18,"kw":640,"maker":11,"domain":10,"tier":19,"attempts":41,"strip":641,"url":9,"mix":642,"praise":69,"objection":78,"sub":21},7937258,-0.37,[24,25,26,27,28],"0000103000225111201121011123213333323310",[32,33,34,35],1793990906878]