You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm running into very inconsistent memory use and compilation time when changing certain things in my code. A minor change in code can change my project from being compilable to causing out of memory issues and excessive build times.
TypeScript Version:
Tested with 1.7.5 and 1.8.9
rxjs 5.0.0-beta.2
Code
Variant 1:
import{Observable,ReplaySubject}from"rxjs/Rx";exportclassTest{constructor(){// no typesconstchanges$=newReplaySubject<number>(1);consteditState$=Observable.merge(Observable.of(true));Observable.combineLatest(editState$,changes$,// passed in as single arguments(edit:boolean,id:number)=>{return{}});}}
This compiles reasonably well, even though 1.7.5 is considerably faster: Compiled with 1.7.5:
Instead of passing the observables to Observable.combineLatest as single arguments, I chose to pass them in as an array:
import{Observable,ReplaySubject}from"rxjs/Rx";exportclassTest{constructor(){// no typesconstchanges$=newReplaySubject<number>(1);consteditState$=Observable.merge(Observable.of(true));Observable.combineLatest([editState$,changes$],// passed in as array(edit:boolean,id:number)=>{return{}});}}
Now compilation is MUCH slower using way more memory:
If I give the two constants explicit types, things change again:
import{Observable,ReplaySubject}from"rxjs/Rx";exportclassTest{constructor(){// with typesconstchanges$:Observable<number>=newReplaySubject<number>(1);consteditState$:Observable<boolean>=Observable.merge(Observable.of(true));Observable.combineLatest([editState$,changes$],// passed in as array(edit:boolean,id:number)=>{return{}});}}
It's still not as efficient as variant 1, but at least comparable Compiled with 1.7.5:
I'm running into very inconsistent memory use and compilation time when changing certain things in my code. A minor change in code can change my project from being compilable to causing out of memory issues and excessive build times.
TypeScript Version:
Tested with 1.7.5 and 1.8.9
rxjs 5.0.0-beta.2
Code
Variant 1:
This compiles reasonably well, even though 1.7.5 is considerably faster:
Compiled with 1.7.5:
Compiled with 1.8.9
Variant 2
Instead of passing the observables to Observable.combineLatest as single arguments, I chose to pass them in as an array:
Now compilation is MUCH slower using way more memory:
Compiled with 1.7.5:
Compiled with 1.8.9
Variant 3
If I give the two constants explicit types, things change again:
It's still not as efficient as variant 1, but at least comparable
Compiled with 1.7.5:
Compiled with 1.8.9
tsconfig.json used in all cases:
Typings
Is this expected behavior? Is there a way to get more consistent results?
P.S.: checked with 1.9.0-dev.20160321 with similar results.
The text was updated successfully, but these errors were encountered: