Which Is Better For Performance, And Vs AndAlso

Jul 15, 2011

When writing an If statement, I've always used And when needed like: If 1=1 And 2=2 Then. The only time I ever used AndAlso is if the second condition will error if the first isnt true like: If Not IsDbNull(Value) AndAlso Value=2 Then. However, recently I've heard that AndAlso is better for performance than And as the second condition is only read when the first is true. In this case, should I always just use AndAlso?

View 3 Replies


ADVERTISEMENT

Difference B/w AND And ANDALSO Operator?

Oct 29, 2009

What is the difference b/w the AND and ANDALSO operator?

View 3 Replies

Difference Between (OrElse And Or) And (AndAlso And And)?

Dec 7, 2011

What is the difference between (OrElse and Or) and (AndAlso and And)?Is there any difference in their performances, let say the correctness benefit?? Is there any situation that I shoudn't use OrElse and AndAlso?

View 4 Replies

Unable To Run AndAlso Statement?

May 9, 2011

Im trying to check service on a remote server.. as i was typing this i kept getting a syntax error on AndAlso statement.

Also, how do i add the path to connect to a remote server to check the service?

Private Sub CheckServiceButton_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckServiceButton.Click
' This will check if the service is running '

[Code]....

View 13 Replies

Why Does Lambda Not Work With AndAlso

Jul 10, 2009

I finally found out that my lambda in the following statement evaluates to false as opposed to the corrected version. Just wondering why:

CODE:

View 7 Replies

Understanding AndAlso - Get A Runtime Error?

Oct 5, 2011

Looking at the following code snippet in VS2008 (this is from the SBS book)

Dim HumanAge As Integer = 0
If HumanAge <> 0 And 7 / HumanAge <= 1 Then
MsgBox("1 dog year or older")[code]....

I expect to get a runtime error, because And evaluates both conditions, which is why in this case AndAlso should be the better operator to use. When I try this code there is no difference in behavior between 'And' & 'AndAlso'. In neither case I get a
runtime error, not even when I flip the conditions around. Is this by design, a lucky accident, or do I just not get it?

View 5 Replies

.net - AndAlso In VB Linq Query Doesn't Seem To Be Working?

Sep 14, 2010

The below query fails with Null Reference Exception when there are elements in BOMIDs where MatID property is nothing.I thought the 'x.MatID isnot Nothing AndAlso' would prevent the x.MatID.Process part of the where from being executed. There are a couple elements in the BOMIDs collection that where MatID is nothing.

From x In BOMIDs _
Group Join y As PurchasedProcess In SpecialProcesses _
On x.MatID.PurchasedProcess Equals y.Name _
Into G = Group _

[code]....

View 2 Replies

Best Version To Use For Performance

Mar 15, 2011

I am running windows vista with 1gb memory and 2ghz proccessor. What would be the best FREE version of .NET to use for best performance? Its been years since I have done any PC programming and I would like to do a little bit =]

View 6 Replies

Get 64-bit Performance Data?

May 4, 2011

[URL]

The upper picture is the output of a Unix task. The lower picture is what I have in VB. Enumerating tasks is not difficult however the rest it is because it's not documented anywhere.

What am I interested in if I want to get 64-bit performance data?

View 1 Replies

High-Performance TLS With .NET?

Sep 6, 2010

I'm working on a project that calls for high-performance networking with TLS encryption in VB.NET. The stock SSLStream sucks rotten eggs; its 'asynchronous' read/write operations aren't async at all, meaning that they'll operate parallel to each other and to the main thread but that it offers absolutely nothing that resembles async read/read and write/write, which means that reads are totally synchronous to each other and writes are too (only 1 read and only 1 write can be done at a time).

I've done a lot of reading on this failing and it seems like MS has no intention of ever fixing this.Hoping a whole lot not to have to write my own TLS implementation. I've tried the Mentalis open source SSL suite, which will NOT compile. I've tried SocketWrench tools which will not compile under VS 2010 (and whose documentation indicates it's in fact synchronous on its async threads too; can only do 1 async read and 1 async write at a time).

