Faster I/O in Javascript

Can anyone tell how to improve the speed of a JS program ?

1 Like

it depends on the program

generally I think first thing would be to remove and collate steps, then check if methods you are using can be changed with other more performing methods, and check if there is a different more performing way to do the same thing

But it’s javascript, it is not exactly built for speed

3 Likes

pls tell what makes websites slow or fast

a lot of stuff actually, which can include how much stuff it has to load, processing speed of the server, internet connection etc

1 Like

That a is an extremely broad question, as @ilenia says you’d need to be more specific. But main bottlenecks aren’t to do with JS, JS in general is now processed extremely fast (I/O in particular), it’s much more to do with speed of transferring data across networks.

Edit: if you want your JS code to run faster, then you have to be specific regarding what you have that is running slowly – for any language, it’s not enough to just ask how to make it run faster in general, as there are a near-infinite number of answers, each specific to one situation

2 Likes

Thanks. Pls tell me , is it good to use JS for competitive programming ?

It depends on the competitive programming.

It’s like asking if that is a good pair of shoes to partecipate to a sport competition. It depends, is it a marathon or ice skating?

2 Likes

As far as I know it’s not very common, if the contest has problems designed for JS then you would use JS but it’s almost always going to be C++ or Java afaics.

What are you actually trying to find out here? Because these are three very broad and almost completely unrelated questions with no specific answer

1 Like

Actually I was planning to use JS for competitive programming but wasn’t getting good ideas about how to use it that way, so, thought that I should ask here. Thank you for guidance :blush:

Got it. Thanks. I don’t know much about competitions so abruptly started this conversation

Have you looked at all at any resources relating to competitive programming? There are many websites which provide competitive programming tests and competitions: they are what would tell you what you need to know. They have rules, so you can’t just use {insert arbitrary programming language}. If most of them say you can use language X or Y, then that’s the language you’d use. It makes no difference if you find techniques to speed up execution of language Z if you can only use languages X or Y for the competition.

If you find competitions/tests that use JS and that you want to compete in, then you’d use JS :man_shrugging:t3:. The whole sport is based on an ability to quickly apply very strong CS knowledge (eg core algorithms and core maths), so language is not hugely important

I’ve looked up some stuff on CodeChef. It offered Node 7.4.0 so decided to use it.

:man_shrugging:t3: you shouldn’t need anything beyond basics: as I say language isn’t hugely important. I guess you’ll be slightly hamstrung by the complete lack of a standard library and a language that is designed for I/O. And a large % of standard reference materials assume Java/C++, but I don’t think that’s much of an issue. I assume they’ll raise the time requirements significantly if using JS given there’s no control over memory layout.

Thanks for guidance :blush:

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.