TypeScript 长时间运行的编码语义分类-完整请求

nbysray5  于 24天前  发布在  TypeScript
关注(0)|答案(9)|浏览(18)

🔎 搜索词

@RyanCavanaugh请求我创建一个新问题

🕗 版本与回归信息

  • 这个行为在每个我尝试的版本中都是如此,我也查看了关于5.5.4的常见问题解答条目。

⏯ Playground链接

  • 无响应*

💻 代码

  • 克隆 example repo
  • 运行 npm i
  • 在VSCode中导航到第26行
  • 尝试使用自动建议菜单( Command + . )

警告 React Hook useEffect has a missing dependency: 'getProfile'. Either include it or remove the dependency array.eslint[react-hooks/exhaustive-deps](https://github.com/facebook/react/issues/14920) 应该出现在第26行

🙁 实际行为

2024-08-15 18:57:48.766 [trace] <semantic> Response received: encodedSemanticClassifications-full (210). Request took 155445 ms. Success: true { "spans": [ 467, 11, 2817, 493, 5, 2560, 500, 4, 2089, 509, 10, 2816, 520, 11, 2056, 543, 7, 2089, 552, 10, 2857, 566, 8, 2816, 575, 12, 1536, 600, 6, 2089, 609, 10, 2816, 620, 21, 2056, 686, 10, 2857, 699, 11, 2816, 737, 4, 2560, 743, 8, 2089, 762, 6, 2088, 769, 6, 2560, 776, 11, 2560, 788, 4, 3072, 801, 6, 2561, 819, 5, 2561, 838, 2, 2561, 842, 4, 2088, 848, 10, 2560, 899, 8, 2088, 908, 6, 2576, 918, 10, 2856, 929, 8, 2088, 949, 6, 2088, 956, 6, 2560, 963, 11, 2560, 976, 4, 2088, 987, 9, 2816, 1009, 10, 2856, 1029, 6, 2088, 1036, 6, 2560, 1043, 11, 2560, 1056, 4, 2088, 1124, 7, 2088, 1160, 4, 2561, 1178, 7, 2561, 1205, 8, 2561, 1240, 5, 2561, 1259, 7, 2561, 1286, 8, 2561, 1321, 12, 2561, 1347, 7, 2561, 1374, 8, 2561, 1409, 6, 2561, 1429, 7, 2561, 1456, 8, 2561 ], "endOfLineState": 0 }
encodedSemanticClassifications-full 花费了近一分钟半的时间。

🙂 预期行为

encodedSemanticClassifications-full 应该在几秒钟内完成。

关于此问题的附加信息

当我删除对Schema的导入时,一切似乎都按预期工作。Schema是一个相当复杂的生成类型,其定义在这里。

nqwrtyyt

nqwrtyyt1#

这看起来非常类似于$x_{1e0f1}x$ (sorta) / $x_{1e1f1}x$ / $x_{1e2f1}x$,这是我之前尝试帮助修复的东西。这个仓库似乎基本上把它所有的时间都花在了$x_{1m0n1}x$上,这意味着有一些真正巨大的文字集合正在被处理。

rggaifut

rggaifut2#

尽管如此,我对这个复现感到困惑;它提到了一个出现在eslint错误中的(与TypeScript无关?),以及上述性能问题来自于诊断本身,而不是语义高亮。在复现中运行tsc需要很长时间。问题是性能普遍吗?

nwsw7zdq

nwsw7zdq3#

eslint错误仅反映性能问题,是的。尽管性能问题似乎起源于TypeScript-具体来说是在Schema中。我原以为可能是递归问题。

ybzsozfc

ybzsozfc4#

我不确定这个错误发生在哪里,但在这个例子中,有一些内容试图创建一个包含628,109类型的联合体,其中有1,733个是模板字面量,另外626,376是需要与这些模板字面量匹配的字符串字面量。这意味着需要进行***1,085,509,608***次字符串到字符串字面量的推断。

qzlgjiam

qzlgjiam5#

在此处添加一个限制器以在发生此情况时退出:

src/components/UserProfile/UserProfile.tsx:14:38 - error TS2590: Expression produces a union type that is too complex to represent.

 14     const { data: profiles } = await client.models.UserProfile.list({
                                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 15       filter: {
    ~~~~~~~~~~~~~~~
... 
 19       },
    ~~~~~~~~
 20     });
    ~~~~~~
sauutmhj

sauutmhj6#

为了展示这些字符串是什么,如果这有助于缩小不良代码的范围:

healthGoals.userProfile.automatedUpdates.userProfile.privacySettings.userProfile.predictiveAnalytics.*
healthGoals.userProfile.automatedUpdates.userProfile.privacySettings.userProfile.articles.*
healthGoals.userProfile.automatedUpdates.userProfile.privacySettings.userProfile.medicationLogs.*
healthGoals.userProfile.automatedUpdates.userProfile.privacySettings.userProfile.symptomLogs.*
healthGoals.userProfile.automatedUpdates.userProfile.privacySettings.userProfile.contraceptiveMethods.*
healthGoals.userProfile.automatedUpdates.userProfile.privacySettings.userProfile.contraceptiveReminders.*
healthGoals.userProfile.automatedUpdates.userProfile.privacySettings.userProfile.ovulationTests.*
healthGoals.userProfile.automatedUpdates.userProfile.privacySettings.userProfile.basalBodyTemperatures.*
healthGoals.userProfile.automatedUpdates.userProfile.privacySettings.userProfile.menstrualHealthInsights.*
healthGoals.userProfile.automatedUpdates.userProfile.privacySettings.userProfile.ovulationPredictions.*
healthGoals.userProfile.automatedUpdates.userProfile.privacySettings.userProfile.ovulationCycles.*
healthGoals.userProfile.automatedUpdates.userProfile.privacySettings.userProfile.birthday.*
healthGoals.userProfile.automatedUpdates.userProfile.privacySettings.userProfile.avatar.*
healthGoals.userProfile.automatedUpdates.userProfile.privacySettings.userProfile.profileOwner.*
healthGoals.userProfile.automatedUpdates.userProfile.privacySettings.userProfile.fertilityWindows.*
healthGoals.userProfile.automatedUpdates.userProfile.privacySettings.userProfile.progressReports.*
healthGoals.userProfile.automatedUpdates.userProfile.privacySettings.userProfile.uuid.*
healthGoals.userProfile.automatedUpdates.userProfile.privacySettings.userProfile.OvulationCycleAnalysis.*
healthGoals.userProfile.automatedUpdates.userProfile.privacySettings.userProfile.id.*
healthGoals.userProfile.automatedUpdates.userProfile.privacySettings.userProfile.email.*
healthGoals.userProfile.automatedUpdates.userProfile.privacySettings.updatedAt
healthGoals.userProfile.automatedUpdates.userProfile.privacySettings.createdAt
healthGoals.userProfile.automatedUpdates.userProfile.privacySettings.settingValue
healthGoals.userProfile.automatedUpdates.userProfile.privacySettings.settingName
os8fio9y

os8fio9y7#

你能尝试在#59759(评论)上构建吗,看看是否能解决一般性问题?

pepwfjgg

pepwfjgg8#

看起来并没有什么区别。

cunj1qz1

cunj1qz19#

好的。我重新检查了一下仅用于完成调用的配置文件,现在大部分时间都花在了自动导入上。

在我的日志中,我没有看到问题标题中的调用占用了时间:

但是确实看到了完成速度很慢:

你能打开日志记录并发送tsserver日志吗?

相关问题