Copy link to clipboard
Copied
Hi
I read about revalidating data submitted in server side in many post.
I need to know the about perfromance statistics on validating a piece of data two times(client and server side).
regards
RKP
Copy link to clipboard
Copied
RKP_ wrote:
perfromance statistics on validating a piece of data two times(client and server side).
Client-side validation performance doesn't count, as far as you are concerned. The browser or some other client is in charge of that.
Server-side validation performance depends on how much validation you wish to do, and how robustly. Perhaps the commonest form of server-side validation is the validation of form and URL variables. ColdFusion has functions like isValid, isDefined, structKeyExists, len, and so on, that enable you to perform most validation tasks.
The performance cost of calling these functions is negligible in the context of page execution times of, say, several seconds. However, if your validation code involves the creation and manipulation of a large number of objects, or connecting to another server(database, ftp, http, mail), then the performance cost could be as high as tens of seconds per page request or even minutes.
Copy link to clipboard
Copied
Client side validation is done to make your app more useable. Server side is done to make it more reliable.
Deciding whether or not to do it depends on:
1. The liklihood of client side validation being bypassed, and
2. The consequences of bad data being processed.
As BKBK suggested, most of the time we are talking about nanoseconds.
If you want to see for yourself, do this.
<cfset startTicks = GetTickCount()>
validation code
<cfdump var="#GetTickCount() - startTicks# msecs">