Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

128
Views
Best way to load module that is not used often

I have an express script (index.js( in which I load a bunch of api function from other js files. In one file (text.js) I am exporting a function that tokenizes text that requires the following:

const tokenize = require('chinese-tokenizer').loadFile('./cedict_ts.u8');

The cedict file is ~10MB.

The question is, when I deploy to firebase and index.js api functions are loaded, is the 10MB file preloaded into memory or is that when an api call occurs then the 10MB file is loaded? Also, if an api call happens that does require a function from text.js, would the 10MB still load into memory?

Basically, I want to figure out if it would be better to put the require call inside the function that tokenizes and not on top of text.js.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!