You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Slurp WPTs into core and use strtok, as done with .lists.
See if there's a speed increase.
What's the largest WPT file I'd have to contend with? (rus.ah006irk.wpt, at 58882 bytes.)
Nope. Slower by ~0.3 s. MAYBE revisit this when datachecks are moved into read_wpt -- to give each thread something more to do than just wait on strtok_mtx.
If this works out well (or even if not?) try a more C-string-based approach for the TravelerList ctor.
Or does it? Not necessarily...
I was misled by watching my CPU History graph churn away at 100%, concluding that disk access was no longer a major bottleneck here. The reason for this, though, is not faster disk reading, but that .list processing is a more CPU intensive task, and is already (or at least, darn close to, for a dry run) our bottleneck. We see this in the redlined CPUs while averaging much lower read speeds for the task at hand.
Nonetheless, it seems we can get somewhat faster read speeds using the "slurp+strtok" method, and I have to wonder what this could look like for a less CPU-bound task.
It's worth giving this another look.
List files, on a dry run, have CPU use hovering just a touch below 100%, with speed increasing marginally on a wet run. This suggests we're just below the CPU bottleneck threshold on a dry run, and shouldn't expect much more than 0.913 MBps on a dry run, or less than 66.8s .list processing time.
I'll try it out anyway...
"slurp+strtok":
wpts @ 74.5s dry.
Only 0.1s better than the 1st attempt with the old code.
OTOH, 7.8s better than the 2nd attempt, down about 9.5s.
Too close to call; gonna make another attempt.
Thumb drive: read times look highly variable, with reading method & number of threads not having significant effect. All four dry runs were punctuated by long periods (sometimes close to a minute) of very slow progress, with the CPU meter essentially at 0%. The behavior was sometimes observed reading .lists, sometimes not.
With the read times involved, I will not test further.
Hard disk: strtok method does have a slight advantage, so in it goes, unless there's a big RAM use difference, which I don't think there'll be. I'll have a look.
Both versions top out at 69.5% of 3.8GiB.
Using strtok.
Keeping strtok_mtx and not using the homebrew mutex-less solution above, to just keep it simple.
No harm to speed here, as this is an I/O-bound task. On BiggaTomato, at least. The situation might be different on noreaster, but I'll cross that bridge later.
Activity
yakra commentedon Jan 4, 2019
If this works out well (or even if not?) try a more C-string-based approach for the TravelerList ctor.
yakra commentedon Jan 5, 2019
Nope. Slower by ~0.3 s.
MAYBE revisit this when datachecks are moved into read_wpt -- to give each thread something more to do than just wait on
strtok_mtx.Still worth looking into.
yakra commentedon Jan 5, 2019
.list file processing ~7.2s -> ~6.6s
yakra commentedon Jan 5, 2019
Closing this issue now, and hoping I'll remember that when the time comes.
yakra commentedon Jan 6, 2019
a potential alternative to strtok, which avoids the need for a mutex:
[-]Slurp WPTs onto core a la .lists[/-][+]Slurp WPTs into core a la .lists[/+]yakra commentedon Jan 6, 2019
Not useful in WPT file processing. Adds ~0.1-0.2 s compared to 16.7 s.
Give it a try in .list file processing.
Test outer loop, inner loop, both, and none.
(May be more useful in outer loop?)
yakra commentedon Jan 6, 2019
Saves 0.1s. Sometimes. Not even that is consistent.
Leaving as-is; keeping it simple.
May be worth revisiting once multithreading is implemented on noreaster, where more cores can get hung up waiting for
strtok_mtxUntil then, closing for housekeeping purposes.
yakra commentedon Jan 31, 2019
Could this make up for slow reading on a fresh run before WPTs are in the hard disk's cache? List file processing goes much faster.
yakra commentedon Feb 13, 2019
Reading waypoints for all routes:
Processing traveler list files:
We can see that .list files don't suffer from nearly the same slowdown as WPTs.
(Heck, what's our margin of error here?)
yakra commentedon Feb 13, 2019
WPT files: 61.7 MB (note: this figure is inflated a bit by 701 unprocessed wpt files)Reading WPTs: 0.827 MBps dry -> 4.226 MBps wet
WPT files: 61 MB (without unprocessed wpt files)
Reading WPTs: 0.818 MBps dry -> 4.178 MBps wet
list files: 6.3 MB
Reading lists: 0.913 MBps dry -> 0.940 MBps wet
yakra commentedon Feb 14, 2019
Or does it? Not necessarily...
I was misled by watching my CPU History graph churn away at 100%, concluding that disk access was no longer a major bottleneck here. The reason for this, though, is not faster disk reading, but that .list processing is a more CPU intensive task, and is already (or at least, darn close to, for a dry run) our bottleneck. We see this in the redlined CPUs while averaging much lower read speeds for the task at hand.
Nonetheless, it seems we can get somewhat faster read speeds using the "slurp+strtok" method, and I have to wonder what this could look like for a less CPU-bound task.
It's worth giving this another look.
yakra commentedon Feb 14, 2019
Another attempt, same code:
wpts: 82.3s @ 0.741 MBps -> 14.3s @ 4.266 MBps
Lists: 7.0s @ 0.900 MPbs -> 6.6s @ 0.955 MBps
List files, on a dry run, have CPU use hovering just a touch below 100%, with speed increasing marginally on a wet run. This suggests we're just below the CPU bottleneck threshold on a dry run, and shouldn't expect much more than 0.913 MBps on a dry run, or less than 66.8s .list processing time.
I'll try it out anyway...
yakra commentedon Feb 14, 2019
"slurp+strtok":
wpts @ 74.5s dry.
Only 0.1s better than the 1st attempt with the old code.
OTOH, 7.8s better than the 2nd attempt, down about 9.5s.
Too close to call; gonna make another attempt.
yakra commentedon Feb 14, 2019
hard disk, 4 threads
dry
dry
wet
wet
thumb drive, 4 threads
dry
dry
wet
wet
thumb drive, 1 thread
dry
dry
wet
wet
Thumb drive: read times look highly variable, with reading method & number of threads not having significant effect. All four dry runs were punctuated by long periods (sometimes close to a minute) of very slow progress, with the CPU meter essentially at 0%. The behavior was sometimes observed reading .lists, sometimes not.
With the read times involved, I will not test further.
Hard disk: strtok method does have a slight advantage, so in it goes, unless there's a big RAM use difference, which I don't think there'll be. I'll have a look.
yakra commentedon Feb 17, 2019
Both versions top out at 69.5% of 3.8GiB.
Using strtok.
Keeping
strtok_mtxand not using the homebrew mutex-less solution above, to just keep it simple.No harm to speed here, as this is an I/O-bound task. On BiggaTomato, at least. The situation might be different on noreaster, but I'll cross that bridge later.
yakra commentedon Apr 8, 2020
Is not in fact I/O-bound on a wet run. Rather, at the time the statement was made, by all_waypoints.mtx, which has since been made much more efficient.