Uploaded image for project: 'Spigot'
  1. Spigot
  2. SPIGOT-1196

Set permission without forcing recalculation everytime

XMLWordPrintable

    • Icon: New Feature New Feature
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • None

      The title says pretty much everything.
      Whenever you set a permission for a PermissionAttachment, it will recalculate everything attached to that specific Permissible.

      While it's not a problem when dealing with one or two permissions, it turns into a big problem when there're already several attachments to the Permissible and you want, for example, set/unset 50 permissions at once.

      The ideia is to add extra methods to set/unset permissions without forcing it to recalculate, or, if that's not possible, adding methods to set/unset several permissions and recalculating only once.

      Here're the results of some tests i've performed, i've set a specific amount of permissions 100 times, here're the averages for each of them (In this case, i've no other attachments to the Permissible except for the one i've attached, but you can imagine what would happen if there were more):

      Recalculating X times
      Setting 10 permissions: ~1024325 ns
      Setting 25 permissions: ~2555764 ns
      Setting 100 permissions: ~15843354 ns

      Recalculating once
      Setting 10 permissions: ~453827 ns
      Setting 25 permissions: ~483728 ns
      Setting 100 permissions: ~521367 ns

            Unassigned Unassigned
            WinX64 Lucas
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: