Question: I have designed a hybrid(keywords and data in same excel sheet) framework using `WebDriver`+`Java`+`TestNG`+`Maven`. I am using `PageFactory`, `Singleton Pattern` . I am using different type of HTML locators in my framework like `id`, `css`, `xpath`. I run tests on UNIX environment.

I was told that using id instead of `xpath` is faster. But how do we measure it, because when I use `xpath` and when I use `id` in both cases test gives output in same time.

Apart from avoid using `xpath`, what are other points to take care of to make project improve lot in case of speedy execution.

Answer: 
I see two possible intepretations of your question here. The first is "How can I improve the speed of how elements are found on a page?". Another is "How can I improve execution speed of my suite of tests?". 

The first question has some answers already. You've found that `xpath` vs `id` doesn't provide much speedup, so you're almost at the end of the road there. 

The second question has more answers. Remember that if you're using WebDriver for end-to-end test automation, there's many, *many* things that affect your tests, such as

* Browser rendering of HTML
* Browser JS compilation and execution
* Internet connection speed
* CSS Styling
* DOM Generation and updating
* Screen resolution
* Application load time
* Browser navigation
* HTML structure
* Server-side application logic
* Client-side application logic

These may all affect how stable your tests are, and in turn how well they run. 

To get better run-time performance, I'd suggest the following: 

* **Make sure your network connections/Internet connections are reliable and as fast as possible.** Latency causes your apps to run more slowly which in turn causes tests to run more slowly.
* **Use physical or virtual machines with good hardware specs.** Running on low-powered machines (in terms of RAM or CPU) may cause flakiness in your web app which in turn causes flaky tests.
* **Run your tests in parallel as much as possible.** Divide large suites into smaller suites that can be run independently at the same time.
* **Avoid writing low-value tests.** End-to-end tests are inherently long-running tests, and so tests that don't contribute much to understanding your application waste run-time.
* **Write deterministic tests.** Tests that don't require a lot of overhead in terms of setup and teardown run quicker and more reliably.

In my experience these are effective ways to get your test run-time down.
A typical way to measure the length of a short operation is to measure the total time required to perform the operation many times, divided by the number of times you performed it. How many times? It depends on the operation; I usually start with a small number and keep doubling it, or multiplying by ten, until the answer has as much precision as I need.

There are innumerable ways to make software faster but you did not provide enough details to recommend anything specific.