{"action":"created","issue":{"url":"https://api.github.com/repos/junkdog/artemis-odb/issues/369","labels_url":"https://api.github.com/repos/junkdog/artemis-odb/issues/369/labels{/name}","comments_url":"https://api.github.com/repos/junkdog/artemis-odb/issues/369/comments","events_url":"https://api.github.com/repos/junkdog/artemis-odb/issues/369/events","html_url":"https://github.com/junkdog/artemis-odb/issues/369","id":107175759,"number":369,"title":"Controversial Design Discussion","user":{"login":"gjroelofs","id":398630,"avatar_url":"https://avatars.githubusercontent.com/u/398630?v=3","gravatar_id":"","url":"https://api.github.com/users/gjroelofs","html_url":"https://github.com/gjroelofs","followers_url":"https://api.github.com/users/gjroelofs/followers","following_url":"https://api.github.com/users/gjroelofs/following{/other_user}","gists_url":"https://api.github.com/users/gjroelofs/gists{/gist_id}","starred_url":"https://api.github.com/users/gjroelofs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gjroelofs/subscriptions","organizations_url":"https://api.github.com/users/gjroelofs/orgs","repos_url":"https://api.github.com/users/gjroelofs/repos","events_url":"https://api.github.com/users/gjroelofs/events{/privacy}","received_events_url":"https://api.github.com/users/gjroelofs/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/junkdog/artemis-odb/labels/API%20Discussion","name":"API Discussion","color":"bfe5bf"}],"state":"closed","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/junkdog/artemis-odb/milestones/10","html_url":"https://github.com/junkdog/artemis-odb/milestones/artemis-1.4.0","labels_url":"https://api.github.com/repos/junkdog/artemis-odb/milestones/10/labels","id":798090,"number":10,"title":"artemis-1.4.0","description":"","creator":{"login":"junkdog","id":804039,"avatar_url":"https://avatars.githubusercontent.com/u/804039?v=3","gravatar_id":"","url":"https://api.github.com/users/junkdog","html_url":"https://github.com/junkdog","followers_url":"https://api.github.com/users/junkdog/followers","following_url":"https://api.github.com/users/junkdog/following{/other_user}","gists_url":"https://api.github.com/users/junkdog/gists{/gist_id}","starred_url":"https://api.github.com/users/junkdog/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/junkdog/subscriptions","organizations_url":"https://api.github.com/users/junkdog/orgs","repos_url":"https://api.github.com/users/junkdog/repos","events_url":"https://api.github.com/users/junkdog/events{/privacy}","received_events_url":"https://api.github.com/users/junkdog/received_events","type":"User","site_admin":false},"open_issues":7,"closed_issues":1,"state":"open","created_at":"2014-09-22T11:11:38Z","updated_at":"2016-01-03T23:40:13Z","due_on":null,"closed_at":null},"comments":29,"created_at":"2015-09-18T10:20:03Z","updated_at":"2016-01-03T23:40:13Z","closed_at":"2016-01-03T23:40:13Z","body":"![Hic Sunt Dracones](http://svemir.co/images/title.png)\r\n\r\n<disclaimer>\r\nAfter going through core a couple of times over the past few days I have some (very) controversial questions. I wanted to add this issue to contain the discussion and to make sure that any comments on my part are not misinterpreted. (I love Artemis and all the effort put into it, so I hope this issue won't be interpreted as anything else than an attempt to gain insight and open discussion.)\r\n</disclaimer>\r\n\r\nAlso, I could of course just be plain wrong. :-)\r\n(Especially with regards to the Unbearable Lightness of Entity, which lies at the heart of 95% of the questions)\r\n\r\n### Flyweight & Entity ID propagation\r\nThe almost required instantiation of Flyweight in BaseSystem / EntityManager, TagManager, GroupManager, etc to me feels like an optimization pass leaking into the API.\r\nIt complicates the lifecycle, and adds added setup to use proper API. Providing abstractions over these to accomodate for this requirement will in turn \r\n\r\nI want to propose moving back to an Entity based API for add/remove etc in the SubscriptionListener / EntityObserver. The flyweight creation can then be moved to the original caller location and its lifecycle properly contained.\r\n\r\n**Essentially**: I don't fully understand the move to operations on EntityID ints as opposed to Entity instances. To me the API would become a lot cleaner, and memory optimizations (ref vs int; cache hitting; array copy performance) are negated by the cpu overhead introduced (lookup, transformation) and the convolution of API.\r\n\r\n### EntityEdit\r\nAs far as I understand it now, the purpose of EntityEdit is to maintain a composition(id) and provide batch operations as to combine operations that alter the compositions id in an effort to reduce changes to the composition id.\r\n\r\n- It makes normal (un-edited) operations on Entities slower by the underlying bureaucracy and added abstraction.\r\n- The memory benefit of maintaining a separate EnityEdit Pool which is lazily tied to an Entity and re-used is negated for many use-cases that actually require the memory benefit.    \r\n*E.g.: I think that in most worlds with many entities (1.000.000+), most entities are of a similar family (e.g.: particles) and would most likely all need to be updated/synced on changes within a single process to a system. This in turn queues/instantiates the number of EntityEdits of the number of entities that are changed. Even worse; if the system is truly memory constrained a run-time operation which happens to trigger to many update operations could put the system over the top.\r\nThe use-cases where we are not dealing with many entities will not benefit that much from abstracting over the memory optimization.*\r\n\r\nInlining the EntityEdit primary variables into Entity (hasBeenAddedToWorld, componentBits, scheduledDeletion) would have about a 20MB performance impact on a system with 1.000.000 entities. (Which doesn't include the gained memory benefits of removing the pooling and class)\r\n\r\n### World Bitset changed/added\r\nI assume that the benefit of this are in terms of memory. However, operations such as cardinality() and the requirement to lookup all indices actually set have a CPU performance impact on the core process code."},"comment":{"url":"https://api.github.com/repos/junkdog/artemis-odb/issues/comments/168554832","html_url":"https://github.com/junkdog/artemis-odb/issues/369#issuecomment-168554832","issue_url":"https://api.github.com/repos/junkdog/artemis-odb/issues/369","id":168554832,"user":{"login":"DaanVanYperen","id":6305602,"avatar_url":"https://avatars.githubusercontent.com/u/6305602?v=3","gravatar_id":"","url":"https://api.github.com/users/DaanVanYperen","html_url":"https://github.com/DaanVanYperen","followers_url":"https://api.github.com/users/DaanVanYperen/followers","following_url":"https://api.github.com/users/DaanVanYperen/following{/other_user}","gists_url":"https://api.github.com/users/DaanVanYperen/gists{/gist_id}","starred_url":"https://api.github.com/users/DaanVanYperen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DaanVanYperen/subscriptions","organizations_url":"https://api.github.com/users/DaanVanYperen/orgs","repos_url":"https://api.github.com/users/DaanVanYperen/repos","events_url":"https://api.github.com/users/DaanVanYperen/events{/privacy}","received_events_url":"https://api.github.com/users/DaanVanYperen/received_events","type":"User","site_admin":false},"created_at":"2016-01-03T23:40:13Z","updated_at":"2016-01-03T23:40:13Z","body":"Closing for grooming. Think we've implemented all agreed upon actionables in 1.0 from this discussion. If you feel actionable issues/requests remain, feel free to re-open as new tickets @gjroelofs @junkdog @Namek!"}}