sky10p / regexh-contributions

Ayuda a traducer la app de regex a más idiomas
7 stars 3 forks source link

[Feature request] Simulate the regex applied to the string x times for average speed #14

Open Palloxin opened 5 months ago

Palloxin commented 5 months ago

I tried the version 5.0.2 The new timing feature is not precise in the first application of the regex on the string.. so i suggest to improve the feature simulating the application of the regex x-times, sum up all the timings and do the average time. "x" can be fixed by the developer or make the user choose the number. The dev has to set a max value allowed(idk, to avoid the app crashing). I suggest the latter. The variation of time measure is too much. This feature should be an extra "mode" (checkbox in the settings, turned off by default) Time variations: IMG_20240123_113206 IMG_20240123_113154 If I multiply the string to x400 this is the time variation: IMG_20240123_114436 IMG_20240123_114400

sky10p commented 5 months ago

Thank you for trying out version 5.0.2 and for your detailed feedback on the new timing feature. While I see your point about the precision issues and your suggestion for simulating the regex application multiple times for an average time calculation, I'm keen to understand more about the practical applications of this feature. Could you please share some scenarios where this functionality would be particularly useful? This will help me assess the need for such a feature and its potential implementation. My goal is to ensure that any features I introduce are widely beneficial and align with user needs. Your insights into this would be greatly appreciated.

Palloxin commented 5 months ago
  1. Efficiency: Allows developers to write more efficient code. By knowing which regex patterns are faster or slower, developers can optimize their code to improve overall application performance.

  2. In large-scale applications, regex performance has a significant impact on the overall scalability of the system. Knowing the performance characteristics of regex patterns can help in designing systems that can handle increased load without sacrificing performance.

  3. Slow regex patterns can lead to delays in processing user input, resulting in a poor user experience. By optimizing regex patterns for speed, developers can ensure that the application remains responsive and provides a smooth user experience.

  4. Resource Consumption: Inefficient regex patterns can consume excessive CPU and memory resources, leading to increased server costs and reduced overall system performance. Understanding regex performance helps in managing resource consumption effectively.

  5. Pratice purposes: The app can act as a quick and comfortable pratice ground(also offline without pc needed) for users that want to learn or improve how to make performant regexes.

Frankly speaking the actual timing feature(without average speed) is not that much useful, almost a mere aesthetical addition. Also this: https://www.sonarsource.com/blog/vulnerable-regular-expressions-javascript/

sky10p commented 5 months ago

While I understand the potential advantages of enhancing the regex timing feature as you suggested, I have some reservations. The existing timing mechanism provides a straightforward measure of the regex's processing time. Introducing a feature to calculate an average time through multiple simulations could add complexity and might not always yield more informative results.

For instance, regex patterns can behave differently under various conditions, leading to significant timing variations. This could render an average time less reflective of actual performance, especially in diverse application scenarios.

Additionally, incorporating a more detailed performance analysis mode could complicate the app's user interface, potentially impacting its ease of use. It's a delicate balance to provide in-depth insights while maintaining simplicity.

Your input is valuable, and I'll give it careful consideration. However, my current inclination is to keep the feature as is, prioritizing its straightforwardness and reliability.

But I can think about adding another section in the app to view performance metrics for an expression or something similar, but I have to look into it.

sky10p commented 5 months ago

I have added some tasks to the backlog to look into the measures of regex expressions to evaluate these changes