- Frugal Cafe
- Posts
- FC77: NDepend AppWordsPowerTool, real clean implementation
FC77: NDepend AppWordsPowerTool, real clean implementation
In FC76: NDepend, with so much code analysis, code should be great? (beehiiv.com), we discussed NDepend AppWordsPowerTool implementation, with so many static analysis running, has quite a few performance issues. So it’s really not clean.
Here is a much better implementation: clean, simple, and efficient:
We just need to build a single dictionary, then copy its content to two arrays, then sort, generate output. In this way, we’re avoiding generating large lists. Here is AddIdentifier implementation:
Extract word implementation:
Single word splitting implementation, much simpler than before:
Normalization implementation:
Pascal casing is deferred until final output generation:
This is still not optimal, but its call frequency is much reduced, so may not be a big performance issue anymore.