Click here to Skip to main content
15,886,362 members
Home / Discussions / C#
   

C#

 
AnswerRe: Regex for String.Contains Pin
Abhinav S10-May-12 23:19
Abhinav S10-May-12 23:19 
GeneralRe: Regex for String.Contains Pin
amrok2amrokk10-May-12 23:32
amrok2amrokk10-May-12 23:32 
AnswerRe: Regex for String.Contains Pin
Pete O'Hanlon10-May-12 23:48
mvePete O'Hanlon10-May-12 23:48 
GeneralRe: Regex for String.Contains Pin
Manfred Rudolf Bihy11-May-12 0:28
professionalManfred Rudolf Bihy11-May-12 0:28 
GeneralRe: Regex for String.Contains Pin
PIEBALDconsult11-May-12 3:24
mvePIEBALDconsult11-May-12 3:24 
AnswerRe: Regex for String.Contains Pin
OriginalGriff11-May-12 3:52
mveOriginalGriff11-May-12 3:52 
GeneralRe: Regex for String.Contains Pin
amrok2amrokk11-May-12 4:28
amrok2amrokk11-May-12 4:28 
GeneralRe: Regex for String.Contains Pin
OriginalGriff11-May-12 4:55
mveOriginalGriff11-May-12 4:55 
First off, when you are timing, don't use DateTime.Now - use the Stopwatch class instead. DateTime is only accurate to +- 10ms according to MS, which is frankly pants. Stopwatch is accurate to the system hardware time tick
Secondly, Did you get the same number of matches?
Thirdly, given the difference is ~10%, that could well be within the limits of experimental error and they are both executing the same code! Try running it 6 or so times and see if you get the same results -= I bet you don't!

I just tried it myself (with Stopwatch), and I get a much more pronounced difference:
SQL
Contains : 507282
Regex : 882800

Contains : 535572
Regex : 876324

Contains : 491582
Regex : 876369

Contains : 464881
Regex : 884031

Contains : 529527
Regex : 877334

Contains : 545686
Regex : 878110


That's on a Dual Core, under Win7 64 bit, running .NET 4, for x86.

Switching to x64:
SQL
Contains : 560253
Regex : 933286

Contains : 587743
Regex : 869393

Contains : 550809
Regex : 862328

Contains : 581642
Regex : 871326

Contains : 578634
Regex : 878303

Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water

GeneralRe: Regex for String.Contains Pin
amrok2amrokk11-May-12 5:07
amrok2amrokk11-May-12 5:07 
GeneralRe: Regex for String.Contains Pin
PIEBALDconsult11-May-12 5:30
mvePIEBALDconsult11-May-12 5:30 
GeneralRe: Regex for String.Contains Pin
amrok2amrokk11-May-12 5:59
amrok2amrokk11-May-12 5:59 
GeneralRe: Regex for String.Contains Pin
PIEBALDconsult11-May-12 5:09
mvePIEBALDconsult11-May-12 5:09 
GeneralRe: Regex for String.Contains Pin
jschell11-May-12 13:46
jschell11-May-12 13:46 
AnswerRe: Regex for String.Contains Pin
BobJanova11-May-12 3:58
BobJanova11-May-12 3:58 
QuestionGraphicsDeviceServce Pin
Philip Solomon See10-May-12 13:08
Philip Solomon See10-May-12 13:08 
AnswerRe: GraphicsDeviceServce Pin
Richard MacCutchan10-May-12 22:02
mveRichard MacCutchan10-May-12 22:02 
Questionsend data from google api v3 javascript to c# Pin
mrx10010-May-12 11:12
mrx10010-May-12 11:12 
AnswerRe: send data from google api v3 javascript to c# Pin
Gerry Schmitz10-May-12 13:01
mveGerry Schmitz10-May-12 13:01 
AnswerRe: send data from google api v3 javascript to c# Pin
loyal ginger11-May-12 4:34
loyal ginger11-May-12 4:34 
GeneralRe: send data from google api v3 javascript to c# Pin
mrx10011-May-12 10:50
mrx10011-May-12 10:50 
GeneralRe: send data from google api v3 javascript to c# Pin
loyal ginger14-May-12 3:33
loyal ginger14-May-12 3:33 
Questiondrawing on one form and display it on another form Pin
borrasanjay10-May-12 9:44
borrasanjay10-May-12 9:44 
AnswerRe: drawing on one form and display it on another form Pin
Luc Pattyn10-May-12 11:15
sitebuilderLuc Pattyn10-May-12 11:15 
GeneralRe: drawing on one form and display it on another form Pin
borrasanjay10-May-12 14:04
borrasanjay10-May-12 14:04 
AnswerRe: drawing on one form and display it on another form Pin
Luc Pattyn10-May-12 14:26
sitebuilderLuc Pattyn10-May-12 14:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.