Skip to content

Commit 417a0f4

Browse files
committed
introduce more optimizations
1 parent 4bb08e1 commit 417a0f4

File tree

8 files changed

+81
-42
lines changed

8 files changed

+81
-42
lines changed

src/workerd/api/BUILD.bazel

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,8 @@ wd_cc_library(
394394
implementation_deps = [
395395
"//src/workerd/io",
396396
"//src/workerd/util:strings",
397+
"@capnp-cpp//src/kj/compat:kj-gzip",
398+
"@capnp-cpp//src/kj/compat:kj-tls",
397399
],
398400
visibility = ["//visibility:public"],
399401
deps = [
@@ -402,9 +404,7 @@ wd_cc_library(
402404
"//src/workerd/io:compatibility-date_capnp",
403405
"//src/workerd/jsg",
404406
"@capnp-cpp//src/kj:kj-async",
405-
"@capnp-cpp//src/kj/compat:kj-gzip",
406407
"@capnp-cpp//src/kj/compat:kj-http",
407-
"@capnp-cpp//src/kj/compat:kj-tls",
408408
],
409409
)
410410

@@ -529,13 +529,27 @@ wd_cc_library(
529529
for f in [
530530
"actor-state-test.c++",
531531
"basics-test.c++",
532-
"crypto/aes-test.c++",
533-
"crypto/impl-test.c++",
534532
"streams/queue-test.c++",
535533
"streams/standard-test.c++",
536534
]
537535
]
538536

537+
[
538+
kj_test(
539+
src = f,
540+
deps = [
541+
"//src/workerd/io",
542+
"//src/workerd/io:promise-wrapper",
543+
"@ncrypto",
544+
"@ssl",
545+
],
546+
)
547+
for f in [
548+
"crypto/aes-test.c++",
549+
"crypto/impl-test.c++",
550+
]
551+
]
552+
539553
kj_test(
540554
src = "data-url-test.c++",
541555
deps = [
@@ -592,12 +606,16 @@ kj_test(
592606
":urlpattern-standard",
593607
"//src/workerd/io",
594608
"//src/workerd/jsg:rtti",
609+
"@ssl",
595610
],
596611
)
597612

598613
kj_test(
599614
src = "base64-test.c++",
600-
deps = ["//src/workerd/tests:test-fixture"],
615+
deps = [
616+
":base64",
617+
"//src/workerd/tests:test-fixture",
618+
],
601619
)
602620

603621
kj_test(
@@ -619,6 +637,7 @@ kj_test(
619637
"//src/workerd/io",
620638
"//src/workerd/jsg",
621639
"//src/workerd/tests:test-fixture",
640+
"@capnp-cpp//src/kj/compat:kj-gzip",
622641
],
623642
)
624643

src/workerd/io/BUILD.bazel

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ wd_cc_library(
2121
visibility = ["//visibility:public"],
2222
deps = [
2323
"//src/workerd/jsg",
24-
"@capnp-cpp//src/capnp/compat:http-over-capnp",
24+
"@capnp-cpp//src/kj/compat:kj-http",
2525
],
2626
)
2727

@@ -70,26 +70,30 @@ wd_cc_library(
7070
],
7171
}),
7272
implementation_deps = [
73+
":cdp_capnp",
7374
"//src/workerd/api:crypto-crc-impl",
7475
"//src/workerd/api:data-url",
7576
"//src/workerd/api/node:exceptions",
7677
"//src/workerd/util:completion-membrane",
7778
"//src/workerd/util:entropy",
79+
"//src/workerd/util:header-validation",
80+
"//src/workerd/util:immediate-crash",
7881
"//src/workerd/util:perfetto",
7982
"//src/workerd/util:string-buffer",
8083
"//src/workerd/util:strings",
8184
"//src/workerd/util:uuid",
8285
"@capnp-cpp//src/kj/compat:kj-brotli",
8386
"@capnp-cpp//src/kj/compat:kj-gzip",
8487
"@nbytes",
88+
"@ncrypto",
8589
"@simdutf",
90+
"@ssl",
8691
],
8792
visibility = ["//visibility:public"],
8893
deps = [
8994
":actor",
9095
":actor-id",
9196
":actor-storage_capnp",
92-
":cdp_capnp",
9397
":container_capnp",
9498
":features",
9599
":frankenvalue",
@@ -113,8 +117,6 @@ wd_cc_library(
113117
"//src/workerd/jsg:script",
114118
"//src/workerd/util:checked-queue",
115119
"//src/workerd/util:exception",
116-
"//src/workerd/util:header-validation",
117-
"//src/workerd/util:immediate-crash",
118120
"//src/workerd/util:ring-buffer",
119121
"//src/workerd/util:small-set",
120122
"//src/workerd/util:sqlite",
@@ -123,8 +125,6 @@ wd_cc_library(
123125
"@capnp-cpp//src/capnp:capnp-rpc",
124126
"@capnp-cpp//src/capnp/compat:http-over-capnp",
125127
"@capnp-cpp//src/kj:kj-async",
126-
"@ncrypto",
127-
"@ssl",
128128
],
129129
)
130130

@@ -311,16 +311,17 @@ wd_cc_library(
311311
srcs = ["worker-interface.c++"],
312312
hdrs = ["worker-interface.h"],
313313
implementation_deps = [
314+
"//src/workerd/util",
314315
"@capnp-cpp//src/capnp:capnpc",
316+
"@capnp-cpp//src/capnp/compat:http-over-capnp",
315317
],
316318
visibility = ["//visibility:public"],
317319
deps = [
318320
":frankenvalue_capnp",
319321
":trace",
320322
":worker-interface_capnp",
321-
"//src/workerd/util",
322323
"@capnp-cpp//src/capnp:capnp-rpc",
323-
"@capnp-cpp//src/capnp/compat:http-over-capnp",
324+
"@capnp-cpp//src/kj/compat:kj-http",
324325
],
325326
)
326327

src/workerd/io/io-thread-context.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
#pragma once
22

3-
#include <capnp/compat/http-over-capnp.h>
43
#include <kj/compat/http.h>
54

5+
namespace capnp {
6+
class HttpOverCapnpFactory;
7+
class ByteStreamFactory;
8+
} // namespace capnp
9+
610
namespace workerd {
711

812
// Thread-level stuff needed to construct a IoContext. One of these is created for each

src/workerd/io/worker-interface.c++

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
#include <workerd/util/http-util.h>
88

9+
#include <capnp/compat/http-over-capnp.h>
910
#include <kj/debug.h>
1011

1112
using kj::byte;

src/workerd/io/worker-interface.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,15 @@
77
#include <workerd/io/outcome.capnp.h>
88
#include <workerd/io/trace.h>
99
#include <workerd/io/worker-interface.capnp.h>
10-
#include <workerd/util/http-util.h>
1110

12-
#include <capnp/compat/http-over-capnp.h>
1311
#include <kj/compat/http.h>
1412
#include <kj/debug.h>
1513

14+
namespace capnp {
15+
class HttpOverCapnpFactory;
16+
class ByteStreamFactory;
17+
} // namespace capnp
18+
1619
namespace workerd {
1720

1821
class Frankenvalue;

src/workerd/server/BUILD.bazel

Lines changed: 35 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,14 @@ wd_cc_binary(
6666
":json-logger",
6767
":server",
6868
":v8-platform-impl",
69+
":workerd-api",
6970
":workerd-capnp-schema",
7071
":workerd_capnp",
7172
"//src/pyodide:pyodide_extra_capnp",
7273
"//src/rust/cxx-integration",
74+
"//src/workerd/jsg",
7375
"//src/workerd/util:autogate",
76+
"//src/workerd/util:entropy",
7477
"//src/workerd/util:perfetto",
7578
"@capnp-cpp//src/capnp:capnpc",
7679
],
@@ -121,15 +124,17 @@ wd_cc_library(
121124
hdrs = [
122125
"pyodide.h",
123126
],
127+
implementation_deps = [
128+
"@capnp-cpp//src/kj/compat:kj-gzip",
129+
"@capnp-cpp//src/kj/compat:kj-tls",
130+
],
124131
visibility = ["//visibility:public"],
125132
deps = [
126133
"//src/workerd/api:pyodide",
127134
"//src/workerd/io:compatibility-date_capnp",
128135
"//src/workerd/jsg",
129136
"@capnp-cpp//src/kj",
130137
"@capnp-cpp//src/kj:kj-async",
131-
"@capnp-cpp//src/kj/compat:kj-gzip",
132-
"@capnp-cpp//src/kj/compat:kj-tls",
133138
],
134139
)
135140

@@ -156,41 +161,41 @@ wd_cc_library(
156161
"workerd-api.h",
157162
],
158163
implementation_deps = [
159-
"//src/workerd/api:analytics-engine",
160-
"//src/workerd/api:capnp",
161-
"//src/workerd/api:kv",
162-
"//src/workerd/api:streams",
163-
"//src/workerd/api:urlpattern",
164-
"//src/workerd/api:urlpattern-standard",
165-
"//src/workerd/api:worker-loader",
166-
"//src/workerd/io:promise-wrapper",
167-
],
168-
visibility = ["//visibility:public"],
169-
deps = [
170164
":actor-id-impl",
171165
":fallback-service",
172-
":pyodide",
173166
":workerd-debug-port-client",
174-
":workerd_capnp",
175167
"//src/cloudflare",
176168
"//src/node",
177169
"//src/pyodide:pyodide_static",
178170
"//src/pyodide:python-entrypoint",
179171
"//src/rust/transpiler",
172+
"//src/workerd/api:analytics-engine",
173+
"//src/workerd/api:capnp",
180174
"//src/workerd/api:html-rewriter",
181175
"//src/workerd/api:hyperdrive",
182-
"//src/workerd/api:memory-cache",
183-
"//src/workerd/api:pyodide",
176+
"//src/workerd/api:kv",
184177
"//src/workerd/api:r2",
185178
"//src/workerd/api:rtti",
179+
"//src/workerd/api:streams",
180+
"//src/workerd/api:urlpattern",
181+
"//src/workerd/api:urlpattern-standard",
182+
"//src/workerd/api:worker-loader",
186183
"//src/workerd/api/node",
187-
"//src/workerd/io",
184+
"//src/workerd/io:promise-wrapper",
188185
"//src/workerd/io:worker-modules",
189-
"//src/workerd/jsg",
190186
"//src/workerd/util:perfetto",
191187
"@capnp-cpp//src/kj/compat:kj-gzip",
192188
"@capnp-cpp//src/kj/compat:kj-tls",
193189
],
190+
visibility = ["//visibility:public"],
191+
deps = [
192+
":pyodide",
193+
":workerd_capnp",
194+
"//src/workerd/api:memory-cache",
195+
"//src/workerd/api:pyodide",
196+
"//src/workerd/io",
197+
"//src/workerd/jsg",
198+
],
194199
)
195200

196201
wd_cc_library(
@@ -203,29 +208,33 @@ wd_cc_library(
203208
"channel-token.h",
204209
"server.h",
205210
],
206-
deps = [
211+
implementation_deps = [
207212
":actor-id-impl",
208-
":alarm-scheduler",
209-
":channel-token_capnp",
210213
":container-client",
211214
":facet-tree-index",
212215
":fallback-service",
213216
":workerd-api",
214-
":workerd_capnp",
215217
"//src/cloudflare",
216218
"//src/node",
217219
"//src/pyodide:pyodide_static",
218-
"//src/workerd/api:memory-cache",
219-
"//src/workerd/api:pyodide",
220-
"//src/workerd/io",
221220
"//src/workerd/io:bundle-fs",
222221
"//src/workerd/io:worker-entrypoint",
223222
"//src/workerd/jsg",
223+
"//src/workerd/util:mimetype",
224224
"//src/workerd/util:perfetto",
225+
"//src/workerd/util:uuid",
225226
"//src/workerd/util:websocket-error-handler",
226227
"@capnp-cpp//src/kj/compat:kj-gzip",
227228
"@capnp-cpp//src/kj/compat:kj-tls",
228229
],
230+
deps = [
231+
":alarm-scheduler",
232+
":channel-token_capnp",
233+
":workerd_capnp",
234+
"//src/workerd/api:memory-cache",
235+
"//src/workerd/api:pyodide",
236+
"//src/workerd/io",
237+
],
229238
)
230239

231240
wd_capnp_library(src = "docker-api.capnp")

src/workerd/server/server.c++

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#include <openssl/bio.h>
4141
#include <openssl/pem.h>
4242

43+
#include <capnp/compat/http-over-capnp.h>
4344
#include <capnp/compat/json.h>
4445
#include <capnp/message.h>
4546
#include <capnp/rpc-twoparty.h>

src/workerd/tests/test-fixture.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <workerd/jsg/jsg.h>
1111
#include <workerd/server/workerd.capnp.h>
1212

13+
#include <capnp/compat/http-over-capnp.h>
1314
#include <capnp/message.h>
1415
#include <kj/function.h>
1516
#include <kj/test.h>

0 commit comments

Comments
 (0)