sky10p / regexh-contributions

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

Feature Request – Add a way to time the regex performance #11

Closed Palloxin closed 8 months ago

Palloxin commented 8 months ago

Instead of going to whatever regex website(or using a computer) to test the regex... it would be better to do so on the app since it is more comfortable (android applications perk). This timing feature of course can't be precise on the first application of the regex on the string so i suggest to improve the feature simulating the application of the regex x-times. "x" can be fixed by the developer or make the user choose the number. The dev has to set a max value allowed.

sky10p commented 8 months ago

Are there any websites that provide a reference for timing regex performance?

Currently, this feature isn't included in the app. When this app was created, there weren't many alternatives for explaining regular expressions in Android. However, I acknowledge that numerous advanced tools now exist. Unfortunately, my time to work on the app is limited at the moment.

However, I'm interested in your idea. Could you please elaborate on it? I would like to understand the time investment required. If it seems feasible, I might consider adding it to the backlog.

Thank you for your feedback.

Palloxin commented 8 months ago

IMG_20240112_093607 Something like this but on websites It is not precise (range from 100ms to 210ms for the same string and regex and can't do the "average speed"), and maybe alsp because of the ping. I am a very very casual regex user that can't program so I don't know how others measure their regex performance. You have to search various methods on google for the easiest one.

Palloxin commented 8 months ago

or this website IMG_20240112_160100 Give the regex and the string => this will come out.

I also asked AI how to measure regex performance it replied this:

// Create a test string
var testString = "This is a test string with some regex";

// Create the regex pattern
var regexPattern = /test/;

// Measure the time it takes to execute the regex
var startTime = performance.now();
var result = regexPattern.test(testString);
var endTime = performance.now();

// Calculate the execution time
var executionTime = endTime - startTime;

console.log("Regex execution time: " + executionTime + " milliseconds");

not sure if it is useful.

sky10p commented 8 months ago

Thank you for your collaboration. I've added your suggestions to the backlog for consideration in future feature developments. Rest assured, your input will be taken into account.

sky10p commented 8 months ago

I am working on this, and it will be included in the 5.0.0 version of RegexH