Skip to content

Commit fb5f55e

Browse files
committed
chore: fix bench
1 parent b19e4e1 commit fb5f55e

File tree

2 files changed

+52
-52
lines changed

2 files changed

+52
-52
lines changed

test/bench/bench.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ const capnpTSBench = {
4747
parse: () =>
4848
new capnpTS.Message(capnpData, false, true).getRoot(capnpTSStruct),
4949
length: () =>
50-
(
51-
new capnpTS.Message(capnpData, false, true).getRoot(capnpTSStruct) as any
52-
).getPeople().length,
50+
(new capnpTS.Message(capnpData, false, true).getRoot(capnpTSStruct) as any)
51+
.getPeople()
52+
.getLength(),
5353
traverse: () =>
5454
serializeData(
5555
new capnpTS.Message(capnpData, false, true).getRoot(capnpTSStruct),

test/bench/data/capnp/schema-legacy.cjs

+49-49
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,22 @@ const capnp_ts_1 = require("capnp-ts");
1717
exports._capnpFileId = BigInt("0xb597bf4897e54f89");
1818
class AddressBook extends capnp_ts_1.Struct {
1919
adoptPeople(value) {
20-
capnp_ts_1.utils.adopt(value, capnp_ts_1.utils.getPointer(0, this));
20+
capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(0, this));
2121
}
2222
disownPeople() {
23-
return capnp_ts_1.utils.disown(this.getPeople());
23+
return capnp_ts_1.Struct.disown(this.getPeople());
2424
}
2525
getPeople() {
26-
return capnp_ts_1.utils.getList(0, AddressBook._People, this);
26+
return capnp_ts_1.Struct.getList(0, AddressBook._People, this);
2727
}
2828
hasPeople() {
29-
return !capnp_ts_1.utils.isNull(capnp_ts_1.utils.getPointer(0, this));
29+
return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(0, this));
3030
}
3131
initPeople(length) {
32-
return capnp_ts_1.utils.initList(0, AddressBook._People, length, this);
32+
return capnp_ts_1.Struct.initList(0, AddressBook._People, length, this);
3333
}
3434
setPeople(value) {
35-
capnp_ts_1.utils.copyFrom(value, capnp_ts_1.utils.getPointer(0, this));
35+
capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(0, this));
3636
}
3737
toString() {
3838
return "AddressBook_" + super.toString();
@@ -55,16 +55,16 @@ var Person_PhoneNumber_Type;
5555
);
5656
class Person_PhoneNumber extends capnp_ts_1.Struct {
5757
getNumber() {
58-
return capnp_ts_1.utils.getText(0, this);
58+
return capnp_ts_1.Struct.getText(0, this);
5959
}
6060
setNumber(value) {
61-
capnp_ts_1.utils.setText(0, value, this);
61+
capnp_ts_1.Struct.setText(0, value, this);
6262
}
6363
getType() {
64-
return capnp_ts_1.utils.getUint16(0, this);
64+
return capnp_ts_1.Struct.getUint16(0, this);
6565
}
6666
setType(value) {
67-
capnp_ts_1.utils.setUint16(0, value, this);
67+
capnp_ts_1.Struct.setUint16(0, value, this);
6868
}
6969
toString() {
7070
return "Person_PhoneNumber_" + super.toString();
@@ -92,74 +92,74 @@ var Person_Employment_Which;
9292
);
9393
class Person_Employment extends capnp_ts_1.Struct {
9494
getEmployer() {
95-
capnp_ts_1.utils.testWhich(
95+
capnp_ts_1.Struct.testWhich(
9696
"employer",
97-
capnp_ts_1.utils.getUint16(6, this),
97+
capnp_ts_1.Struct.getUint16(6, this),
9898
1,
9999
this,
100100
);
101-
return capnp_ts_1.utils.getText(3, this);
101+
return capnp_ts_1.Struct.getText(3, this);
102102
}
103103
isEmployer() {
104-
return capnp_ts_1.utils.getUint16(6, this) === 1;
104+
return capnp_ts_1.Struct.getUint16(6, this) === 1;
105105
}
106106
setEmployer(value) {
107-
capnp_ts_1.utils.setUint16(6, 1, this);
108-
capnp_ts_1.utils.setText(3, value, this);
107+
capnp_ts_1.Struct.setUint16(6, 1, this);
108+
capnp_ts_1.Struct.setText(3, value, this);
109109
}
110110
getSchool() {
111-
capnp_ts_1.utils.testWhich(
111+
capnp_ts_1.Struct.testWhich(
112112
"school",
113-
capnp_ts_1.utils.getUint16(6, this),
113+
capnp_ts_1.Struct.getUint16(6, this),
114114
2,
115115
this,
116116
);
117-
return capnp_ts_1.utils.getText(3, this);
117+
return capnp_ts_1.Struct.getText(3, this);
118118
}
119119
isSchool() {
120-
return capnp_ts_1.utils.getUint16(6, this) === 2;
120+
return capnp_ts_1.Struct.getUint16(6, this) === 2;
121121
}
122122
setSchool(value) {
123-
capnp_ts_1.utils.setUint16(6, 2, this);
124-
capnp_ts_1.utils.setText(3, value, this);
123+
capnp_ts_1.Struct.setUint16(6, 2, this);
124+
capnp_ts_1.Struct.setText(3, value, this);
125125
}
126126
getUnemployed() {
127-
capnp_ts_1.utils.testWhich(
127+
capnp_ts_1.Struct.testWhich(
128128
"unemployed",
129-
capnp_ts_1.utils.getUint16(6, this),
129+
capnp_ts_1.Struct.getUint16(6, this),
130130
0,
131131
this,
132132
);
133-
return capnp_ts_1.utils.getBit(32, this);
133+
return capnp_ts_1.Struct.getBit(32, this);
134134
}
135135
isUnemployed() {
136-
return capnp_ts_1.utils.getUint16(6, this) === 0;
136+
return capnp_ts_1.Struct.getUint16(6, this) === 0;
137137
}
138138
setUnemployed(value) {
139-
capnp_ts_1.utils.setUint16(6, 0, this);
140-
capnp_ts_1.utils.setBit(32, value, this);
139+
capnp_ts_1.Struct.setUint16(6, 0, this);
140+
capnp_ts_1.Struct.setBit(32, value, this);
141141
}
142142
getSelfEmployed() {
143-
capnp_ts_1.utils.testWhich(
143+
capnp_ts_1.Struct.testWhich(
144144
"selfEmployed",
145-
capnp_ts_1.utils.getUint16(6, this),
145+
capnp_ts_1.Struct.getUint16(6, this),
146146
3,
147147
this,
148148
);
149-
return capnp_ts_1.utils.getBit(32, this);
149+
return capnp_ts_1.Struct.getBit(32, this);
150150
}
151151
isSelfEmployed() {
152-
return capnp_ts_1.utils.getUint16(6, this) === 3;
152+
return capnp_ts_1.Struct.getUint16(6, this) === 3;
153153
}
154154
setSelfEmployed(value) {
155-
capnp_ts_1.utils.setUint16(6, 3, this);
156-
capnp_ts_1.utils.setBit(32, value, this);
155+
capnp_ts_1.Struct.setUint16(6, 3, this);
156+
capnp_ts_1.Struct.setBit(32, value, this);
157157
}
158158
toString() {
159159
return "Person_Employment_" + super.toString();
160160
}
161161
which() {
162-
return capnp_ts_1.utils.getUint16(6, this);
162+
return capnp_ts_1.Struct.getUint16(6, this);
163163
}
164164
}
165165
exports.Person_Employment = Person_Employment;
@@ -174,46 +174,46 @@ Person_Employment._capnp = {
174174
};
175175
class Person extends capnp_ts_1.Struct {
176176
getId() {
177-
return capnp_ts_1.utils.getUint32(0, this);
177+
return capnp_ts_1.Struct.getUint32(0, this);
178178
}
179179
setId(value) {
180-
capnp_ts_1.utils.setUint32(0, value, this);
180+
capnp_ts_1.Struct.setUint32(0, value, this);
181181
}
182182
getName() {
183-
return capnp_ts_1.utils.getText(0, this);
183+
return capnp_ts_1.Struct.getText(0, this);
184184
}
185185
setName(value) {
186-
capnp_ts_1.utils.setText(0, value, this);
186+
capnp_ts_1.Struct.setText(0, value, this);
187187
}
188188
getEmail() {
189-
return capnp_ts_1.utils.getText(1, this);
189+
return capnp_ts_1.Struct.getText(1, this);
190190
}
191191
setEmail(value) {
192-
capnp_ts_1.utils.setText(1, value, this);
192+
capnp_ts_1.Struct.setText(1, value, this);
193193
}
194194
adoptPhones(value) {
195-
capnp_ts_1.utils.adopt(value, capnp_ts_1.utils.getPointer(2, this));
195+
capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(2, this));
196196
}
197197
disownPhones() {
198-
return capnp_ts_1.utils.disown(this.getPhones());
198+
return capnp_ts_1.Struct.disown(this.getPhones());
199199
}
200200
getPhones() {
201-
return capnp_ts_1.utils.getList(2, Person._Phones, this);
201+
return capnp_ts_1.Struct.getList(2, Person._Phones, this);
202202
}
203203
hasPhones() {
204-
return !capnp_ts_1.utils.isNull(capnp_ts_1.utils.getPointer(2, this));
204+
return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(2, this));
205205
}
206206
initPhones(length) {
207-
return capnp_ts_1.utils.initList(2, Person._Phones, length, this);
207+
return capnp_ts_1.Struct.initList(2, Person._Phones, length, this);
208208
}
209209
setPhones(value) {
210-
capnp_ts_1.utils.copyFrom(value, capnp_ts_1.utils.getPointer(2, this));
210+
capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(2, this));
211211
}
212212
getEmployment() {
213-
return capnp_ts_1.utils.getAs(Person_Employment, this);
213+
return capnp_ts_1.Struct.getAs(Person_Employment, this);
214214
}
215215
initEmployment() {
216-
return capnp_ts_1.utils.getAs(Person_Employment, this);
216+
return capnp_ts_1.Struct.getAs(Person_Employment, this);
217217
}
218218
toString() {
219219
return "Person_" + super.toString();

0 commit comments

Comments
 (0)