plantain-00 / type-coverage

A CLI tool to check type coverage for typescript code
MIT License
1.26k stars 44 forks source link

Increase cache performance #19

Closed darky closed 5 years ago

darky commented 5 years ago

I investigate cache structure, seems it can be optimized for increasing performance.

In this case: https://github.com/plantain-00/type-coverage/blob/1e6c786ebe26895e2b69b9027579fd2aa18b8de5/src/core.ts#L43 uses find with time complexity O(n) But if cache will be appeared as object, where key is file path, complexity will be O(1)

darky commented 5 years ago

Also sha256 for hash generation so heavy, sha1 better for this purpose Or maybe you can see other fastest algo: https://embed.chartblocks.com/1.0/?c=586a7b509973d2205b8d3849&referrer=https%3A%2F%2Fmedium.com%2Fmedia%2F3197da6695a99369671f5dd53af74b49%3FpostId%3D8052b6923a3b&t=ddcb12386fa2d04#

But it require to compile native deps :(

darky commented 5 years ago

Thanks! :+1: Not it 16s -> 13s Maybe better we improve it more :)