Skip to main content
22 events
when toggle format what by license comment
Apr 13, 2017 at 12:40 history edited CommunityBot
replaced http://codereview.stackexchange.com/ with https://codereview.stackexchange.com/
Jun 20, 2014 at 21:51 comment added user1235831 Now I get what is happening under the hood with row and sibling, nice insight btw! map is nice but I'm not really sure if it is good when you are working with something as expensive as matrices. Both map and foreach seem to require a callback and this seems to slow the loop down. They make the code a lot cleaner, but I don't think I am going to use them unless I can replace them with a parser later. This should be possible if there is "one to one" or "one to many correlation" between context and method. Anyway, I learned a lot from this! Again, thanks for the review! :-)
Jun 20, 2014 at 21:33 history edited Flambino CC BY-SA 3.0
deleted 31 characters in body
Jun 20, 2014 at 21:22 comment added Flambino @user1235831 A minifier/uglifier typically isn't a static analyzer; it just - as you say - shortens variable names and removes whitespace (Google's Closure Compiler is an exception; it'll actually optimize the code, not just the filesize). But map is a qualitatively different operation than a regular loop, so a call to map will remain a call to map. Sure, map iterates through an array much like a loop, but it's not the same procedure at all. Besides, map isn't a huge performance drain. It's a native function, so it's partly running as compiled code; not interpreted JS.
Jun 20, 2014 at 21:22 vote accept user1235831
Jun 20, 2014 at 21:11 comment added Flambino @user1235831 JS is object oriented, and we're looping through the same array, so row and sibling are just object references. So, at a certain index, row is the exact same object as sibling and vice-versa; it's two names pointing at the same thing. You could also compare the indices of course, but what really we want to know is whether it's the same row. So instead of asking "is this number the same as that number?" we just ask "is this the same thing?"
Jun 20, 2014 at 21:10 comment added user1235831 To answer the question about: 'What do you mean by "'map' method optimized by an uglifier"?' JavaScript "Uglifiers" are similar to JavaScript "minifiers", but your code will be completely unreadable as it will compress variable and function names. "map" method seemed to have a price of execution speed, so it is natural to consider if it can be optimized. Normally, it shouldn't matter for simple websites, but I want to play with webgl :-)
Jun 20, 2014 at 20:46 comment added user1235831 About row === sibling, I can't reason why that would work, but it passes the tests. What is happening under the hood when these arrays are compared to each other directly?
Jun 20, 2014 at 20:45 comment added user1235831 I am going to make your answer as the accepted answer; I just want to make sure it works. I don't see the change yet but when I can confirm it works I will mark it as the accepted answer.
Jun 20, 2014 at 20:40 comment added Marc-Andre @user1235831 No problem, using Stack Exchange in the beginning is not an easy thing!
Jun 20, 2014 at 20:37 comment added user1235831 @Marc-Andre, thank you, I am still figuring all of this out...
Jun 20, 2014 at 20:34 comment added Flambino @user1235831 What do you mean by "'map' method optimized by an uglifier"? Also: Saw your edits. You were right about the pivot.index/pivot.column confusion; fixed that. Thanks. But the row === sibling comparison remains unchanged; it works just fine, and is more direct than comparing the indices.
Jun 20, 2014 at 20:29 comment added Flambino @Marc-Andre Just saw the rejected edit(s). Thanks. (Turns out they were partly correct though)
Jun 20, 2014 at 20:26 history edited Flambino CC BY-SA 3.0
fixed bug
Jun 20, 2014 at 20:10 comment added Marc-Andre @user1235831 You can see the reason why your edit was rejected in your user profile. It would be informative for you. You should have had a comment on this answer instead of editing directly. If you have a question of want more information you can visit the Code Review Meta.
Jun 20, 2014 at 19:49 review Suggested edits
Jun 20, 2014 at 20:06
Jun 20, 2014 at 19:01 comment added user1235831 Thank you for your review! One question, do you know if "map" method optimized by some JavaScript uglifier out there? If not then I am thinking about to write a parser for that purposes :-)
Jun 20, 2014 at 18:50 review Suggested edits
Jun 20, 2014 at 19:14
Jun 20, 2014 at 14:15 history edited Flambino CC BY-SA 3.0
added 126 characters in body
Jun 20, 2014 at 1:54 history edited Flambino CC BY-SA 3.0
added 399 characters in body
Jun 20, 2014 at 1:28 history edited Flambino CC BY-SA 3.0
added 341 characters in body
Jun 20, 2014 at 1:22 history answered Flambino CC BY-SA 3.0