summaryrefslogtreecommitdiffstats
path: root/src/llist_ts.h
Commit message (Collapse)AuthorAgeFilesLines
* src/llist.c: Add a tail pointerLukas Fleischer2011-10-051-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Adding a tail pointer to each list increases memory footprint by four bytes, while reducing the runtime of llist_add() from O(n) to O(1). In testing, the time required to append 100000 elements to a linked list was reduced from 29.245s to 0.009s. Our second main concern is to reduce the runtime of llist_add_sorted() when inserting elements from a presorted list (this is reduced from O(n) to O(1) as well), since the data files contain appointments in sorted order and are always processed front to back. Some local numbers show how this speeds up calcurse startup (test set with 50000 appointments): 0.22user 0.12system 0:00.35elapsed 99%CPU (0avgtext+0avgdata 5396maxresident)k 0inputs+8outputs (0major+1398minor)pagefaults 0swaps As opposed to the unpatched binary: 21.97user 0.25system 0:22.23elapsed 99%CPU (0avgtext+0avgdata 5388maxresident)k 0inputs+48outputs (0major+1396minor)pagefaults 0swaps This is a ~10000% increase in speed. Timings for reading random input files generated by a script stay the same (32.391s vs. 31.776s). Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Update copyright notices in source files, documentation and "COPYING".Lukas Fleischer2011-04-221-1/+1
| | | | | | | | | * Update copyright dates (use 2004-2011 as date range everywhere). * Change copyright holder from "Frederic Culot" to "calcurse Development Team". Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Add macros to use for thread-safe linked lists.Lukas Fleischer2011-04-191-0/+87
Add LLIST_TS_* macros in a fashion similar to the already existing LLIST_* macros. Unlike the non-thread-safe version, these include LLIST_TS_LOCK and LLIST_TS_UNLOCK which can be used to lock (and unlock) a list (hence the thread-safety). Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>