antlr / antlr/antlr4

Performance Issues Running Cpp Runtime on Many Threads

Open
#3,938 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
19k
Forks
3.5k
PR merge metrics
No merged PRs in 30d

Description

When I use the Cpp parser in multiple threads (around 30+), the performance drops a lot compared to using a single thread.

I'm guessing it's the lock/mutex, so I simply removed all locks and re-tested, and it did run a lot faster.

But removing locks makes the parser no longer thread-safe, I would like to ask is there any way to improve the performance of multi-threaded parser?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by constructing the smallest C++ parser workload that reproduces the reported slowdown with about 30 or more threads, then compare it with a single-thread run. Inspect the runtime's lock and mutex usage, as suggested in the issue. Done means identifying a thread-safe change that improves multi-thread performance without removing required synchronization.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.