Click here to Skip to main content
15,887,135 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: how hard to rewrite a legacy software from C++ to C# in WinForm? Pin
obeobe8-Jan-24 5:48
obeobe8-Jan-24 5:48 
GeneralRe: how hard to rewrite a legacy software from C++ to C# in WinForm? Pin
Thornik8-Jan-24 6:13
Thornik8-Jan-24 6:13 
GeneralRe: how hard to rewrite a legacy software from C++ to C# in WinForm? Pin
jochance8-Jan-24 8:14
jochance8-Jan-24 8:14 
GeneralI did a thing. It's neat. Pin
honey the codewitch6-Jan-24 2:11
mvahoney the codewitch6-Jan-24 2:11 
GeneralRe: I did a thing. It's neat. Pin
Gary Stachelski 20216-Jan-24 4:32
Gary Stachelski 20216-Jan-24 4:32 
GeneralRe: I did a thing. It's neat. Pin
PIEBALDconsult6-Jan-24 5:41
mvePIEBALDconsult6-Jan-24 5:41 
GeneralRe: I did a thing. It's neat. Pin
honey the codewitch6-Jan-24 5:44
mvahoney the codewitch6-Jan-24 5:44 
GeneralRe: I did a thing. It's neat. Pin
PIEBALDconsult6-Jan-24 6:23
mvePIEBALDconsult6-Jan-24 6:23 
My main thing is that I don't know what the Compiled Option actually does. I have an idea what it might or should do, but then it doesn't seem to make much sense not to include it every time.
The "Compiled" option can't instruct the compiler to make IL of the expression at compile time, it has to be at runtime.
I can definitely understand that "compiling" can help when a RegEx is used many times, but does it slow down a RegEx which is used only once or a few times? Is there some number of calls where performance matches (for a particular expression)?

I also found that (apparently) the RegEx class caches the expressions and I suspect that it must "compile" them as well, otherwise why bother?

I just read this:
https://stackoverflow.com/questions/513412/how-does-regexoptions-compiled-work[^]
Which I don't consider canon, though it may be correct.

So Compiled makes it IL at some cost -- great, perfect.
But non-Compiled must do something (at lower cost) as well which can be cached -- "turns the expression into a state machine graph" or similar?

Might it then be kinda:
0) Take Expression in as text
1) Create state machine graph of the Expression and cache it
2) If requested, compile the state machine graph into IL -- and maybe cache that as well?

There is also the question of performance between the static RegEx methods and an instance of a RegEx. Using an instance should at least eliminate the cost of a cache look-up.

Part of why I ask is that I have written a number of methods which use Regular Expressions, and some of these get used by CLR Functions in SQL Server. I therefore want them to run as efficiently as they can as they may be called several million times during a query.


Also, in your response, I suspect that when you say "runtime" you may mean "on each call", not just "on the first call".
GeneralRe: I did a thing. It's neat. Pin
honey the codewitch6-Jan-24 6:32
mvahoney the codewitch6-Jan-24 6:32 
GeneralRe: I did a thing. It's neat. Pin
jschell8-Jan-24 6:47
jschell8-Jan-24 6:47 
GeneralRe: I did a thing. It's neat. Pin
honey the codewitch8-Jan-24 7:04
mvahoney the codewitch8-Jan-24 7:04 
GeneralRe: I did a thing. It's neat. Pin
honey the codewitch6-Jan-24 12:52
mvahoney the codewitch6-Jan-24 12:52 
GeneralRe: I did a thing. It's neat. Pin
PIEBALDconsult6-Jan-24 16:57
mvePIEBALDconsult6-Jan-24 16:57 
GeneralRe: I did a thing. It's neat. Pin
jochance8-Jan-24 8:18
jochance8-Jan-24 8:18 
GeneralRe: I did a thing. It's neat. Pin
PIEBALDconsult8-Jan-24 8:53
mvePIEBALDconsult8-Jan-24 8:53 
GeneralRe: I did a thing. It's neat. Pin
Southmountain6-Jan-24 6:06
Southmountain6-Jan-24 6:06 
GeneralRe: I did a thing. It's neat. Pin
Kenneth Haugland6-Jan-24 6:40
mvaKenneth Haugland6-Jan-24 6:40 
GeneralRe: I did a thing. It's neat. Pin
honey the codewitch6-Jan-24 6:41
mvahoney the codewitch6-Jan-24 6:41 
GeneralFree game Pin
Nelek6-Jan-24 1:58
protectorNelek6-Jan-24 1:58 
GeneralRe: Free game Pin
RickZeeland6-Jan-24 4:18
mveRickZeeland6-Jan-24 4:18 
GeneralRe: Free game Pin
Kenneth Haugland6-Jan-24 15:26
mvaKenneth Haugland6-Jan-24 15:26 
GeneralRe: Free game Pin
Nelek6-Jan-24 23:48
protectorNelek6-Jan-24 23:48 
GeneralFer fawks sake! How to drive one mad... Pin
OriginalGriff6-Jan-24 0:56
mveOriginalGriff6-Jan-24 0:56 
GeneralRe: Fer fawks sake! How to drive one mad... Pin
Nelek6-Jan-24 1:23
protectorNelek6-Jan-24 1:23 
GeneralRe: Fer fawks sake! How to drive one mad... Pin
RickZeeland6-Jan-24 1:45
mveRickZeeland6-Jan-24 1:45 

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.