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
After: 3.5s. A 5x increase doesn't seem to make sense, as iterating thru the FP list and checking for matches gets tripled:
• entry
• entry + " [LOOKS INTENTIONAL]"
• entry + " [SOME LOOK INTENTIONAL]"
The entries that are FPs aren't even tripled, as we only have to search part of the list, or not all three.
And that's the only change. It's not even everything we do in this function. But anyway...
Changing the FP entry container from a list to a set, we get 0.6s. Whether we search for only the original string or all three variants. A performance penalty-free enhancement? I'll take it!
Accept all 3 variants, still using a list: 1.1s. Man. There's something about testing list membership, under the hood, that makes Python fast (...or C++ slow).
There's something about testing list membership, under the hood, that makes Python fast (...or C++ slow).
Python lists aren't really "lists" as we know them, but more comparable to a vector in C++.
A doubly-linked list probably has a bit more overhead when iterating, adding up to yield our time difference.
Be interesting to try an approach using std::vector and seeing how performance compares. Edit: 3.625s. Moderately slower or within margin of error. Hm. C++ Y U so slow!
On the Python side, still using lists instead of sets, we can speed up the process by using try, index, except, and pop to avoid searching for the string again on removal (see #289).
Will it be faster than using a set? Probably not? Edit: 0.925s searching for 1 string; 1.05s searching for up to 3. Within margin of error.
So I remember what I'm doing with various revisions of the code...
Activity
yakra commentedon Mar 24, 2020
fix #150 first
yakra commentedon Mar 26, 2020
C++:
• entry
• entry + " [LOOKS INTENTIONAL]"
• entry + " [SOME LOOK INTENTIONAL]"
The entries that are FPs aren't even tripled, as we only have to search part of the list, or not all three.
And that's the only change. It's not even everything we do in this function. But anyway...
Python:
yakra commentedon Mar 27, 2020
Python:
yakra commentedon Mar 27, 2020
Python lists aren't really "lists" as we know them, but more comparable to a vector in C++.
A doubly-linked list probably has a bit more overhead when iterating, adding up to yield our time difference.
Be interesting to try an approach using std::vector and seeing how performance compares.
Edit: 3.625s. Moderately slower or within margin of error. Hm. C++ Y U so slow!
On the Python side, still using lists instead of sets, we can speed up the process by using
try,index,except, andpopto avoid searching for the string again on removal (see #289).Will it be faster than using a set? Probably not?
Edit: 0.925s searching for 1 string; 1.05s searching for up to 3. Within margin of error.
So I remember what I'm doing with various revisions of the code...
version