[Feature request] Optimization: Link packages based on static analyzation of source code

Open
#3,210 1 comment 1 reaction 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Active
Tech stack
typescript
Domain
build-system

Research direction

Start by running scriptc build ./nm_scriptc.ts --print=native-link-info and inspect which object files are linked despite appearing unused. The issue proposes several possible approaches but does not choose one or define completion criteria; first determine how the compiler currently selects native object files and agree on the intended behavior before implementation.

Written by the indexing model from the issue text.

Description

Looking at the result of scriptc build ./nm_scriptc.ts --print=native-link-info I don't think the source code uses scr_crypto_async.o, scr_child.o, scr_json.o, scr_url.o, scr_ffi.o.

A. The compiler can automatically remove linked object files not used in the source code. That would include omitting error codes and such for object code (string nm_scriptc) not used in the emitted executable, per static analysis.

B. The compiler can start with a blank canvas and link object files that are necessary to complete the instructions in the source code.

C. Other approaches.

Dominant language
TypeScript
Stars
6.7k
Forks
229
Avg merge
14h 29m
Merged PRs (30d)
787

Getting set up

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.

More from vercel-labs/scriptc

All issues in vercel-labs/scriptc

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.