I'm a little bit embarrassed by this one. Previously I bogged about DateTime.Now Precision, or the lack there of. I first discovered this phenomenon while performing my performance tests for my blog post NHibernate Access Performance, which showed the differences between property and field level access within NHibernate.
Basically I found that DateTime.Now was not very precise and worked horribly as a benchmarking tool to test relative performance. Well, now I've come to my senses and realized that the nail I was banging on was really a screw, and using the hammer wasn't really the best tool for the job. I've now come to learn of the screwdriver which answers my benchmarking needs. It turns out the System.Diagnostics.StopWatch class exists for just the purpose I was trying to use DateTime.Now for. DateTime.Now is not supposed to be accurate enough to be used for diagnostics.
The StopWatch class is very simple. To use it you basically construct an instance of the object, Call Start(), perform your operations and then call Stop(). The StopWatch will contain a property ElapsedTicks with the most accurate elapsed time available.
While I wish I knew about this before when I originally recorded the benchmarks, I know about it now, and I always say I enjoy learning new things. With this new found knowledge of the StopWatch class I decided to re-run my NHibernate Access Performance tests to see how they looked. The results were dramatically different than I found with the DateTime mechanism.
First, I re-ran the 100,000 accesses test with two threads running synchronously. This is meant to replace my original test I ran. These results can be seen below. Note that all times are in milliseconds.
I then decided to run these same tests again but this time in a synchronous manner, meaning that only one test would be running at any given time. These results can be seen below:
In truth, these last numbers are probably the most accurate representation of the true performance implications of using the various NHibernate access strategies.
Of interest though is that fact that my earlier tests for property level access were showing values of close to 600 ms for the basic property setter where as a simple switch to the StopWatch showed just 62 ms. There was a difference of a full order of magnitude? I was actually surprised by just how much these numbers varied. It turns out that the accuracy of DateTime.Now is even worse than I thought.
--John Chapman
Tuesday, December 4, 2007
DateTime.Now Precision Issues... Enter StopWatch!
Posted by John Chapman at 8:01 PM
Labels: Benchmarking, NHibernate
Subscribe to:
Post Comments (Atom)
89 comments:
The DateTime.Now gets updates around 10 times per second (could be depending on hardware and software setting). So its an 'ok' second and minutes timer. The highfrequencyperformancetimers aka real time clock or stopwatch offer better timing but use up more system resources.
Hello,
thanks for sharing this.
I know that this post is quite old but i tried downloading the source and run the tests with .Net 4 and the newest build of NHibernate (from Hornget).
I couldnt make the Codedom work but the basic getter and setters test showed that a private field was considerable faster than using a property.
Actually a private field was only about 3 times slower than using the lightweight approach.
Best regards
Martin
This is a great inspiring article.I am pretty much pleased with your good work.You put really very helpful information. Keep it up. Keep blogging. Looking to reading your next post. Terry Bogard Jacket
I’m really impressed with this valuable blog. Visit Ogen Infosystem best Website Designing and Development Services at best price.
Website Designing Company in Delhi
The Most Famous Game Street Fighter Costume is avaliable at very best price visit now
terry bogard jacket
Wow, this is very interesting reading. I found a lot of things which I need. Great job on this content. I like it Cyberpunk 2077 Jacket
Thanking you for your bloging.
Hard Work is the best key to unlock doors of Opportunity and Success. 7 Rings Jacket
Amazing Blog Thanks For sharing
Cyberpunk 2077 V Samurai Bomber Jacket
Mobile App Development Company in USA
Graphic Designing Services Delhi
Website Development Services Delhi
I dont have a specific answer to that. We just love being with each other. He gets me. Also let me clarify that although everything has been great for the most part, we have had disagreements already but those have actually brought us closer. brooks adrenaline gts 21 womens
I really thankful to you that you have shared very informative and interesting content with us. fila schuhe
Sir, I read a lot of posts on google but no one could explain it so nicely, the way you explained about it? short sleeve cardigan
Thank you very much for this information. Attacks on journalists.
It was not first article by this author as I always found him as a talented author. Dirk Gently Jacket
very nice your blog
Umar Farooq Zahoor
very nice your blog
best mobile application development company dubai
Thank you for sharing such awesome information with us. Web Design Company in Bangalore
Do you have your iPhone Insurance? If no then connect with the best Mobile Insurance Company and avoid unexpected expenses.
https://adroitinfotech.co.in/
DigiOmate is a Delhi based web development agency putting together to fulfill all your web-based needs like website development,E-commerce Website, Search engine optimization (SEO), Mobile app development, Social media marketing, Content creation, Graphic designing putting all the efforts and dedication to make the best out of everything & with a passion to succeed in the market.
https://www.digiomate.com/
Grateful for sharing your musings. I genuinely like your endeavors and I will hang on for your further studies. Everything is unbelievably open with a positive portrayal of the difficulties. It was truly informative. Your site is helpful. Grateful for sharing! Yellowstone Jackets
We are known as the best Website designing company in Ghaziabad that have delivered many succesful projects across the world. We can be the right choice for you. Connect with us for more information.
Writing knowledgbl post is really great work you did it very well .thank you .luxury apartments in Noida extension
Shop this best Super quality The Umbrella Academy Ashley Madekwe Leather Jacket For Men SHOP NOW
Is this fake news? Is someone trying to drive Galen out of business? I have dealt with Galen for years and am horrified at uncorroborated accusations leveled here. High end audio is hard enough without this. If there were truly a problem then where are the lawsuits, even the small claim court variety, to prove it? adidas zx flux
Your article is extremely helpful exceptionally fascinating subject i am looking that sort of post thank for imparting to us keep it up. white adidas shoes
Interesting topic for a blog. I have been searching the Internet for fun and came upon your website. Fabulous post. Thanks a ton for sharing your knowledge! It is great to see that some people still put in an effort into managing their websites. I'll be sure to check back again real soon. adidas kids shoes
The following time I read a blog, I trust that it doesn't dishearten me as much as this one. Well, I realize it was my decision to peruse, yet I really thought you have something intriguing to say. All I hear is a lot of whimpering about something that you could fix if you weren't excessively bustling searching for consideration. joker costumers
Really amazing information, thanks for your efforts for this blog. Thank you so much for sharing this post
Shades Tensile Structures
Looking for the best Ipad insurance? If yes then connect with Assure India to get the best deal. We can be the right choice for you.
Thanks for sharing this information,this is useful to me...
web design company in navi mumbai
Connect with the best SEO Company in dadar that can provide you fully digital marketing solution at an affordable price. Connect with us for more information.
This is Stallone's first main TV role, demonstrating Sheridan's ability to lure great movie actors to his productions. Beth Dutton Blue Hooded Coat Terence Winter, who previously worked on HBO successes including "Boardwalk Empire" and "The Sopranos," is the co-creator and showrunner of "Tulsa King."
We are looking for an informative post it is very helpful thanks for sharing it. We are offering all types of leather jackets with worldwide free shipping.
LEATHER MOTORCYCLE JACKETS
MOTOGP LEATHER JACKETS
MOTOGP LEATHER SUITS
HARLEY DAVIDSON JACKETS
STUDDED LEATHER JACKET
https://highlandelectronics.net/
We are famous among the best electronics online store, especially when you Buy Playstation Online, Xbox for sale, Apple
phone accessories and more.
https://highlandelectronics.net/
text/whatsapp : +1(702) 637-0962
Buy Canaan Avalon Miner 1166 Pro
Canaan Avalon Miner 1166 Pro
Buy Antminer Z15 420sol/s
Antminer Z15 420sol/s
IPad Pro 12.9-inch for sale
Buy IPad Pro 12.9-inch online
Buy STM Charge Tree Swing online
Order STM Charge Tree Swing
Apple iPhone 13 Pro Max Gold for sale
Apple iPhone 13 Pro Max Gold
Apple iPhone 13 Pro 128GB Gold for sale
Buy Apple iPhone 13 Pro Gold
Buy Apple Watch Series 7 Online
Apple Watch Series 7 for sale
Buy iPhone 13 Pro Max online
iPhone 13 Pro Max for sale online
Buy iPhone 13 Pro online
iPhone 13 Pro for sale
order iPhone 13 pro
iPhone 13 for sale online
Buy iPhone 13 online
Order iPhone 13 online
Buy iPad Air 10.9-inch Online
iPad Air 10.9-inch for sale
Buy MacBook Air 13-inch Online
MacBook Air 13-inch for sale
Wholesale MacBook Pro 13 online
Buy MacBook Pro 13 online
Buy ASUS Chromebook Flip C434 Online
ASUS Chromebook Flip C434
Buy Amazon Fire TV Stick 4K Online
You have shared really very nice information. Keep it up!
Hoarding Advertising Cost in Delhi
Always so interesting to visit your site.What a great info, thank you for sharing. Website design company in Munnar
We have an excellent team of web developers who are capable of creating innovative and high-performance website development of any complexity. With our unparalleled web development services, we promise to deliver you a website of the best performance that are your company-specific needs.
Web design company Edmonton
Our company employs a team of strategic thinkers, technological experts, graphic design geeks, and dreamers. If you are searching Website design company in Barrel then contact CSS Founder.
Website design company Bucharest
You have shared really very nice information. If you are looking for the Homeopathy Doctor in Ghaziabad, then connect with Dr. Vimal Rastogi. He has 18 years of experience in homeopathy field.
Interesting post. I Have Been wondering about this issue, so thanks for posting. Pretty cool post. It's really a very nice and Useful post. Thanks Best Resorts in Lansdowne
If you are looking for a vastu service so you can connect with us , we can be a right choice for you.
Vastu Consultants in Dubai for Property Planning in Dubai
If you are search best website design company then your search ends here, no one best the CSS Founder, click the given link and finds the best solution Website design company Kharkiv
The team at 36RPM have combined experience of 12 years in developing marketing strategies and developing E-commerce websites & plans.
Seo Services in Gurgaon
Thanks for providing the best and nice information about it. This is very good. I hope, i will read your next blog soon.
Medical center in Dublin
If you are looking for an SEO company in Bahrain so you could connect with Promotedial, It can provide you high ranking on googel search engine. For more information please visit our website.
Hey friend, it is very well written article, thank you for the valuable and useful information you provide in this post. Keep up the good work! please check these depression, stress and anxiety related articles:
https://northfacepufferjacket.co.uk/
This is a monstrously stunning site and learned more data to see this post thankful for sharing this enlightening post.shopstreetwears
"Pizza restaurants are becoming increasingly popular among Karachi residents, which is why there are so many new locations popping up around the city. Additionally, they are well recognised for some incredible discount offers, like pink Tuesdays and credit card discounts of 30%. What are you still holding out for? Make room for their enormous 21-inch pizza slice or order a full pie for the family because they can accommodate small and large parties alike.
Location: karachi, Pakistan calzone pizza karachi
Phone Orders: (021) 111 981 111
Email Orders: info@pizzeria.com.pk
WhatsApp: +92 311 1981111"
We offer the best car washing service ,home cleaning, bathroom cleaning ,kitchen cleaning ,Ro water purifier cleaning in Chandigarh. if you need more information visit our website.
Home Cleaning Services Provider in Chandigarh
doorstep car cleaning services in Kharar
I got something valuable information from your blog. Thanks for posting it
iPhone 12 pro max insurance
Shop this best Super quality GRACE VAN DIEN HOODIE
SHOP NOW
Thanks so much for sharing such a valuable information. Medical Centre in Dublin - Thorndale Medical Clinic
Tommy Egan Leather Jacket
I will check out again for more top-quality web content and additionally, recommend this website to all. Many thanks!
If you want to increase your business through a website, and you need the best SEO company. seo company in boise
All our training courses are supervised in our state of the art facility equipped with the latest technology and equipment. Medline Academics offers extensive materials for hands-on IVF training of each technique. All the practical knowledge and experience we offer is quickly integrated by the student and can be applied directly in everyday cases.
The clinical courses that we provide are
•Basic infertility Course
•Basic Andrology course
•Basic Course in IUI
•Training in Endoscopy, hysteroscopy, Laparoscopy
•Fertility nurse training program
•Basic Embryology program
•Advanced ART course for clinicians
•Fellowship in Reproductive Medicine
•Advanced ART Course for clinicians
•Advanced ART Course for Embryologists
Connect with the second life here Luxury Resorts in Lansdowne
Amazing post, thank you!
calilo greece
Your blog is very impressive and have the useful information it is really caught my attention.
Best Pomades In India
it is great to see that some people still put effort into managing their websites. I’ll be sure to check back again real soon. it’s really amazing pendientes oro rosa
Best Website design company in the world. website design company in naples Call us:- +91-8860080044 or send Email at : info@cssfounder.com
Thanks for your nice Blog. “We wander for distraction, but we travel for fulfilment.” Turkey visa apply Send Email: contact@instadubaivisa.com or email@yoursite.com
Welcome, your blog is great. It's very interesting and meaningful Best Place to Stay in Lansdowne
I enjoyed over read your post
Mass Emailing Services India
Mass Mail Service Provider
I read every line and word; thank you; and I look forward to the next. If you want to book an online puja, you can call or visit our website.
Online Pandit Ji Booking for pooja
Eumaxindia is the no:1 Hoarding agency in Chennai, They are in the industry from 2007
Thanks for the wonderful article! If anyone looking for outdoor advertising agencies in Chennai contact us.
Quench your thirst for knowledge with our articles that offer both enjoyment and valuable insights. beth dutton coat
Uncover the perfect blend of amusement and enlightenment in our meticulously composed articles. beth dutton coat
Proficient in encouraging active engagement and participation when exploring complex theories.beth dutton coat
Exceptional ability to identify connections among diverse and intricate theories and disciplines.beth dutton pink coat
If you are finding best apartments in Noida Extension then Exotica offers too many projects in Noida like Exotica Dreamville, Exotica Freshco, Exotica square east, Exotica Northville, Exotica elegance etc. Contact for buy or rent apartments in Noida.
CSS Founder is a leading Website designing company in Faridabad, known for providing high-quality services.
The writing skills of writer are very awesome and impressive. Goku Drip Puffer Jacket
Looking for a reliable WordPress plugin development company? Look no further! Our skilled team of developers creates high-quality and user-friendly plugins that integrate seamlessly with your WordPress website. Whether you need a plugin for e-commerce functionality, SEO optimization, or anything in between, we have the expertise to deliver your custom plugin solution.
Looking to hire the best Twilio API developer? Look no further! Our expert Twilio developers have a proven track record of creating seamless communication solutions. With their deep knowledge and experience, they can build customized Twilio integrations to meet your specific needs. Don't settle for less when you can have the best Twilio API developer on your team.
Bulk email marketing services India
Email marketing company In India
Bulk email services in India
Email marketing services Noida
whatsapp- 7042398111
Website- https://www.getsvisionsolutions.com/email-marketing/
social media
Facebook- https://www.facebook.com/getsvisionsolutions/
Instagram-https://www.instagram.com/getsvision_solutions/
Linkeding-https://www.linkedin.com/company/getsvision-solutions-pvt-ltd
Thank you so much for providing such a best information, if you need the best Software Solutions platform then you must visit here - Travel Technology Consultants
"Umrah Visa Apply Online has been easy through Visitsvisa. Where you can easily get your visa and embark on your journey with happiness. If you are very hobbiyst about Journey, so open your heart and make your journey with VisitVisa.
From business visas to tourist visas, it is concerned with the type of adaption required for diverse needs. Please visit the India Visa government website to apply for an eVisa. There are a few documents required to for apply an Indian eVisa.
When it comes to creating a great online presence, web design plays a vital role. CSS Founder, a reputed website designing company in Mumbai, understands the power of effective design and development. With a team of skilled professionals, they strive to provide the best service to businesses to help them grow their digital presence and achieve their goals.
yellowstone beth dutton blue coat
Thats great i really like it thank you so mnore you can also go for the best baby feeder warmer
Wow, this blog post really broke down the complex topic into easily understandable chunks, making it super easy for me to grasp for more Breast Milk Storage Bags
Wonderful post! The insights were clear and very helpful. Thanks for sharing such valuable information!
Aviator Game Development Company
Your posts never fail to enlighten me with new ways to think and act. This one offered a well-rounded approach with actionable advice that I’m excited to start applying in my own work.
USA Jacket Store
This content is very unique. It's very amazing article. Thanks for socialize this article. Website Designing Company in Faridabad
Post a Comment