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
It seems that in most cases, the Schema's field are not very long. The atc-router sets it as String, which allocates memory on the heap during each initialization and cloning.
In this scenario, I suggest using compact_str instead of String. CompactString from compact_str is a mutable string, but it has a great feature: when the string is less than 24 bytes (which I believe should cover most cases), it will be stored on the stack. This is more efficient than performing operations on the heap during initialization or cloning.
Similarly, some field of Match and Context can also be modified.
Considering that there are numerous String clones in the code, I think using compact_str instead could bring a noticeable improvement in efficiency.
The text was updated successfully, but these errors were encountered:
It seems that in most cases, the
Schema
's field are not very long. The atc-router sets it as String, which allocates memory on the heap during each initialization and cloning.In this scenario, I suggest using
compact_str
instead ofString
.CompactString
fromcompact_str
is a mutable string, but it has a great feature: when the string is less than 24 bytes (which I believe should cover most cases), it will be stored on the stack. This is more efficient than performing operations on the heap during initialization or cloning.Similarly, some field of
Match
andContext
can also be modified.Considering that there are numerous
String
clones in the code, I think usingcompact_str
instead could bring a noticeable improvement in efficiency.The text was updated successfully, but these errors were encountered: