Client-side resource calculation for project amount screen
Moderators: Public Relations Department, Players Department
- joo
- Posts: 5021
- Joined: Fri Jun 17, 2005 2:26 pm
- Location: London, UK
Client-side resource calculation for project amount screen
Like so...
This would cut down the amount of time spent calculating the amounts myself based on the per-day figures given. If you wanted to go the whole hog you could make all the fields editable, including the number of hours spent on the project to allow total control - this method would still be completely secure as one value would still only be sent to server where the final calcuations can be made. It would only make it more convenient for the user
This would cut down the amount of time spent calculating the amounts myself based on the per-day figures given. If you wanted to go the whole hog you could make all the fields editable, including the number of hours spent on the project to allow total control - this method would still be completely secure as one value would still only be sent to server where the final calcuations can be made. It would only make it more convenient for the user
- SekoETC
- Posts: 15523
- Joined: Wed May 05, 2004 11:07 am
- Location: Finland
- Contact:
Cool, very cool! Everybody talks about adding stuff like this but no one actually bothered to write the code. It should tell the user to click outside the box to make the numbers to appear but other than that it's cool. You give it the same info as before so there's no need to change the server-side script. The only difference is that people have no need to start over and cancel projects several times to test and fix amounts.
Not-so-sad panda
- Doug R.
- Posts: 14857
- Joined: Wed Mar 23, 2005 6:56 pm
- Contact:
- Chris
- Posts: 855
- Joined: Sat May 05, 2007 1:03 pm
- Doug R.
- Posts: 14857
- Joined: Wed Mar 23, 2005 6:56 pm
- Contact:
Chris wrote:Doug R. wrote:I like it in principle, but giving the server more work is definitely not something we need right now.
The calculations are done client-side. The only increase for the server is that the page it sends out is (trivially) longer by a couple of Javascript lines.
Sorry if I'm being dense, but is it really trivial? 3/4 of the lag seems to be outputting the page back to the player. I hit submit, the info is sent reasonably fast, and then I wait 5 mins or longer for the page to refresh. Even if it slows things by 1% on a 5 min lag, that's 3 extra seconds on a process that should be instantaneous.
Hamsters is nice. ~Kaylee, Firefly
- joo
- Posts: 5021
- Joined: Fri Jun 17, 2005 2:26 pm
- Location: London, UK
- joo
- Posts: 5021
- Joined: Fri Jun 17, 2005 2:26 pm
- Location: London, UK
Actually, If most of the lag is caused by sending users the same pages over and over again with different data displayed on them, wouldn't it be more efficient to use some sort of XML and CCS/Javascript combination rather than having the server compose the HTML?
This would probably be a long term change, but it's just an idea...
This would probably be a long term change, but it's just an idea...
- SekoETC
- Posts: 15523
- Joined: Wed May 05, 2004 11:07 am
- Location: Finland
- Contact:
Usually sending text to the users isn't what's heavy, sending queries to a database is what. For all we know, the lag might be caused by the fact that more things have been made translatable, thus increasing the number of things that need to be fetched from the database, and the amount of languages has also been increasing. But anyway, the JavaScript code wouldn't have to be fetched from any database since it's the same for everyone, only the output would vary.
Not-so-sad panda
- Chris
- Posts: 855
- Joined: Sat May 05, 2007 1:03 pm
- Doug R.
- Posts: 14857
- Joined: Wed Mar 23, 2005 6:56 pm
- Contact:
That's true Chris, but heavy users + some processes = tremendous lag. The two don't mix. See this thread(http://www.cantr.net/forum/viewtopic.php?t=14428) which attempts to track down the lag causes.
Hamsters is nice. ~Kaylee, Firefly
- marol
- Posts: 3728
- Joined: Sun Jul 17, 2005 11:45 am
- Location: Kraków, PL
- Contact:
- Torkess_theCommie
- Posts: 499
- Joined: Mon Apr 03, 2006 3:44 am
- Location: British Columbia, Canada
-
- Posts: 411
- Joined: Thu Apr 27, 2006 4:38 am
Really nice Joo. Keep that up.
Thankyou Seko/database , marol/MySQL.
I have next to nothing by way of any programming, but you only need to watch the database time compared to total time to know that the database is the lag bringer.
Everyone needs to remember, many people with many characters and a whole shitload of objects and activities tied to each will inevitably bring lag.
Thankyou Seko/database , marol/MySQL.
I have next to nothing by way of any programming, but you only need to watch the database time compared to total time to know that the database is the lag bringer.
Everyone needs to remember, many people with many characters and a whole shitload of objects and activities tied to each will inevitably bring lag.
Science teacher: "good morning class"
students groan
Science teacher: "Today we will be learning about intelligent design"
Little Billy: "OH GOD"
First quoted in the NationStates forum on 10/14/05.
http://washingtonvil.myminicity.com
students groan
Science teacher: "Today we will be learning about intelligent design"
Little Billy: "OH GOD"
First quoted in the NationStates forum on 10/14/05.
http://washingtonvil.myminicity.com
- UloDeTero
- Posts: 344
- Joined: Thu Dec 01, 2005 3:03 pm
- Location: Cheshire, England
Not to steal your thunder, joo, but I did something similar recently. That too could use client-side calculations. In fact, I had that in mind but didn't mention it in the post at the time.
- joo
- Posts: 5021
- Joined: Fri Jun 17, 2005 2:26 pm
- Location: London, UK
Return to “Implemented Suggestions”
Who is online
Users browsing this forum: No registered users and 1 guest