Skip to content

Commit abbd79b

Browse files
68412542+EagleAglow@users.noreply.github.com68412542+EagleAglow@users.noreply.github.com
authored andcommitted
Version 4
Multi-threaded approach
1 parent 99b0d3a commit abbd79b

File tree

4 files changed

+1401
-18
lines changed

4 files changed

+1401
-18
lines changed

entries/bfire/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,19 @@ Second version uses hash of station name to accumulate data and fill a TStringLi
5050
The list is initially unsorted and has linked objects for records holding accumulated data for each station.
5151
Finally, the TStringList is sorted and used to output sorted data.
5252

53+
Third version has a thread for the console (which waits for tabulation, then sorts and writes results),
54+
one thread to read file, four threads to tabulate stations (split by section of alphabet). File is read
55+
byte-wise into "classic" byte arrays for station name and temperature. The arrays are passed to one of
56+
four stacks, split by section of alphabet, for tabulation. Tabulation threads hash station name, use hash
57+
as index into a data array. After all data is read and tabulated, the four data arrays are added to an
58+
initially unsorted TStringList that holds unsorted Unicode station name and has linked pointers to
59+
tabulated data for each station. Finally, the TStringList is sorted, and the data is output.
60+
5361
## History
5462

5563
- Version 1.0: first working version, based on TStringList.
5664
- Version 1.1: modified rounding to new baseline.
5765
- Version 2.0: use hashing, sort later.
5866
- Version 2.1: minor speed tweaks.
5967
- Version 2.2: try hash functions modification.
68+
- Version 3.0: Six threads: one to read, four to tabulate, one (console) to rule them all...

0 commit comments

Comments
 (0)