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
This is run on every request. It means, that the last condition, here method === 'LOCK' is the slowest, as we have to check first 7 other values, before we potentially hit LOCK.
We should implement some simple and understandable b-tree, which only returns true if the element is in the tree and false if not.
Maybe there are other places we can use it.
Maybe using a Map is sufficient? But I think a b-tree would be faster.
Example
const MethodWithBody = new Tree()
MethodWithBody.insert('POST')
MethodWithBody.insert('PATCH')
MethodWithBody.insert('PUT')
MethodWithBody.insert('PROPFIND')
if (MethodWithBody.has(method)) {
}
The text was updated successfully, but these errors were encountered:
I dont think that Set is optimized for this case, as Set also handles Objects and numbers etc.. So Set must have some code to check if the type is the same and stuff like that. I have the feeling that a b-tree will be significantly faster.
Linear search is very often more efficient than Binary search when the number of items is tiny. I would be very surprised if implementing a binary search for this use case would be faster (regardless Big-O notation).
Prerequisites
馃殌 Feature Proposal
Implement a B-Tree Class
Motivation
Lets see following lines
fastify/lib/handleRequest.js
Line 30 in 8d66924
This is run on every request. It means, that the last condition, here
method === 'LOCK'
is the slowest, as we have to check first 7 other values, before we potentially hit LOCK.We should implement some simple and understandable b-tree, which only returns true if the element is in the tree and false if not.
Maybe there are other places we can use it.
Maybe using a Map is sufficient? But I think a b-tree would be faster.
Example
The text was updated successfully, but these errors were encountered: