{"action":"created","issue":{"url":"https://api.github.com/repos/Jeija/minetest-mod-mesecons/issues/277","repository_url":"https://api.github.com/repos/Jeija/minetest-mod-mesecons","labels_url":"https://api.github.com/repos/Jeija/minetest-mod-mesecons/issues/277/labels{/name}","comments_url":"https://api.github.com/repos/Jeija/minetest-mod-mesecons/issues/277/comments","events_url":"https://api.github.com/repos/Jeija/minetest-mod-mesecons/issues/277/events","html_url":"https://github.com/Jeija/minetest-mod-mesecons/issues/277","id":167289068,"number":277,"title":"Forceloading is excessive","user":{"login":"Hawk777","id":365236,"avatar_url":"https://avatars.githubusercontent.com/u/365236?v=3","gravatar_id":"","url":"https://api.github.com/users/Hawk777","html_url":"https://github.com/Hawk777","followers_url":"https://api.github.com/users/Hawk777/followers","following_url":"https://api.github.com/users/Hawk777/following{/other_user}","gists_url":"https://api.github.com/users/Hawk777/gists{/gist_id}","starred_url":"https://api.github.com/users/Hawk777/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Hawk777/subscriptions","organizations_url":"https://api.github.com/users/Hawk777/orgs","repos_url":"https://api.github.com/users/Hawk777/repos","events_url":"https://api.github.com/users/Hawk777/events{/privacy}","received_events_url":"https://api.github.com/users/Hawk777/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Jeija/minetest-mod-mesecons/labels/discussion","name":"discussion","color":"02e10c"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":14,"created_at":"2016-07-25T06:08:53Z","updated_at":"2016-07-29T15:18:05Z","closed_at":null,"body":"This is a bit of a mix of feature request and discussion topic. I’m not sure if people agree or not.\r\n\r\nAs written, at present, Mesecons forceloads every mapblock connected along a wire to a signal source when the signal changes state. In my opinion, forceloading is a rather large hammer being used against a rather small target. All we care about is tracing through the mapblocks to see where the wire connects to (and to change some nodes), yet to accomplish this, we will burn the global forceloading budget and activate a lot of mapblocks.\r\n\r\nWhat if, instead, in `get_node_force`, we called `get_node_or_nil` first, then, on a `nil` return, used a voxel manipulator to bring the target mapblock into the cache and simply called `get_node_or_nil` a second time? This would lead to all those mapblocks being loaded but inactive, which should be much cheaper. As long as signal edges occur more frequently than once every `server_unload_unused_data_timeout`, everything would live in cache permanently and so the initial `get_node_or_nil` would succeed and no voxel manipulator would ever be created, but we would not pay the cost of the mapblock being active. For slower signals, the blocks would eventually be unloaded, and subsequent signal edges would reload them via the VM.\r\n\r\nThoughts? If people are agreeable, I would be happy to look at implementing this myself and turning this into a PR."},"comment":{"url":"https://api.github.com/repos/Jeija/minetest-mod-mesecons/issues/comments/236208867","html_url":"https://github.com/Jeija/minetest-mod-mesecons/issues/277#issuecomment-236208867","issue_url":"https://api.github.com/repos/Jeija/minetest-mod-mesecons/issues/277","id":236208867,"user":{"login":"Hawk777","id":365236,"avatar_url":"https://avatars.githubusercontent.com/u/365236?v=3","gravatar_id":"","url":"https://api.github.com/users/Hawk777","html_url":"https://github.com/Hawk777","followers_url":"https://api.github.com/users/Hawk777/followers","following_url":"https://api.github.com/users/Hawk777/following{/other_user}","gists_url":"https://api.github.com/users/Hawk777/gists{/gist_id}","starred_url":"https://api.github.com/users/Hawk777/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Hawk777/subscriptions","organizations_url":"https://api.github.com/users/Hawk777/orgs","repos_url":"https://api.github.com/users/Hawk777/repos","events_url":"https://api.github.com/users/Hawk777/events{/privacy}","received_events_url":"https://api.github.com/users/Hawk777/received_events","type":"User","site_admin":false},"created_at":"2016-07-29T15:18:05Z","updated_at":"2016-07-29T15:18:05Z","body":"> I think it should make sense to just always load the current MapBlock into a VManip, since the server also thinks in terms of MapBlocks. So it wouldn't improve performance much to load less than the current MapBlock (assuming that passing the data from minetest to lua isn't the bottleneck - that remains to be testesd),\r\n\r\nA VM isn’t capable of loading less than a mapblock anyway.\r\n\r\n> and I also don't think loading more than the current mapblock is required in many cases, since most circuits are pretty small. If this turns out to be poorly performant, we could have some fancy prediction (e.g. load close blocks if node is close to the edge of a mapblock, prefer loading horizonal nodes over loading vertical ones, assume straight wires, ...), but I hope this isn't necessary.\r\n\r\nI also agree with this idea; I’ll write up a basic implementation which loads one mapblock per VM and we can add some sort of hinting mechanism later if it becomes necessary."}}
{"actor":{"display_login":"Hawk777"}}