nodejs / nodejs/node

Generating Compile Cache Ahead of Runtime

Đang mở
#58,482 16 bình luận 1 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

feature request stale
Ngôn ngữ chính
JavaScript
Star
122k
Fork
37.3k
Merge trung bình
4 ngày 2 giờ
Pull request đã merge (30 ngày)
283

Mô tả

What is the problem this feature will solve?

It is currently not possible to generate the compile cache without executing the files that will be cached.

Currently, container images and lambda functions can't easily generate code caches ahead of the actual runtime, since the code may have effects you may not want to execute early.

What is the feature you are proposing to solve the problem?

Would it be possible to add a way to generate the compile cache without executing the relevant files, i.e. walking the module tree from the entry point, generating caches along the way?

Perhaps something like node --generate-compile-cache path/to/entrypoint.mjs
and/or

module.generateCompileCache("path/to/entrypoint.mjs")
What alternatives have you considered?

You may be able to work around this by adding "dry-run" code paths specifically for code cache generation, but this is a hacky workaround that can require massive effort.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu bằng cách xem xét hành vi compile-cache hiện có của Node.js và các entrypoint được đề xuất --generate-compile-cachemodule.generateCompileCache(). Xác định cách có thể duyệt cây module của một entrypoint mà không thực thi mã ứng dụng. Công việc được xem là hoàn tất khi có một cách được lập tài liệu và đã được kiểm thử để tạo compile cache liên quan trước khi runtime.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
javascript, node.js
Lĩnh vực
backend
Loại issue
Tính năng
Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức độ hoạt động
Sôi nổi
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
38/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.