Has anyone observed a performance difference betwe...
# suitescript
e
Has anyone observed a performance difference between 2.0 and 2.1?
c
It's slower.
At least in the Suitelet I converted over.
e
Dramatically slower? A little slower?
c
Hard to characterize by feel, but in this case it's noticeable, though not bad enough to avoid 2.1
If I had an app that was performance dependent I would convert and benchmark. Giving up the language features for speed seems like a decision that could be made rationally.
e
Yes I'm not considering nor would I ever recommend a blanket decision on this. Just curious if others had observed this
a
Or just use a typescript compiler and get the best of both worlds... 🎆
🎉 1
If I would have sent to channel, we might see some real fireworks...
e
Yeah I'm definitely not going to do that
a
@Azi Why do you think switching over to TypeScript is a good idea when NetSuite does not officially support TypeScript and any performance gained by pre-compiled code can potentially be lost during transcompilation to Java by the Rhino engine? NetSuite API has its own problems and nuances, adding an extra layer/library does not worth it. There is also another inconvenience, your entire Development Team needs to know TypeScript and any future hire needs to know NetSuite, NetSuite API and TypeScript.
a
Look at that! I got fireworks started! @alien4u Anyway, the typescript package that I use https://www.npmjs.com/package/@hitc/netsuite-types essentially just gives you intellisense and transpiles your code. It doesn't require full fledged typescript. I have written projects in real typescript. You don't need to know real typescript for this. I haven't written a single interface in netsuite-typescript, which is the core basics of typescript. So the 2 things I gain from this are intellisense ( which I believe you can get regardless if you download the 2.0 api from the file cabinet) and the transpiling. I'm not sure what you mean that is not supported or you could lose performance gains. It is simply converting/transpiling es6 code to es5. When I said you get the best of both worlds I meant you can push your code as 2.0 and write in es6.
And one more gain is you get error warnings if you are using the Netsuite 2.0 API wrong. That's not a bad thing
💯 1
c
I use @hitc/netsuite-types for the intellisense in vscode and enjoy having typescript keep me from making type errors. It's pretty simple to create a type that matches custom record definitions and declare those types on method parameters. This can be learned in less than a day. You make all the lost learning time back in less than a month, probably a week. After that, it's just free productivity.
💯 2
a
@Azi I would have to see how the IntelliSense you get from there is better than the one you get from WebStorm + SDF Plugin (both officially supported by NetSuite). Not sure if it worth it to add extra problems(extra layer), what I mean is
netsuite-types
is maintained by somebody (not NetSuite). What happens when something breaks because NetSuite changes underlying types or something and
netsuite-types
was not updated fast enough or introduces an error? Who is liable when a Production or Manufacturing business lost X amount of dollars?
I always have this in my mind: "United States of America is the country with the highest number of lawsuit as % of population." So I will try to use everything OFFICIALLY supported.
c
In my experience, NetSuite is slower to update than the folks here. That's why I'm not that worried.
a
@Chris NetSuite can be slow and a company can lost money because of NetSuite which make them responsables for that. When the Company lost money because you are using something not officially supported then you are responsable for that and the shark will bite you... so you should be worry(my opinion of course).
a
@alien4u I don't understand what you see could go wrong.
What happens when something breaks because NetSuite changes underlying types
If this happened, everyone's code would break, even if you don't use this package because types exist even if you don't have to declare them or see them. It literally converts your ts code to js suitescript 2.0. It doesn't change your code.
a
@Azi I think you are missing the point here... when anything goes wrong and you are using officially supported tools for the platform you are using and is not a coding error your out of hook(you are not liable for that). When anything goes wrong and NetSuite support step in and see unofficial tools they can legally wash their hands and you are liable.
Is that simple...
And believe me NetSuite is very good washing their hands.
a
@alien4u So you don't use any 3rd party libraries in your code at all?
a
No, we don't 99.5% of the time, only use them in very rare cases and we only use 2 of them(lodash, moment).
m
I would say using typescript, iv cut down my bugs and development time by a good 30% if not more
a
Anyways this is just my opinion and paranoid advise.
a
Sounds like it. I've never heard anybody not use any libraries because they are worried about lawsuits
m
Most of the time i write suitescripts in typescript, i push for the first time and im bug free
✔️ 1
a
Long Life to TypeScript...
c
Admittedly, I've never been sued over a software defect. Most clients, if they're happy with your work, are willing to let you fix screw ups. But being stung badly, even once, would dampen my trusting outlook.
m
I'm late to the latest typescript flame war lol but @alien4u I think you are confusing TypeScript (programming language / transpiler tool) with NFT (@stalbert’s toolkit library that uses TypeScript). FYI, from what I understand TypeScript is slowly getting official support from NetSuite. It's already happening with SuiteCommerce
👆 1
s
Yes, NS either already does or is about to officially support TypeScript
also, on the original question by @erictgrubaugh, I've heard 2.1 is supposed to be FASTER than 2.0
I presume speed increase is primarily due to the switch from Nashorn to Graal?
e
I have heard the same, but haven't actually observed it. In fact I am (anecdotally) hearing the opposite.
m
From some basic tests I did a couple months back 2.1 was faster in raw JavaScript execution (e.g. priming numbers) but slower with IO / NetSuite API calls. My speculation is there is still a bridge to Rhino for API, much like a lot of 2.0 invokes 1.0 under the hood.
😥 1
👀 1
s
Since Graal is a JS engine itself I'd be (sadly) surprised if they are bridging to Rhino (another entirely separate JS engine)
the only place I've seen '2.0 invokes 1.0' is in client scripts, where such code is visible. I also think it's rather irrelevant there because in client scripts the only JS engine is the browser - neither Graal nor Rhino nor Nashorn are involved there 🙂
IIRC, SS 1.0 = Rhino, SS2.0 = Nashorn, SS 2.1 = Graal?
m
I'm pretty sure SS1.0 / SS2.0 are Rhino and SS2.1 is Graal
I know for a fact 2.0 bridges to 1.0 server side. If you use the debugger you can step into the netsuite module code
message has been deleted
s
that is indeed sad. IMHO the SS2.0 api is more obtuse and verbose, not an improvement over 1.0. Forcing