Skip to content

Commit 5b92247

Browse files
committed
fix(go): true speed of benchmark
1 parent e47df65 commit 5b92247

File tree

10 files changed

+18
-30
lines changed

10 files changed

+18
-30
lines changed

.github/ISSUE_TEMPLATE/Bug_report.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ body:
4343
id: client
4444
attributes:
4545
label: Client
46-
description: Which API are you targetting?
46+
description: Which API are you targeting?
4747
options:
4848
- All
4949
- AB testing

config/clients.config.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,6 @@
168168
"packageVersion": "5.5.2",
169169
"modelFolder": "model",
170170
"apiFolder": "src",
171-
"dockerImage": "apic_base",
172171
"tests": {
173172
"extension": ".test.ts",
174173
"outputFolder": "src"

scripts/buildClients.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ async function buildLanguage(language: Language, gens: Generator[], buildType: B
2525
await run('go build ./...', { cwd, language });
2626
break;
2727
case 'javascript':
28-
await run('YARN_ENABLE_IMMUTABLE_INSTALLS=false yarn install', { cwd });
28+
await run('YARN_ENABLE_IMMUTABLE_INSTALLS=false yarn install', { cwd, language });
2929
if (buildType === 'client') {
3030
const packageNames = gens.map(({ additionalProperties: { packageName } }) =>
3131
packageName === 'algoliasearch' ? packageName : `@algolia/${packageName}`,
3232
);
33-
await run(`yarn build:many '{${packageNames.join(',')},}'`, { cwd });
33+
await run(`yarn build:many '{${packageNames.join(',')},}'`, { cwd, language });
3434
}
3535

3636
break;

scripts/cts/runCts.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,13 @@ async function runCtsOne(language: Language, suites: Record<CTSType, boolean>):
5757
});
5858
break;
5959
case 'go':
60-
await run(`go test -race -count 1 ${isVerbose() ? '-v' : ''} ${filter((f) => `gotests/tests/${f}/...`)}`, {
61-
cwd,
62-
language,
63-
});
60+
await run(
61+
`go test ${suites.benchmark ? '' : '-race'} -count 1 ${isVerbose() ? '-v' : ''} ${filter((f) => `gotests/tests/${f}/...`)}`,
62+
{
63+
cwd,
64+
language,
65+
},
66+
);
6467
break;
6568
case 'java':
6669
await run(`./gradle/gradlew -p tests/output/java test --rerun ${filter((f) => `--tests 'com.algolia.${f}*'`)}`, {
@@ -70,6 +73,7 @@ async function runCtsOne(language: Language, suites: Record<CTSType, boolean>):
7073
case 'javascript':
7174
await run(`YARN_ENABLE_IMMUTABLE_INSTALLS=false yarn install && yarn test ${filter((f) => `src/${f}`)}`, {
7275
cwd,
76+
language,
7377
});
7478
break;
7579
case 'kotlin':

scripts/cts/testServer/benchmark.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@ export function printBenchmarkReport(): void {
2222
const times: Array<{ lang: string; rate: number }> = [];
2323
for (const lang of Object.keys(benchmarkStatus)) {
2424
const status = benchmarkStatus[lang];
25-
expect(status.requestTimes).to.have.length(1000);
26-
const rate = 1000000 / (status.requestTimes.at(-1)! - status.requestTimes[0]);
25+
expect(status.requestTimes).to.have.length(2000);
26+
status.requestTimes.sort((a, b) => a - b);
27+
const rate = (status.requestTimes.length * 1000) / (status.requestTimes.at(-1)! - status.requestTimes[0]);
2728
times.push({ lang, rate });
2829
}
2930

scripts/formatter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export async function formatter(language: string, cwd: string): Promise<void> {
3737
);
3838
break;
3939
case 'javascript':
40-
await run(`yarn eslint --ext=ts,json ${cwd} --fix --no-error-on-unmatched-pattern`);
40+
await run(`yarn eslint --ext=ts,json ${cwd} --fix --no-error-on-unmatched-pattern`, { language });
4141
break;
4242
case 'kotlin':
4343
await run(`./gradle/gradlew -p ${cwd} spotlessApply`, { language });

scripts/playground.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export async function playground({ language, client }: { language: AllLanguage;
1313
});
1414
break;
1515
case 'javascript':
16-
await run(`yarn workspace javascript-playground start ${client}`);
16+
await run(`yarn workspace javascript-playground start ${client}`, { language });
1717
break;
1818
case 'java':
1919
await run(

templates/Bug_report.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ body:
2727
id: client
2828
attributes:
2929
label: Client
30-
description: Which API are you targetting?
30+
description: Which API are you targeting?
3131
options:
3232
- All
3333
- AB testing

templates/go/tests/client/benchmark.mustache

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,6 @@ import (
1414
"github.com/algolia/algoliasearch-client-go/v4/algolia/call"
1515
)
1616

17-
func create{{#lambda.titlecase}}{{clientPrefix}}{{/lambda.titlecase}}Client(t *testing.T) (*{{clientPrefix}}.APIClient, *tests.EchoRequester) {
18-
echo := &tests.EchoRequester{}
19-
cfg := {{clientPrefix}}.{{clientName}}Configuration{
20-
Configuration: transport.Configuration{
21-
AppID: "appID",
22-
ApiKey: "apiKey",
23-
Requester: echo,
24-
},{{#hasRegionalHost}}
25-
Region: {{clientPrefix}}.{{#lambda.uppercase}}{{defaultRegion}}{{/lambda.uppercase}},{{/hasRegionalHost}}
26-
}
27-
client, err := {{clientPrefix}}.NewClientWithConfig(cfg)
28-
require.NoError(t, err)
29-
30-
return client, echo
31-
}
32-
3317
{{#blocksBenchmark}}
3418
{{> tests/client/tests}}
3519
{{/blocksBenchmark}}

tests/CTS/benchmark/search/benchmark.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
{
2020
"type": "method",
2121
"method": "search",
22-
"times": 1000,
22+
"times": 2000,
2323
"parameters": {
2424
"requests": [
2525
{

0 commit comments

Comments
 (0)