1 Reply Latest reply on Jan 27, 2015 4:49 PM by jedwards

    Enhance performance of Ruby hash key lookup with HSA

    metrix

      Ruby is known for having "slow" performance and I thought it would be interesting to see what HSA could do for Ruby hash lookups -- specifically in this function here: ruby/st.c at trunk · ruby/ruby · GitHub  as It's dealing with an array instead of pointers like the find_entry function further down. So my questions are:

      1. Is this function as it stands something that could be optimized with HSA?

      2. Which HSA technology do I need to research if this is a good spot to optimize - HSAIL? CLOC?

      3. Any other ideas/suggestions?

       

      Brandon

        • Re: Enhance performance of Ruby hash key lookup with HSA
          jedwards

          Attempting to optimize this function with HSA, or any parallelization programming model would require significant changes to the structure of the hash table, and isn't a useful endeavor. Parallelization could be done on the comparison operation in the PTR_NOT_EQUAL macro, i.e. the calculation "(ptr) != 0 && ((ptr)->hash != (hash_val)", but because the table isn't a contiguous block of memory each entry must be traversed to find the next, making parallelization of the search impossible. Any parallelization optimization would require a redesign of the table data structure and how entries are stored.