...sorry, that was a bit too fast;
Am 22.06.22 um 21:10 schrieb Christian Gollwitzer:
> Am 22.06.22 um 18:48 schrieb aotto1968:
>>
> Instead of asking, which one is faster, you should benchmark it. There
> is the time command in the core (and, in newer cores, also the timerate
> command)
This still holds: Time it
>
>
>> Question it is efficient to keep the code as it is **OR** to add a
>> global variable with a *non-changing* global value
>>
>> NEW
>>
>> set myRX "${::librx}(\\w+)$"
>
> I would expect that there is no big difference. The largest effort is
Indeed, for a dynamic string like this, the global variable should be
faster. Still, the RE engine caches not only the conmpiled expressino in
the intrep, but also the most recently used expression strings in order
to deal with this problem of dynamically constructed const strings. That
is special to regexp and does not hold for any other shimmering issue.
Christian