Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    Query relating to privs.inc

    Scheduled Pinned Locked Moved Development
    1 Posts 1 Posters 435 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • L
      loonylion
      last edited by

      Something I stumbled upon while working on a bounty related to bug #6400. There is a function that sorts the privilege array (sort_privs($priv_list)) that calls 'cmp_privkeys($a, $b)' essentially 2,600 times on every page load, which can contribute to up to 20% of the page generation time on some pages.

      I'm struggling to see why this function is even necessary given that $priv_list is an associative array, therefore the position in the array of any given key has absolutely no bearing on the time taken to access that key.

      This area is clearly ripe for some improvement, so I'd like some clarification on exactly what the intent behind sorting this array is; so I can determine whether I need to find a faster sort algorithm or if the function can simply be eliminated on most if not all pages.

      1 Reply Last reply Reply Quote 0
      • First post
        Last post
      Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.