dmitrybv 3 Posted Wednesday at 06:53 PM Hello. The following code takes 0.1 seconds on my computer. In my opinion, this is too slow. procedure TFormSimpleDraw2.Button4Click(Sender: TObject); var ItfcVarValue: TValue; Itfc: IInterface; VarValue: Variant; Res: Boolean; begin Itfc := TInterfacedObject.Create; VarValue := Itfc; ItfcVarValue := TValue.From<Variant>(VarValue); var TimeSpan := TThread.GetTickCount64; Res := ItfcVarValue.IsType<String>; Memo1.Lines.Add(FloatToStr((TThread.GetTickCount64 - TimeSpan) / 1000) + ' sec; Result = ' + Res.ToString(TUseBoolStrs.True)); end; Result in Memo1 Memo1.Text = 0.109 sec; Result = False Most likely the reason is related to the occurrence of an internal exception which is then suppressed somewhere. ---- procedure TFormSimpleDraw2.Button5Click(Sender: TObject); var Res: Boolean; ItfcVarValue: TValue; begin ItfcVarValue := TValue.From<IInterface>(TInterfacedObject.Create); var TimeSpan := TThread.GetTickCount64; Res := ItfcVarValue.IsType<String>; Memo1.Lines.Add(FloatToStr((TThread.GetTickCount64 - TimeSpan) / 1000) + ' sec; Result = ' + Res.ToString(TUseBoolStrs.True)); end; Memo1.Text = 0 sec; Result = False Share this post Link to post