Skip to content

Commit 9faefac

Browse files
committed
add performance labels to todos
1 parent a742d97 commit 9faefac

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

c-dependencies/js-compute-runtime/js-compute-builtins.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ using jsurl::SpecSlice, jsurl::SpecString, jsurl::JSUrl, jsurl::JSUrlSearchParam
116116
static JS::PersistentRootedObjectVector *pending_requests;
117117
static JS::PersistentRootedObjectVector *pending_body_reads;
118118

119-
// TODO: introduce a version that writes into an existing buffer, and use that
119+
// TODO(performance): introduce a version that writes into an existing buffer, and use that
120120
// with the hostcall buffer where possible.
121121
UniqueChars encode(JSContext *cx, HandleString str, size_t *encoded_len) {
122122
UniqueChars text = JS_EncodeStringToUTF8(cx, str);
@@ -190,10 +190,10 @@ JSObject *PromiseRejectedWithPendingError(JSContext *cx) {
190190
template <auto op, class HandleType>
191191
static char *read_from_handle_all(JSContext *cx, HandleType handle, size_t *nwritten,
192192
bool read_until_zero) {
193-
// TODO: investigate passing a size hint in situations where we might know
193+
// TODO(performance): investigate passing a size hint in situations where we might know
194194
// the final size, e.g. via the `content-length` header.
195195
size_t buf_size = HANDLE_READ_CHUNK_SIZE;
196-
// TODO: make use of malloc slack.
196+
// TODO(performance): make use of malloc slack.
197197
char *buf = static_cast<char *>(JS_malloc(cx, buf_size));
198198
if (!buf) {
199199
JS_ReportOutOfMemory(cx);
@@ -217,7 +217,7 @@ static char *read_from_handle_all(JSContext *cx, HandleType handle, size_t *nwri
217217
break;
218218
}
219219

220-
// TODO: make use of malloc slack, and use a smarter buffer growth strategy.
220+
// TODO(performance): make use of malloc slack, and use a smarter buffer growth strategy.
221221
size_t new_size = buf_size + HANDLE_READ_CHUNK_SIZE;
222222
new_buf = static_cast<char *>(JS_realloc(cx, buf, buf_size, new_size));
223223
if (!new_buf) {
@@ -965,7 +965,7 @@ bool bodyAll(JSContext *cx, CallArgs args, HandleObject self) {
965965

966966
// If the body is a ReadableStream that's not backed by a BodyHandle,
967967
// we need to manually read all chunks from the stream.
968-
// TODO: ensure that we're properly shortcutting reads from TransformStream
968+
// TODO(performance): ensure that we're properly shortcutting reads from TransformStream
969969
// readables.
970970
RootedObject stream(cx, body_stream(self));
971971
if (stream && !NativeStreamSource::stream_is_body(cx, stream)) {
@@ -2365,12 +2365,12 @@ bool constructor(JSContext *cx, unsigned argc, Value *vp) {
23652365
// be consumed by the content creating it, so we're lenient about its format.
23662366

23672367
// 3. Set `this`’s `response` to a new `response`.
2368-
// TODO: consider not creating a host-side representation for responses
2368+
// TODO(performance): consider not creating a host-side representation for responses
23692369
// eagerly. Some applications create Response objects purely for internal use,
23702370
// e.g. to represent cache entries. While that's perhaps not ideal to begin
23712371
// with, it exists, so we should handle it in a good way, and not be
23722372
// superfluously slow.
2373-
// TODO: enable creating Response objects during the init phase, and only
2373+
// TODO(performance): enable creating Response objects during the init phase, and only
23742374
// creating the host-side representation when processing requests.
23752375
ResponseHandle response_handle = {.handle = INVALID_HANDLE};
23762376
if (!HANDLE_RESULT(cx, xqd_resp_new(&response_handle))) {
@@ -3319,7 +3319,7 @@ bool append(JSContext *cx, unsigned argc, Value *vp) {
33193319
* doesn't already contain a header with that name.
33203320
*
33213321
* Assumes that both the name and value are valid and normalized.
3322-
* TODO: fully skip normalization.
3322+
* TODO(performance): fully skip normalization.
33233323
*/
33243324
bool maybe_add(JSContext *cx, HandleObject self, const char *name, const char *value) {
33253325
MOZ_ASSERT(is_instance(self));

0 commit comments

Comments
 (0)