Skip to content

[Bug]: Slowness in module initialisation phase when running Ballerina programs #43727

Open
@NipunaRanasinghe

Description

@NipunaRanasinghe

Description

Even though a very basic Ballerina programs (without any imports) have a good enough startup times, when the programs get larger with multiple imports, the startup time gets significantly high (4-5 seconds in average), mainly due a slowness observed in module initialization phase in Ballerina runtime.

This specifically affects the user experience in fast-run mode, where the compilation time is negligible (as we use compilation cache from the LS). Therefore the module initialization delay becomes more prominent than the compilation time, making it the main bottleneck.

Steps to Reproduce

Below is a simple Ballerina code snippet to reproduce the issue.

import ballerina/io;
import ballerina/http as _;
import ballerina/graphql as _;

public function main() {
    io:println("Hello World");
}

Execute the bal run command and observe the delay during the execution of the main function. The slowness is noticeable in the Running executables... phase after the compilation is complete.

Affected Version(s)

2201.11.0 and below

OS, DB, other environment details and versions

No response

Related area

-> Runtime

Related issue(s) (optional)

No response

Suggested label(s) (optional)

No response

Suggested assignee(s) (optional)

No response

Metadata

Metadata

Labels

Team/jBallerinaAll the issues related to BIR, JVM backend code generation and runtimeType/Bug

Type

No type

Projects

Status

In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions