Speed up CLong() function

Looking on hat debugger spends time one, it seems like CLong() may be used frequently, so its performance is important for a lot of other things.

Seems like CLong calls ConvertEncoding and waste a lot of time to make sure an UTF-8 string I pass is actual UTF-8.

Please check runtime framework for such functions to avoid calling ConvertEncoding, if the encoding is already UTF-8 or ASCII, so you don’t invoke ConvertEncoding and TECConvertText in that case at all.

e.g. see this sample result:

  • 114 REALbasic.CLong%i8%s (in Xojo) + 19 [0x107498c53]
  • 110 runCLong (in XojoFramework) + 60 [0x11a292da6]
  • ! 109 ConvertEncoding(string, unsigned int) (in XojoFramework) + 245 [0x11a41fa2d]
  • ! : 50 ConvertTextMacOS(OpaqueTECObjectRef**, stringStorage*, unsigned int, unsigned int) (in XojoFramework) + 190 [0x11a41f768]
  • ! : | 41 TECConvertText (in CarbonCore) + 193 [0x7ff81f5278d4]
  • ! : | + 40 TECConvertTextInternal (in CarbonCore) + 697 [0x7ff81f527bdc]
  • ! : | + ! 40 ConvertFromUnicodeHook (in Unicode Encodings) + 162 [0x1296f6a90]

Submitted to issues: Xojo: Account Login


It seems that CLong is deprecated.
Have you checked String.ToInt64 as well?

This is not for my code.

The debugger in Xojo itself uses CLong() for some things internally, so I saw that.

I’m sure you know much better than me about this.
I just wanted to know the best way to use this function.