perf($compile): optimize publicLinkFn