EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

2002  2003  2004  2005  2006  2007  2008  2009  <20102011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 2002  2003  2004  2005  2006  2007  2008  2009  <20102011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: [Merge] lp:~dirk.zimoch/epics-base/named-soft-events into lp:epics-base
From: mdavidsaver <[email protected]>
To: Ralph Lange <[email protected]>
Date: Mon, 25 Oct 2010 16:29:43 -0000
> I don't like all these string comparisons at run time.
> 
> Couldn't the implementation register an event string at first use (using a
> simple register utility) and then use integer event numbers, so there are no
> changes in run time behaviour?

A simple thing might be to hash the string into an integer.  To avoid collisions keep a list of previously hashed values.  If a collision is detected then add spaces to the string until it produces a unique hash.  Since the table is thus one-to-one it can be used for reverse lookups (ie scanpel()).

An objection to this is that computed hash list grows without bound if someone were to enter lots of different strings (typos?).  A way to avoid this would be to separate event registration from use as Ralph suggests.  Having for example, "int create_event_key(char*)" which takes a string and returns a unique integer key, and "post_event_key(int)" which takes the key.

This would be a significant change to how post_event() is used since the caller would be required to remember the integer key.  So I imagine a shortcut "post_event(char*)" which does the hash every time would be needed.

-- 
https://code.launchpad.net/~dirk.zimoch/epics-base/named-soft-events/+merge/26190
Your team EPICS Core Developers is requested to review the proposed merge of lp:~dirk.zimoch/epics-base/named-soft-events into lp:epics-base.


References:
Re: [Merge] lp:~dirk.zimoch/epics-base/named-soft-events into lp:epics-base Ralph Lange

Navigate by Date:
Prev: Re: [Merge] lp:~dirk.zimoch/epics-base/named-soft-events into lp:epics-base mdavidsaver
Next: Re: [Merge] lp:~dirk.zimoch/epics-base/named-soft-events into lp:epics-base Dirk Zimoch
Index: 2002  2003  2004  2005  2006  2007  2008  2009  <20102011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: [Merge] lp:~dirk.zimoch/epics-base/named-soft-events into lp:epics-base Ralph Lange
Next: Re: [Merge] lp:~dirk.zimoch/epics-base/named-soft-events into lp:epics-base Dirk Zimoch
Index: 2002  2003  2004  2005  2006  2007  2008  2009  <20102011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 02 Feb 2012 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·