New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
teardownMap slows perfomance drastically #595
Comments
How are you removing it exactly? Sent from my iPhone
|
You may just put return there to test, cycle itself (even empty) causes performance drop teardownMap = function(){
return
for(var cid in madeMap){
if(madeMap[cid].added) {
delete madeMap[cid].obj._cid;
}
}
madeMap = null;
}, |
Could this be fixed via #604? |
@daffl Performance drop is significant when you have quite large array to be converted to can.List many times in a row. I noticed that because in my application I started to experience performance issues after update from master, debugged it and found out that it was due to e767fc6 commit. |
I've confirmed this is indeed more than 10x slower. It seems that just setting |
Ok, I figured this out. The problem is not This is because by removing Closing... however, I'm going to work on getting a benchmark workflow into canjs. |
So what does this mean? After e767fc6 performance became worse obviously. If what is the a way to improve it? |
Performance did not become worse. There was a bug that made it appear faster than it was. You could get the same speed as changing your above code to: var map = new can.Map(),
objects = [];
for (var i = 0; i < 100; i++){
objects.push({prop: 'prop', nest: {prop: 'prop', nest: {prop: 'prop'}}})
}
var objectList = new can.List(objects)
var start = new Date()
for (var j = 0; j < 100; j++){
map.attr('obj', objectList)
}
var time = (new Date() - start)/1000
// time is ten times more with tearing down than without it
console.log('time', time) This was added to solve #521 |
In map.js there is function teardownMap added to remove _cid on orignal object.
This code calculates performance time with 1000 objects converted to can.Map, and with teardownMap it 10 times slower than without it.
I could add test but not sure what to check, as performance is relative.
The text was updated successfully, but these errors were encountered: