src-d / enry

A faster file programming language detector
https://blog.sourced.tech/post/enry/
Apache License 2.0
460 stars 51 forks source link

IsVendor could be changed to use a single regexp #230

Open smola opened 5 years ago

smola commented 5 years ago

IsVendor is using the substring library. It does an Or with dozens of Go regexps. Instead of that, we could check if using a single Go regexp with | is faster.

bzz commented 5 years ago

Thank you for a suggestion!

Indeed, we do exactly this kind of optimization in the latest-added heuristics strategy, but never actually got to measure the performance benefit of that.

Let me know if you are seeing IsVendor being slow in actual application and we'll gauge priority of this one!