chaitanya karthikk wrote:Will it work fine, because many requests will be coming. Will this program deliver good performance?
But wait a minute. You were asked earlier if it did what you would expect. And you said "Yes". But now it turns out you don't actually know whether it does what you would expect.
However it doesn't really matter because you haven't really described what you would expect anyway. "Good performance"? That really isn't very specific. Are you going to have a web request which does this and nothing else at all? And how long would it have to take before you considered it "not good performance"? You probably don't have an answer for that, because you haven't really thought about it much. But even if you did have a specific performance requirement, nobody could tell by just looking at the code how it would perform. That would depend on the speed of the processor and the size of the memory allocated to the web application server and the number of processors in the machine and the other processes running on the machine and the speed of the network connecting the users to the machine... by now
you should get what I'm saying: "It depends. It's more complicated than that."
So the way to go, if this were a real piece of code, would be to decide to use it. Quite likely it wouldn't make any difference if it could be tweaked to run in 1/100 of the time, as it's only going to be a tiny fraction of the whole processing for the request. And remember what my brother Don Knuth said: "Premature optimization is the root of all evil." And that's what you are doing with that question.