Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Remove SlabAllocator #5720

Merged
merged 3 commits into from Jul 3, 2013
Merged

Remove SlabAllocator #5720

merged 3 commits into from Jul 3, 2013

Conversation

trevnorris
Copy link

Removing the SlabAllocator will allow for more aggressive performance enhancements.

EDIT: I have removed a couple commits from the set that weren't directly related. While this does introduce a small performance regression for requests of small packet size, it seems make bench is exasperating that discrepancy. If the benchmarks are run by hand (running benchmark/http_simple.js and pointing wrk to the appropriate url) the performance difference is easily below 5%. And this is only for small (i.e. <= 1024 bytes) requests. This patch is a launchpad to several other changes. Some of which include:

  • Allowing the character encoding to propagate down to StreamWrap to remove any redundant object creation.
  • Give more flexibility to StreamWrapCallbacks::DoRead callbacks so objects (either buffers or external string resources) don't need to duplicate memory before being used.
  • Use those custom callbacks to internally buffer key items, such as HTTP requests. This is advantageous because we'd drop the step of creating a buffer then passing it back to http_parser. Instead we accumulate until all headers have been received.
  • Easily create data "pass along" (I'm sure there's a more correct term for this). Like a pipe, except after pointing the source to the destination in your script the data itself never needs to reach the js level.

@trevnorris trevnorris closed this Jun 21, 2013
@trevnorris
Copy link
Author

sometimes I hate you github!

@trevnorris trevnorris reopened this Jun 21, 2013
@trevnorris
Copy link
Author

The pr summary has been updated to reflect current changes. imo I'd like just these changes merged first. Mainly because there's no finish line of performance improvements it offers (as outlined in the summary above) and I don't want to go through another massive buffer-type pr scenario again. :)

/cc @isaacs @bnoordhuis

char* data = static_cast<char*>(malloc(suggested_size));
if (data == NULL && suggested_size > 0)
FatalError("node::UDPWrap::OnAlloc(uv_handle_t*, size_t)",
"Out Of Memory");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer braces around statement when it's spread over multiple lines.

Now that Buffer instantiation has improved, the SlabAllocator is an
unnecessary layer of complexity preventing further performance
optimizations.

Currently there is a small performance loss with very small stream
requests, but this will soon be addressed.
To use realloc the implementation had to be changed to use malloc/free.
The function arguments offset and length are now no longer used since
all I/O requests now use discretely allocated memory.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants