zanaptak / TypedCssClasses

A CSS class type provider for F# web development. Bring external stylesheet classes into your F# code as design-time discoverable compiler-verified properties.
MIT License
166 stars 8 forks source link

Cache parsed properties, change provided properties to fields #8

Closed zanaptak closed 4 years ago

zanaptak commented 4 years ago

Introduce longer cache for file and process parsed results in addition to the shorter generated type cache.

Also change the provided type to use public literal fields instead of properties. This improves the performance of large IDE completion lists.

Below are informal timings on large sets of Tailwind CSS classes, from the moment of typing a dot on the type until the unfiltered completion list appearing, also compared to a module of hard-coded literals. Time in seconds on a desktop i7-4790k CPU.

Source Tailwind classes Visual Studio 2019 Visual Studio Code
TypedCssClasses 0.3.1 13851 2.1 3.3
TypedCssClasses 0.4.0 13851 1.2 2.2
hard-coded module 13851 0.7 1.7
TypedCssClasses 0.3.1 5535 1.1 1.8
TypedCssClasses 0.4.0 5535 0.7 1.3
hard-coded module 5535 0.4 1.2

Note: The lower Tailwind class count obtained by configuring 1 responsive screen breakpoint instead of the default of 4. See Tailwind CSS theme configuration.

Fixes #7.