I have fairly simple class definition with some nested sub-classes and array properties.
The transformation of 2.000 of those objects in one array takes about 25 seconds in the browser with plainToClass or classToPlain.
The same class definition transformed in NodeJS finishes in under 200 ms.
Any ideas ?
Tested the browser stuff in an angular environment.
I have also this problem with an Angular/typescript application which uses plainToClass from a SSE event API with min rate at 30 messages/s. The plainToClass comes high in Chrome profiler.
I'm wondering if I need to stay with Object for all the events but it's a bit of refactoring.
Im also running in an angular/typescript environment. Either Ionic or Electron, its slow in both cases. Did not found a workaround for now...
I am seeing the same thing with Angular / Typescript / Chrome - i'm able to look at slow down in the performance profiler and isolate to to t.transform via TransformOperationExecutor.js.pre-build-optimizer.js:25
This is definitely a regression between 0.1.10 and 0.2.X. Downgrading restores functionality.
@pleerock @MichalLytek @NoNameProvided - Is this project actively maintained?
If you would like to help, rather than complain, write email to @pleerock, he will add you to the typestack team 馃槈
@MichalLytek while I appreciate the invitation very much I have to respectfully decline due to a variety of reasons. One being that I think competition is good for everyone and another that I don't want to revive a dying project. I already did that a couple of times and it never ended good.
@MichalLytek - Im just trying to sort the information on this thread - is there any information on this ticket / project? The performance regression we encountered was crippling until we downgraded.
Happy to help where I can.
After investigation, the problem comes from the version 0.2.1 with the testForBuffer function (src/TransformOperationExecutor.ts, line 101).
I just made a simple test by removing the condition and the function but the result was significant.
Chrome / Angular 8
Thanks @JulianFarhi to testing this out. I wonder how even that snippet works in the browser? Buffer is not an exposed object in browsers. Do you provide a shim manually?
cc @rightisleft, @capc0, @dqueffeulouatw
console.log(Buffer) in my ionic/angular app, it throw a error (can麓t find variable Buffer).
console.log(Buffer) in my electron/angular app logs the nodeJS buffer function function Buffer(arg, encodingOrOffset, length). I wonder how the browser process has access to that function tho. Should only be available in the electron process IMO.
edit: seems like electron create the window.Buffer when nodeIntegration is enabled https://github.com/electron/electron/issues/7081#issuecomment-244583783
I have changed the way we check for Buffers for increased speed. Will be released in the next version.
JSPerf

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Most helpful comment
After investigation, the problem comes from the version 0.2.1 with the testForBuffer function (src/TransformOperationExecutor.ts, line 101).
I just made a simple test by removing the condition and the function but the result was significant.
Chrome / Angular 8