What I want/need is an SSL/TLS implementation that actually works with DotNET that actually allows me to do multiple asynch reads/writes over a TCP/IP transport stream. Anybody have any experience or recommendations on 3rd party toolkits or alternate methods of SSLStream I/O?

View 1 Replies

IDE Versus EXE Performance In .NET?

Oct 5, 2009

I've developed a .NET application that, among other things, does the following:Uses WebClient to retrieve data from a remote server.
Serves as a socket server to 2 'satellite' applications run on the same machine or on a LAN.When I run the app in the VS IDE, it works great. It quickly gets the data from the remote server and communicates perfectly with the 2 satellites.However, when I build it and run it as an EXE, the response from the remote server is very slow and its communication with the 2 satellite applications become very poor.Is there some important difference between running an app in the IDE and running it as an EXE that could effect it like this?

View 1 Replies

Linq To SQL Performance Using Contains?

Jun 1, 2009

I'm overloading a vb.net search procedure which queries a SQL database.One of the older methods i'm using as a comparison uses a Stored Procedure to perform the search and return the query.My new method uses linq.I'm slightly concerned about the performance when using contains queries with linq. I'm looking at equally comparable queries using both methods.Basically having 1 where clause to Here are some profiler results;

Where name = "ber10rrt1"
Linq query : 24reads
Stored query : 111reads

[code]....

Forgetting for a moment, the indexes (not my database)... The fact of the matter is that both methods are fundamentally performing the same query (albeit the stored procedure does reference a view for [some] of the tables).Is this consitent with other peoples experiance of linq to sql? Also, interestingly enough;Using like "BER10%"

resultset.Where(Function(c) c.ci.Name.StartsWith(name))

Results in the storedproc using 13125reads and linq using 8172reads?

View 1 Replies

Ping Using VB - Performance ?

Jul 20, 2009

I have this code to ping a list of over 400 switches , the program works fine but for some reason the first time i ping all the switches alot of the attempts time-out(even tho they shouldnt) which makes the program alot slower , if i click ping again less of the attempts time-out(and as a result the program runs faster) and if i click it a third time i usually get a completely accurate result with all the switches pinging back "success" (except for a few which i know for a fact are down anyway) any ideas why this is ?

CODE:

View 5 Replies

.net - Performance And Linq In Iterations?

Mar 16, 2012

These 2 ways of working both work, but I'm wondering if there's a difference in performance:

Dim collection As ItemCollection = CType(CellCollection.Where(Function(i) i.IsPending = True), ItemCollection)
For Each item As Item In collection
'Do something here
Next

and

For Each item As Item In CellCollection.Where(Function(i) i.IsPending = True)
'Do something here
Next

I thought the second one was better as you'd have a variable less and looks cleaner, but on second thought, I'm not quite sure what happens when you put a linq query in the iteration.

View 3 Replies

.net - Performance Of Implementation Of IComparer?

Jul 14, 2011

I'm sorting a collection of type "Document" (usually around 100k records). Sorting usually takes around 4-5 seconds, and I'm wondering if there's a way to speed up sorting by modifying my "DocumentComparer" class which implements IComparer(Of Document). Since the Compare() method would be called hundreds of thousands of times, are there any performance improvements that could be made here that I've overlooked?

[Code]...

View 2 Replies

.net - Performance With System.Net.Mail?

Apr 12, 2010

I have this unusual problem with mailing from my app. At first it wasn't working (getting unable to relay error crap) anyways I added the proper authentication and it works. My problem now is, if I try to send around 300 emails (each with a 500k attachment) the app starts hanging around 95% thru the process.

Here is some of my code which is called for each mail to be sent

[Code]...

View 2 Replies

.net More Performance For Moving Objects?

May 31, 2010

