dsherret / dsherret/ts-morph

sourceFile.move significantly slows down the speed

Open
#1,613 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
6.2k
Forks
238
Avg merge
2m
Merged PRs (30d)
1

Description

Previously, all of my code was in a single directory. I decided to organize them and created multiple sub directories and used `sourceFile.move` (tried `moveImmediately`, `moveImmediatelySync`, `moveToDirectory` as well).

However, this operation seems really expensive. Without moving source files, `ts-morph` was taking 5 seconds to complete everything (which involves various property modifications, interface modifications etc).
With moving, it took 10+ minutes to finish. It seems it starts really fast in the beginning, but as time goes on it becomes slower and slower.

Is there any trick that I can use to speed up the process?

Update: It seems it's relatively faster when using `tsx` (3 minutes). Bun and Deno took 10+ minutes.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the slowdown with the mentioned sourceFile.move, moveImmediately, moveImmediatelySync, and moveToDirectory operations, comparing runs with and without file moves under tsx, Bun, and Deno. Done means identifying the cause and documenting or implementing a validated way to avoid the progressive slowdown.

Written by the indexing model from the issue text.

Assessment

Tech stack
bun, deno, typescript
Domain
performance, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.