hello i would like to know if the main reasons that some websites on a mobile phone, particulierly an android with very little memory(internal or ram by today's standards) is related to javascript if there are other factors affecting it. if so what they could be.....
.....sorry for my sloppy english

Recommended Answers

All 17 Replies

It's also the amount of resources that need to be loaded and the complexity of the display. The larger the view that needs to be displayed, the slower it gets. The more content that needs to be downloaded, the slower it gets.

At least, for as far as my knowledge goes.

What do you mean with loading resources? Do mean ram or files or somthong else?

I mean the size of resources like CSS, Javascript, etc., and if they're optimized to work as fast as possible.

So basicaly not just the javascript it self but also the size of the javascript and other files as well as the size of the screen that will be displayed?

Yes. A larger screen will cost more resources to render. Working with a 1920 pixel wide website on a mobile phone isn't something most people want - you'd have to scroll all the time to find the content you want to see.

Next, if you have a slow internet connection and need to download large Javascript, CSS and image resources, a website will take longer to load. Also if your phone is slow, loading more resources and keeping them in memory will use up more of the available resources.

So yes, it's both the size of the resources and the complexity of the actions they execute. And maybe more, but this is what I know.

do you think some these factors could be handled with a how a browser works?

Well, I think you can have some influence on them. You can minify your CSS/Javascript files so that they take up less space, you can offer them gzipped to futher decrease the filesize, and you can write more efficient Javascript. The rest is up to the team that creates the browser.

As i know , if you are using a computer with a lot of ram you can copy paste file faster. Browser works also determined how many is browser max of ram usage which handling download and render the web page file.

Each browser handle these factor based on each developer idea. browser with small usage of ram in mobile that might aims to other mobile function that use lot of ram.

Browser can't handle these factor with out fast internet acsess and a lot of ram.

Hmm so on the browser side it depends on ram speed & internet connection speed?

It depends on a lot of things. On the browser side it depends on what I have already described, but your browser, obviously, is fully dependant on the system that it runs on. So if your system is for some reason slow, or if your hardware is old, your browser may not be able to work as fast as it wants. And yes, in that case, RAM speed and internet connection speed are involved, but also core processor speed, data transfer speed within the hardware system itself, and other factors as well.

Then suppose that i'm trying to write a android browser to view a javascript heavy site such as tv.jw.org on a phone with say a single core processor and 200mb ram. What factors should I consider to have a smooth experience on said phone?

javascript is monotask, so whatever it does, it needs to be completed before anything else moves. in practice this means that while javascript is running, the whole app that run it freeze. Websites that have big images will need a lot of ram, even that jpg file that only weights 400KB, may expand in memory to a array of 1000x1000x4 bytes... so having many images means you need a lot of ram. On the desktop theres a lot of ram available, not so much in a phone.

so it's not possible.....

Well I personally don't have any experience at all with writing browsers, let alone browsers for Android :p. But for as far as writing Javascript goes.. sure you can write Javascript code for a website that will run on a phone with the specs you described. It will possibly just get a little (or a lot) slower, that's all (for as far as I know).

What is your goal, then? You're going to write a browser? Because I guess that you'd then be better off in another forum category with these questions :).

yeah you're right
i'm just wondering about these questions because i noticed that alot of javascript site seem to make the said phone hang.
what i wonder about now is whether or not it is possible to write a browser that allows for a smooth experience on javascript-heavy sites on said phone.....i'll propebaly will ask that question in a other categorie.
Up till now i understand that the sites might be slow due to the size of the javascript files since a browser that doesn't support javascript do not make it hang...but it might also be the screen size of the site, the ram or internal memory of the phone....
my first goal is to first indentify the cause of making the phone hang or why it is so slow. whether it all depends on the phone or if it can be solved by a good browser...

Well, I think you can have some influence on them. You can minify your CSS/Javascript files so that they take up less space, you can offer them gzipped to futher decrease the filesize, and you can write more efficient Javascript. The rest is up to the team that creates the browser.

Appreciate, compress the css and js code can reduce the whole page size, so that the page can be load faster.

The thing that own is the said mobile I do not own the websites

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.