Meteor-Community-Packages / meteor-typescript

Typescript compiler package
https://packosphere.com/refapp/meteor-typescript
MIT License
5 stars 2 forks source link

Question: Recompile times #3

Closed ruohki closed 3 years ago

ruohki commented 4 years ago

Is it just me or are the recompile times rather slow?

20-30 seconds for me as of right now. As its rebuilding front and backend even tho there just changes in the backend

This plugin works wonderfully for me otherwise. Finally Decorators :>

copleykj commented 4 years ago

Are you only seeing full rebuild with this package, or does it also happen with the core typescript package?

ruohki commented 4 years ago

it feels like a complete recompile.

I have a repo setup at ruohki/meteor-graphql-mongoose-starter

saving a server while will recompile the whole thing leading to that wait time of 15-30 secs to view the outcome

copleykj commented 4 years ago

So as far as I can tell from cloning and running your repo, a full rebuild only happens if you change code that is imported into the server environment. Client only code results in a client rebuild and refresh as is standard build tool behavior.

Output for client only build

Notice here that compilation happens for web.browser and then the client is refreshed. After which web.browser.legacy deferred compilation happens.

Typescript compilation for web.browser using Typescript 3.9.7 
Compiling imports/app/index.tsx 
Writing .meteor/local/.typescript-incremental/buildfile.tsbuildinfo 
Compilation finished in 2.8 seconds. 15 input files, 1 files compiled 
Typescript summary: 4 files emitted, 4 transpiled files sent on for bundling 

=> Client modified -- refreshing

Typescript compilation for web.browser.legacy using Typescript 3.9.7 
Compilation finished in 2.2 seconds. 15 input files, 0 files compiled 
Typescript summary: 4 files emitted, 4 transpiled files sent on for bundling 

Output for full rebuild

Here we get web.browser, then os.linux.x86_64 and then the we get a Meteor server restart. Finally web.browser.legacy deferred compilation happens.

Typescript compilation for web.browser using Typescript 3.9.7 
Compiling imports/startup/server.ts 
Writing .meteor/local/.typescript-incremental/buildfile.tsbuildinfo 
Compilation finished in 2.7 seconds. 15 input files, 1 files compiled 
Typescript summary: 4 files emitted, 4 transpiled files sent on for bundling 

Typescript compilation for os.linux.x86_64 using Typescript 3.9.7 
Compilation finished in 2.1 seconds. 15 input files, 0 files compiled 
Typescript summary: 13 files emitted, 13 transpiled files sent on for bundling 

=> Meteor server restarted

Typescript compilation for web.browser.legacy using Typescript 3.9.7 
Compilation finished in 1.9 seconds. 15 input files, 0 files compiled 
Typescript summary: 4 files emitted, 4 transpiled files sent on for bundling 

As far as what can be done to speed up compile times, I can't speak on that as I'm not familiar. Possibly @perbergland, or other members of the community with build plugin experience, can shed some light on possible solutions.

ruohki commented 4 years ago

https://i.gyazo.com/07cee7bd1cb641b0539513c9d6368824.gif

Here is the log from the video, whole process is around 20 seconds until the webapp is browsable again. using --exclude-archs web.browser.legacy i can speed things up a bit but still

