You can probably speed it up a bit by either running it from AI's menu, or wrapping it in a script object:
script addVariables
tell application id "com.adobe.illustrator" -- Adobe Illustrator
tell document 1
set theSel to selection
my addVariablesFor:theSel
end tell
end tell
on addVariablesFor:listOfItems
tell application id "com.adobe.illustrator" -- Adobe Illustrator
tell document 1
repeat with anItem in listOfItems
set theClass to class of anItem
if theClass is text frame then
set theVar to make new variable at end with properties {kind:textual}
set anItem's content variable to theVar
else if theClass is group item then
(my addVariablesFor:(page items of anItem))
end if
end repeat
end tell
end tell
end addVariablesFor:
end script
tell application id "com.adobe.illustrator" -- Adobe Illustrator
run script addVariables
end tell