I have the mission to make a small game for a school project. Pictures boxes, moved by a timer for walking enemies.If there are around 5 or 6 moving picture boxes at the form, my application get troubles and lags.After I kill some enemies (remove them from the Controls Collection of the Form/Panel) It come back smooth.I think the loop of the enemy movement is too complicated but I don't know how to make that simpler.

[Code]...

View 5 Replies

Better Performance With Multi Threading?

Feb 15, 2009

I'm creating a password hash recovery tool that uses brute force. I have the brute force algorithm run in a background worker. It all works, but some similar apps I tried out have performance ~100x bigger then my app. (mine does 50k keys/second, some others do 5m keys/second or more.)I realize this is partly caused by using a .Net language, but I suspect there are ways to significantly speed up the brute force. A lot of ppl say I should use multi threading, but how is this done in practice? Splitting up the passwords to check would slow down my app I think.

View 1 Replies

Big Performance With Oracle DataReader In .Net

Nov 10, 2010

I have a few Oracle procedures that generate/return a large amount of data that I need to write out to a file.I'm currently trying to accomplish with a data-reader. It seems to be working, I've successfully generated a 479mb file without any trouble.It took less than 4 minutes from the time I retrieved the dataReader to complete the file.But the dataReader I get for a particular procedure is crawling.It's unbelievably slow.I modified my code to try and get a better idea of what is going on[code]I'm writing a PL/SQL block that will open that cursor to see if the performance issue exists when I remove the .Net code..

View 3 Replies

C# - Improving Code And UI Performance?

May 22, 2010

I am dealing with a situation that I need some help with here. I need to improve performance on functionality that records and updates UI with user selection info. What my code current does is

'This is called to update the Database each time the user 'makes a new selection on the UI

Private Sub OnFilterChanged(String newReviewValueToAdd)
AddRecentViewToDB(newReviewValueToAdd)
UpdateRecentViewsUI()
PageReviewGrid.Rebind()'Call Grid Rebind
End Sub

[Code]...

View 2 Replies

Combobox Performance Many Items?

Oct 28, 2008

So, I've been reading around on the internet and through MSDN trying to find a way to add thousands of items to a combobox without taking 12 seconds.I KNOW, I'm going to incite reflex-responses involving: bad design; use categories and filter; use BeginUpdate ...Here's the thing.I've read through a lot of similiar forum questions as the one I'm asking and none really seemed to answer the question, but these responses are common.The problem is, there is no way to further categorize.I have thousands of customers and each customer can have anywhere from 1 to tens of thousands of designs.The designs have to IDs: DesignID and DesignTitle. The data entry people sometimes have the one and sometimes have the other. If they have the DesignID than all they've got is a number ranging from 1 to (at this time) 60,000. One Customer has 11000 designs. I don't know of any way to further categorize.The reason I use a combobox is for autocomplete. Also, with most customers there are only 10-20 designs, but for some there are thousands.I have to have one practical solution that handles all possibilities.

As far as BeginUpdate or SuspendLayout is concerned, neither have any effect.The sad thing is, the DataSource takes less than a second to load from my DataBase.It's just the setting of the datasource for the combobox that takes so long.It seems to iterate through the entire list once for the bindingsource and then again when I set the DisplayMember.I can set the display member before I set the binding source but that doesn't make any difference in terms of performance.Performance is improved by almost half when I don't use a BindingSource and just set the Combo's DataSource to the List directly, but, sadly, I need to use the bindingSource because there are multiple Combos using the same list.I know WPF uses virtualization for it's combos,.On the internet I found a Technical document on how to implement a Virtual Combobox in C#, but the code was incomplete and I don't really have the time to spend several days creating and debugging something like that.

View 25 Replies

CPU Performance Counter Always Returns Zero?

Mar 29, 2010

In the following block of code always returns zero for the CPU usage. However, if I run it through Visual Studio in debugging mode, do a "Quick watch" on the variable "pcCPUCounter", add ".NextValue()" at the top, and tell it to reevaluate, that returns the varying percentage (eg, 5%, 71%, 16%, etc etc) as the processor utilization fluctuates.

