combine foldConstants with standardizeTree#19
combine foldConstants with standardizeTree#19mr-martian wants to merge 4 commits intoKhan:masterfrom
Conversation
|
Leaving it uncommented will result in the failure of test 4 of section 12 (Multiple multiple-var callbacks work.). |
|
@mr-martian cool stuff. I will try to review this this weekend. |
|
@mr-martian I've only been able to have cursor look at your changes. With regards to the constant folding, could you pull those changes out for now. If we do decide to add constant folding I'd prefer to have it in a separate commit behind an option with tests. I'm trying to understand in when constant folding would be helpful. Do you have some examples? |
|
I've removed the folding entirely. |
|
|
|
Looking at the code for |
|
Sorry if I was unclear, the functionality that was |
|
@mr-martian sorry for letting this stall. I want to run this against the integration tests for all of our challenges. Unfortunately, these tests aren't automated so it'll take some time. I'll have some time in a couple of weeks to do that. |
made standardizeTree() directly modify tree, rather than deepClone() it at every level. Based on running the tests, this appears to now be as fast as it was before. The other changes are due to accidentally working from a local copy of the main repo, rather than my fork.
I made
stadardizeTree()do the job offoldConstants(), since there's really no need to recurse through the whole tree twice. I also made it fold binary nodes (e.g.5*5->25,"hi" === 3->false). If you don't want the added functionality, just comment out the if statement in lines 91-114.As far as I can tell, this has resulted in a significant performance increase, from around 480 ms to run all the tests to approximately 390 ms. (alternatively, I could state this as: it's roughly back to where it was before I started messing with it [380 ms], though this does not take into account the impact of adding 22 more tests)