GetGlobalSizeBySubscript differs from GetGlobalSize insofar that GetGlobalSize focuses on the data blocks, while GetGlobalSizeBySubscript counts pointer blocks at each level as well and includes them in the total size count. Additionally, in your code, you specify global(sub) for both the start and end nodes when you likely want to use this:

x=##Class(%GlobalEdit).GetGlobalSizeBySubscript(path,global_"("""_sub_""")","",.Size)

The latter measures that entire subnode, as per the examples in the Class Reference.

Robert also raises a good point about Used vs. Allocated. GetGlobalSize (and GSIZE detailed view) return the Used size alongside Allocated, and Used may be less than Allocated due to packing.