A couple easy Inflector extensions

Any interest in some dry-inflector extensions that implement fast_underscore and fast_camelize?

$ bin/bench
Warming up --------------------------------------
       dry-inflector     4.000  i/100ms
      FastUnderscore    88.000  i/100ms
Calculating -------------------------------------
       dry-inflector     47.403  (± 2.1%) i/s -    240.000  in   5.063972s
      FastUnderscore    890.356  (± 1.2%) i/s -      4.488k in   5.041392s

Comparison:
      FastUnderscore:      890.4 i/s
       dry-inflector:       47.4 i/s - 18.78x  (± 0.00) slower

We could have that but my long term goal has been to have a common library with all kinds for transformation functions and a public API for replacing some functions with faster implementations. This way we could have things like dry-logic’s predicates or dry-transformer’s transformations re-implemented as C or Rust extensions and everything that relies on them would automatically benefit. This means I actually see various methods in dry-inflector as something we could extract into…not sure where yet :slightly_smiling_face: Maybe dry-transformer, maybe some new dry-? lib.

I am keeping an eye on the upcoming official Rust support with great interest. That is probably a more fruitful avenue for optimizing things like this rather than adding dependencies.

1 Like