Merge lp:~epics-core/epics-base/bigdb into lp:~epics-core/epics-base/3.16
Status: | Rejected |
---|---|
Rejected by: | Ralph Lange |
Proposed branch: | lp:~epics-core/epics-base/bigdb |
Merge into: | lp:~epics-core/epics-base/3.16 |
Diff against target: |
358 lines (+202/-38) 8 files modified
src/ioc/db/dbScan.c (+2/-2) src/ioc/dbStatic/dbBase.h (+19/-19) src/ioc/dbStatic/dbLexRoutines.c (+19/-1) src/ioc/dbStatic/dbStaticLib.c (+2/-13) src/libCom/ellLib/Makefile (+1/-0) src/libCom/ellLib/ellLib.h (+2/-0) src/libCom/ellLib/ellSort.c (+83/-0) src/libCom/test/epicsEllTest.c (+74/-3) |
To merge this branch: | bzr merge lp:~epics-core/epics-base/bigdb |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ralph Lange | Needs Resubmitting | ||
Andrew Johnson | Needs Fixing | ||
Review via email: mp+292997@code.launchpad.net |
Description of the change
A couple of weeks ago I made a semi-intentional test of what happens to an IOC with >100k records. It works quite well, if you have the patience to wait for it to start up. Some profiling found two hot spots, both list insertion sorts, in dbCreateRecord() and addToList(). trans() in macCore.c is a distant third.
The loop in addToList() is written in such a way that the common case (all PHAS==0) always traverses the entire list. I change this the common case simply appends, and the worst case is unchanged.
dbCreateRecord() is harder to fix while still maintaining the sorting*. I settled on re-sorting once per call to dbReadCOM(), which works except for dbReadTemplate() with lots of little templates.
* It would be even better to sort once in iocInit(), or not at all, but I wasn't sure if anything depends on the ordering.
Unmerged revisions
- 12742. By mdavidsaver
-
ellSort: comments and redundant asserts
- 12741. By mdavidsaver
-
fixup comments
- 12740. By mdavidsaver
-
test ellSortStable
- 12739. By mdavidsaver
-
dbCreateRecord use ellSortStable()
sort records once per dbLoadCOM()
- 12738. By mdavidsaver
-
ellSort
- 12737. By mdavidsaver
-
dbScan: optimize addToList
Insert from back to maintain ~same order.
Avoid iterating entire list each time
in the common case where all PHAS==0 - 12736. By mdavidsaver
-
whitespace
Interesting.
Please adjust or remove the comment at dbStaticLib.c:1415. I can't immediately think of a reason why records still need to be sorted; that particular comment in dbCreateRecord() dates back to when dbStaticLib.c was first added to CVS in 1993 (commit #905). There was already a hash table which was used for name lookups in that version, so it wasn't to speed up name searches. It was most likely because back in the days of binary database files and the curses-based dct (database configuration tool), record names for editing were presented to the user in a list, and it would have been very unfriendly to not have sorted it first. Have you tried removing the sort completely?
The new ellSort.c file should have a copyright/license header. I don't recognize any of the chiark website's example C code in it, so I'm guessing you wrote this yourself from scratch just using the algorithm and we don't need to import their copyright notice or license text at all.