Why would the code always print out zero, but the quick watch doesn't?

Private Sub UpdateCPUUsage(ByVal strSelectedServer As String)
'Performance items come Performance Monitor: perfmon.msc.
'The right-click on columns at bottom and select "add counter" to see list.

[Code].....

View 3 Replies

DataGridView Has Poor Performance

Jun 24, 2010

I have a VB.NET app that has DataGridViews and Drop Down boxes.In VB6, the FlexGrid was fast, scrolling was smooth.Now, in VB.NET, the DataGridView is really slow to scroll through, and the dropdown boxes are sluggish as well.For the interesting bit. If I run Microsoft NetMeeting and either leave it open or click the X to close it (it still stays as a resident program in the system tray though), all the data grids and drop downs work smoothly again.If I actually terminate NetMeeting, they go back to slow/sluggish again.What is it (was it?) in NetMeeting that maybe can be incorporated into my program (some Microsoft library?) that changes how the graphics redraw?

View 1 Replies

Degrading .net Win Application Performance?

Oct 27, 2011

Possible Duplicate: Memory leak in .net application I am working on a desktop application in VB.net 2005.The application contains a timer with an interval of 1 min. Each time the timer ticks, a set of functions gets executed, mostly database related. Initially the application runs fine. In processes(Task manager) the cpu usage goes to 100% every time the timer is invoked. But the timespan is around 1 sec(negligible). However as the time passes and after around 20 hours the time span of timer_tick increases to something like 20-30 secs. In this period cpu usage is 100% and the application does not responds.Gradually the time span of timer_tick increases to 1 min and the cpu uses gets stuck to 100% and the application does not responds. All objects are properly disposed. Moreover, this issue is with pentium 4 processors. The application runs fine on core 2 duo.I am using DevEx controls in my application.The program runs fine with less records in database.I have run the CLR Profiler. The code seems to be fine.

View 1 Replies

Get The Diagnostics-Performance Log Entries?

Jul 11, 2009

I want to get the log entries of "Applications and Services LogsMicrosoftWindowsDiagnostics-PerformanceOperational", do not know how to do that. I know how to get System event log:

Dim myEventLog As New EventLog("System", ".", "EventLog")
Dim myLogEntryCollection As EventLogEntryCollection = myEventLog.Entries
For Each objELE As EventLogEntry In myLogEntryCollection

[code]....

View 2 Replies

Get The Value Of LParam Performance Function?

Sep 26, 2011

I went to watch a real-time nature of the window WM_PSD_ENVSTAMPRECT lParam of this performance function over time.

View 15 Replies

How To Analyze Performance Of .net Program

Jul 1, 2012

i have a large vb.net application, i wanna analyze the performance of the program at runtime.for example, i want to know how many times a certain function was called, or the usage of computer resources for eah function,

View 1 Replies

How To Debug DataSet Performance?

Aug 9, 2011

I have a dataset in a Visual Studio 2010 Web App project which accesses the DB with a complex SQL statement. If I run the statement in SQL Management Studio directly, it loads in a less than a second. If however, I run it using the "Preview Data" button in the dataset designer, or I try to access it on a page (with a gridview for example), it takes over 40 seconds!

View 2 Replies

How To Get Diagnostics Performance Log Entries

Nov 29, 2010

I want to get the log entries of "Applications and Services LogsMicrosoftWindowsDiagnostics-PerformanceOperational", do not know how to do that. I know how to get System event log:
Dim myEventLog As New EventLog("System", ".", "EventLog")
Dim myLogEntryCollection As EventLogEntryCollection = myEventLog.Entries
For Each objELE As EventLogEntry In myLogEntryCollection
..........
Next

View 5 Replies

How To Increase Page Performance In C#

Mar 28, 2012

I want to keep a track which pages are mostly accessed and heavy traffic.And page can be accessible to more user at any instant of time. As number of users increased then login page is not loading and site goes very slow

View 4 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved