Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why use -cost get the record of bigger latency? #1

Closed
yogurfrul opened this issue Jun 14, 2022 · 3 comments
Closed

Why use -cost get the record of bigger latency? #1

yogurfrul opened this issue Jun 14, 2022 · 3 comments

Comments

@yogurfrul
Copy link

yogurfrul commented Jun 14, 2022

We know the cost in auto_schedule measure result means [latency] or [Cost], the smaller the better.
While in the code as below:

# Push with -cost as heapq is min-heap as we want the worst record on the top.

as you say eapq is min-heap the record on the top would be the best.
Why use -cost get the record of bigger latency?

@yogurfrul
Copy link
Author

@comaniac

@comaniac
Copy link
Contributor

The heap aims to keep the top-N records with minimum cost. To do so, we iterate all records and push them to the heap. When the heap size is larger than N, we remove the one with worst cost. Thus, we need max-heap to keep the so far worst record on the top in O(1).

@yogurfrul
Copy link
Author

Yes, I got the use of heap .
While I found the func records.peak() in tutorials to get the best schedule, actually it retuen the first record.
As you say above, the heap aims to keep the worst record on the top.
And I run the test with my own record of the same workload, the peak func really get the the first one in _data with worse cost.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants