{"action":"created","issue":{"url":"https://api.github.com/repos/corenova/yang-js/issues/73","repository_url":"https://api.github.com/repos/corenova/yang-js","labels_url":"https://api.github.com/repos/corenova/yang-js/issues/73/labels{/name}","comments_url":"https://api.github.com/repos/corenova/yang-js/issues/73/comments","events_url":"https://api.github.com/repos/corenova/yang-js/issues/73/events","html_url":"https://github.com/corenova/yang-js/issues/73","id":368914151,"node_id":"MDU6SXNzdWUzNjg5MTQxNTE=","number":73,"title":"performence issue with big amount of list data","user":{"login":"quantang","id":13145171,"node_id":"MDQ6VXNlcjEzMTQ1MTcx","avatar_url":"https://avatars0.githubusercontent.com/u/13145171?v=4","gravatar_id":"","url":"https://api.github.com/users/quantang","html_url":"https://github.com/quantang","followers_url":"https://api.github.com/users/quantang/followers","following_url":"https://api.github.com/users/quantang/following{/other_user}","gists_url":"https://api.github.com/users/quantang/gists{/gist_id}","starred_url":"https://api.github.com/users/quantang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/quantang/subscriptions","organizations_url":"https://api.github.com/users/quantang/orgs","repos_url":"https://api.github.com/users/quantang/repos","events_url":"https://api.github.com/users/quantang/events{/privacy}","received_events_url":"https://api.github.com/users/quantang/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-10-11T01:19:32Z","updated_at":"2018-10-11T01:55:57Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"We are using yang-js to deal with network topology data and getting some performance issues when the amount of data reaches a certain level, such as we have a network entity which has 800 nodes and 2000 links. We did some perf profiling and identified the following potential improvements we may have:\r\n\r\n1. Do not valid a \"leafref\" element if the \"require-instance\" is false.\r\nWe have some \"leafref\" elements with \"require-instance\" false, however, the yang-js still takes a lot of time trying to find the matching entity, which could be skipped.\r\n\r\n2. XPath.process function.\r\nThere is a reduce function against data inside, which calls Array.concat function in the reducer function. It will take lots of time if the data is a big array, as the Array.concat will create a new array every time. I tried to refine it and push the new elements into an existing array, which makes it much better.\r\n\r\n3. There is no key index for list element.\r\nThe perf profiling shows some performance issue on Property.in and Property.merge, which should be related to that the yang-js does not have the internal key index for the list element. As it needs to iterate all the elements to make sure there is no duplicate key for the \"merge\" operation or find the right list item based on a given key for \"in\" operation.\r\n\r\nCheers.\r\n"},"comment":{"url":"https://api.github.com/repos/corenova/yang-js/issues/comments/428791263","html_url":"https://github.com/corenova/yang-js/issues/73#issuecomment-428791263","issue_url":"https://api.github.com/repos/corenova/yang-js/issues/73","id":428791263,"node_id":"MDEyOklzc3VlQ29tbWVudDQyODc5MTI2Mw==","user":{"login":"saintkepha","id":952940,"node_id":"MDQ6VXNlcjk1Mjk0MA==","avatar_url":"https://avatars2.githubusercontent.com/u/952940?v=4","gravatar_id":"","url":"https://api.github.com/users/saintkepha","html_url":"https://github.com/saintkepha","followers_url":"https://api.github.com/users/saintkepha/followers","following_url":"https://api.github.com/users/saintkepha/following{/other_user}","gists_url":"https://api.github.com/users/saintkepha/gists{/gist_id}","starred_url":"https://api.github.com/users/saintkepha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/saintkepha/subscriptions","organizations_url":"https://api.github.com/users/saintkepha/orgs","repos_url":"https://api.github.com/users/saintkepha/repos","events_url":"https://api.github.com/users/saintkepha/events{/privacy}","received_events_url":"https://api.github.com/users/saintkepha/received_events","type":"User","site_admin":false},"created_at":"2018-10-11T01:55:57Z","updated_at":"2018-10-11T01:55:57Z","author_association":"COLLABORATOR","body":"Hi @quantang, thanks for this. Its perfect timing since this was exactly the area I’m currently working on optimizing. For one, I’ve recently shifted the internal List implementation to use Map instead of pure Array. This should help with the merge operation. \r\n\r\nAnother optimization is in how we handle “config false” data.  In this case, instead of attaching Propertly instance to every node in the hierarchy, I just do a new .validate call which only performs schema validity test. \r\n\r\nI also have added test cases to measure list operation timing data so I can track improvements along the way. \r\n\r\nAs it currently stands, the performance for larger set of list entries is subpar and I’m focused on optimizing it. "}}
{"actor":{"display_login":"saintkepha"}}