Typescript compilation for web.browser using Typescript 3.9.7 
Compiling E:/skeleton/imports/app/index.tsx 
Compiling E:/skeleton/imports/startup/client.ts 
Compiling E:/skeleton/imports/startup/shared.ts
Compiling E:/skeleton/client/main.ts
Compiling E:/skeleton/imports/api/graphql/helper/typegooseMiddleware.ts 
Compiling E:/skeleton/imports/api/graphql/helper/scalarObjectID.ts 
Compiling E:/skeleton/imports/api/graphql/classes/user.objectTypes.ts 
Compiling E:/skeleton/imports/api/mongo/user.model.ts 
Compiling E:/skeleton/imports/api/graphql/helper/getUser.ts 
Compiling E:/skeleton/imports/api/graphql/helper/authChecker.ts
Compiling E:/skeleton/imports/api/graphql/classes/user.inputTypes.ts 
Compiling E:/skeleton/imports/api/graphql/resolver/user.resolvers.ts 
Compiling E:/skeleton/imports/api/graphql/index.ts 
Compiling E:/skeleton/imports/api/meteor/accounts.ts
Compiling E:/skeleton/imports/startup/server.ts
Compiling E:/skeleton/server/main.ts
Writing .meteor\local\.typescript-incremental\buildfile.tsbuildinfo 
Compilation finished in 4.5 seconds. 15 input files, 16 files compiled 
Typescript summary: 4 files emitted, 4 transpiled files sent on for bundling 
Typescript compilation for os.windows.x86_64 using Typescript 3.9.7 
Compiling E:/skeleton/imports/app/index.tsx 
Compiling E:/skeleton/imports/startup/client.ts 
Compiling E:/skeleton/imports/startup/shared.ts
Compiling E:/skeleton/client/main.ts
Compiling E:/skeleton/imports/api/graphql/helper/typegooseMiddleware.ts 
Compiling E:/skeleton/imports/api/graphql/helper/scalarObjectID.ts 
Compiling E:/skeleton/imports/api/graphql/classes/user.objectTypes.ts 
Compiling E:/skeleton/imports/api/mongo/user.model.ts 
Compiling E:/skeleton/imports/api/graphql/helper/getUser.ts
Compiling E:/skeleton/imports/api/graphql/helper/authChecker.ts
Compiling E:/skeleton/imports/api/graphql/classes/user.inputTypes.ts 
Compiling E:/skeleton/imports/api/graphql/resolver/user.resolvers.ts 
Compiling E:/skeleton/imports/api/graphql/index.ts 
Compiling E:/skeleton/imports/api/meteor/accounts.ts
Compiling E:/skeleton/imports/startup/server.ts
Compiling E:/skeleton/server/main.ts
Writing .meteor\local\.typescript-incremental\buildfile.tsbuildinfo 
Compilation finished in 3.8 seconds. 15 input files, 16 files compiled 
Typescript summary: 13 files emitted, 13 transpiled files sent on for bundling 
W20200902-09:05:26.799(2)? (STDERR) Note: you are using a pure-JavaScript implementation of bcrypt.
W20200902-09:05:26.800(2)? (STDERR) While this implementation will work correctly, it is known to be
W20200902-09:05:26.801(2)? (STDERR) approximately three times slower than the native implementation.
W20200902-09:05:26.803(2)? (STDERR) In order to use the native implementation instead, run
W20200902-09:05:26.803(2)? (STDERR) 
W20200902-09:05:26.803(2)? (STDERR)   meteor npm install --save bcrypt
W20200902-09:05:26.804(2)? (STDERR) 
W20200902-09:05:26.804(2)? (STDERR) in the root directory of your application.
=> Meteor server restartedTypescript compilation for web.browser.legacy using Typescript 3.9.7 
Compiling E:/skeleton/imports/app/index.tsx 
Compiling E:/skeleton/imports/startup/client.ts 
Compiling E:/skeleton/imports/startup/shared.ts
Compiling E:/skeleton/client/main.ts
Compiling E:/skeleton/imports/api/graphql/helper/typegooseMiddleware.ts 
Compiling E:/skeleton/imports/api/graphql/helper/scalarObjectID.ts 
Compiling E:/skeleton/imports/api/graphql/classes/user.objectTypes.ts 
Compiling E:/skeleton/imports/api/mongo/user.model.ts 
Compiling E:/skeleton/imports/api/graphql/helper/getUser.ts
Compiling E:/skeleton/imports/api/graphql/helper/authChecker.ts
Compiling E:/skeleton/imports/api/graphql/classes/user.inputTypes.ts
Compiling E:/skeleton/imports/api/graphql/resolver/user.resolvers.ts
Compiling E:/skeleton/imports/api/graphql/index.ts
Compiling E:/skeleton/imports/api/meteor/accounts.ts
Compiling E:/skeleton/imports/startup/server.ts
Compiling E:/skeleton/server/main.ts
Writing .meteor\local\.typescript-incremental\buildfile.tsbuildinfo
Compilation finished in 3.3 seconds. 15 input files, 16 files compiled
Typescript summary: 4 files emitted, 4 transpiled files sent on for bundling
copleykj commented 4 years ago

Yes, from what I see you are making a change that affects the server and thus there is a complete rebuild that happens. It is a bit unfortunate that it seems to take 20 seconds to accomplish this though.

perbergland commented 4 years ago

Can you test with the new 0.2.0 version to see if it made anything change?

ruohki commented 4 years ago

Dont seem to wield any performance boost. Still around that time. Still recompiles clientcode when i change a server file :/

perbergland commented 3 years ago

Please test again with v0.3.0 which should yield much better recompile times when running in meteor run or test+watch mode

MastroLindus commented 3 years ago

for our project, 0.3.0. improved speed a lot (before this release performance was just too slow compared to the official plugin, but now we are going to probably make the switch!) Thank you!

perbergland commented 3 years ago

I will close this issue soon since there are reports from the field that the performance is now OK

perbergland commented 3 years ago

Closing now since the report is for pre-0.3.0 and significant efforts were made to speed up the compiler