I have an Django application where the URL's to be handled shall have a specific pattern like /servername/alpha/beta/2/delta/10/pie/1
Now i will be be needing these parameters contained in the URL and will persist them to the database when a URL beginning from /servername/ is being called.
So i have 2 ways of doing it
- Pass parameters along with request to the relevant view.In this case my regex would ensure that i have param1 through param7 having values alpha,beta,2,delta,10,pie and 1 respectively.
- Pass only the request without passing the parameters.I will either parse using regex the request.path_info or split request.path_info on a "/" and obtain relevant entries
Which of these two methods shall be preferred in order to have better performance in terms of CPU and memory or maybe other factors i am not aware of.
I believe that one can compare the two using time functions but i believe it won't present an accurate picture.Theoretically which approach shall be preferred and why?