You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bugs@apr.apache.org by bu...@apache.org on 2009/07/04 02:04:30 UTC

DO NOT REPLY [Bug 47471] New: apr_hash: Implement apr_hash_set_if_new()

https://issues.apache.org/bugzilla/show_bug.cgi?id=47471

           Summary: apr_hash: Implement apr_hash_set_if_new()
           Product: APR
           Version: HEAD
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: APR
        AssignedTo: bugs@apr.apache.org
        ReportedBy: nrc@cs.berkeley.edu


Created an attachment (id=23923)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=23923)
Candidate patch, v1

Attached is a patch that adds a new function to the apr_hash API,
apr_hash_set_if_new(). This is similar to apr_hash_set(), except that it
doesn't modify the hash table if the key is already contained in the table. It
also returns the value that is now associated with the input key (i.e. the old
value associated with key if the key wasn't new).

The motivation is basically just performance: rather than doing two lookups to
check if the key is present and then do apr_hash_set(), this method allows only
a single HT lookup to be done.

Suggestions for a better name are welcome. The attached patch adds a test for
the new functionality.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@apr.apache.org
For additional commands, e-mail: bugs-help@apr.apache.org


DO NOT REPLY [Bug 47471] apr_hash: Implement apr_hash_set_if_new()

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=47471

Neil Conway <nr...@cs.berkeley.edu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #23923|0                           |1
        is obsolete|                            |

--- Comment #1 from Neil Conway <nr...@cs.berkeley.edu> 2009-09-16 11:21:02 PDT ---
Created an attachment (id=24278)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=24278)
Candidate patch, v2

Attached is a revised version of this patch that fixes a bug in V1:
apr_hash_set_if_new() neglected to expand the array if the collision rate grows
too high.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@apr.apache.org
For additional commands, e-mail: bugs-help@apr.apache.org