-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Avoid reverse SortedSet
in MemoryPool
#3822
Conversation
[TestClass] | ||
public class UT_ReversePoolItemComparer : UT_PoolItem | ||
{ | ||
public UT_ReversePoolItemComparer() : base(ReversePoolItemComparer.Instance, -1) { } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is empty?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same tests, but reversed
@Jim8y could you help me with benchmarks here? |
{ | ||
if (otherTx == null) return 1; | ||
int ret = (Tx.GetAttribute<HighPriorityAttribute>() != null).CompareTo(otherTx.GetAttribute<HighPriorityAttribute>() != null); | ||
var ret = (Tx.GetAttribute<HighPriorityAttribute>() != null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe for the _sortedTransactions
there will be an effect, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This return the same, is inverted later
Before:
After:
I dont see much performance difference, basically the same. |
Seems slower? 🫣 |
private static NeoSystem MockNeoSystem() | ||
{ | ||
// Use reflection to create a minimal NeoSystem without initializing all components | ||
var constructor = typeof(NeoSystem).GetConstructor( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to use Internal Visiable To?
/// <summary> | ||
/// A class that mimics the behavior of the internal PoolItem for MemoryPool benchmarks | ||
/// </summary> | ||
public class TestMemPoolItem : IComparable<TestMemPoolItem> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duplicated PoolItem.
Is it possible to use Internal Visiable To?(Same as calling MemoryPool internal methods)
Closed because no speed up |
Description
I don't know why we always reverse the iterator in these two sorted set, @roman-khimov could you check these changes please.
This could helps with tps because it improves the memPool management.
Type of change
How Has This Been Tested?
UT_ReversePoolItemComparer
Test Configuration:
Checklist: