Straightforward one of 85 characters: 

ClassMethod Solve(As %String) As %Integer
{
  i=1:1:$l(o,","){x=$p(o,",",i) $d(y(-x)){y(-x)}else{y(x)=1}} $o(y(""))
}

This (getFiles) method is marked as internal in Cache, and yes, it's typical internal as it's usage is relied on the strong internals knowledge :). Besides, it's hidden in IRIS, and its caller should be rewritten to achieve DBMS independence:

ClassMethod ListDir2(path = "", wildchar = "*", recursive As %String(VALUELIST=",y,n") = "y", ByRef dirlist)
{
 pExtension=1
 pExtension(1)=wildchar

#if $zversion["IRIS"
 temp=$name(^IRIS.Temp)
#else
 temp=$name(^CacheTemp)
#endif
 
 pTempNode=$i(@temp)
 @temp@(pTempNode)
   
 ##class(%SQL.Util.Import).getFiles(path,.pExtension,pTempNode,recursive="y")
 dirlist=@temp@(pTempNode)
 @temp@(pTempNode)  ;zw dirlist
}

Hi Yuri,

What do you mean by IoC?
1) Indicator of Compromise, IoC
or
2) Inversion of Control

That approach works only for *.INT routines. Don't you use *.MAC and *.INC as well?

Bharathsimha,

your initial question should be reformulated as "how to find global's [main] database" because all namespaces have "equal rights" for any global which is visible from (= mapped to) them.

Julias is quite correct in his answering, but you should take into account that it concerns the global's main database only. If global subscript mapping is used, the full solution to get the list of all databases where the global is partially mapped is a more tricky task. If somebody is interested, I can write about how I solved it once.

Almost 15 minutes !!!

What about the second pass with the same ObjectScript code w/o restarting IRIS? 1.7GB is not too much to be stored in the file system cache, so it should be ~5 times quicker. Besides, it's well-known that Cache (IRIS) as a record reader is not so good as a block reader. Everybody knows that %GIF is 5-10 times quicker than %GI. I have the same experience with my own developments: processing files at the block level (read block#$$$BLOCKSIZE) with records parsing at the COS level is quicker than read it record by record. `5*5=25` is close to the time difference between your ObjectScript and Python code runs.

I've written this just to emphasize that we should love Python mostly for the power of its ecosystem, as Nigel wrote. As to speed, it would be better if you InterSystems guys do something to improve file i/o record level operations in IRIS engine...

Hello Olga,

I'm getting from Global Masters:
https://login.intersystems.com/oauth2...

----> Unexpected request - invalid_request

Meanwhile, I was definitely logged in at InterSystems sites.
I've already have checked it up in two different browsers with the same result. Not a great problem for me, just to inform the community team.