Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 876903
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T11:30:48+00:00 2026-05-15T11:30:48+00:00

From the performance view, is it better to check or not to check for

  • 0

From the performance view, is it better to check or not to check for Nothing(null) before set it?

Is clear that for readability maybe there is no need of supplementary step, but for performance? Maybe testing the IF is less time consuming that setting to NULL, if there is no need of?!

I run that on a computer, and the result was the same.

  Dim sw As New Stopwatch()

  sw.Start()
  For i As Integer = 0 To 10000
    _MyObject = Nothing
  Next

  sw.Stop()
  Console.WriteLine("no check: {0}", sw.Elapsed)
  sw.Reset()

  sw.Start()
  For i As Integer = 0 To 10000
    If _MyObject IsNot Nothing Then
      _MyObject = Nothing
    End If
  Next

  sw.Stop()
  Console.WriteLine("with check: {0}", sw.Elapsed)

Result:

no check: 00:00:00.0000326
with check: 00:00:00.0000349

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T11:30:49+00:00Added an answer on May 15, 2026 at 11:30 am

    There really is no logical reason to check if the value is already null/Nothing. As you can see you take a small hit in performance with the check anyway.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Which one is better from performance view user control or custom control? Right now
Which option is better from Best practices point of view and from performance point
From a performance perspective, is it better to wrap each statement that utilizes LINQ
Is VARCHAR(100) any better than VARCHAR(500) from a performance point of view? What about
I'm wondering which is better approach from performance point of view, is it better
My question is mainly about performance. The compiler knows better that, for example, some
From a performance point of view is it the same doing this: select *
Apart from performance concerns, should web-based applications be built differently according to the number
For my data intensive web application (heavy forms & complex reports), from performance standpoint,
I have some trouble achieving adequate real-time performance from my application and wondering if

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.