Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

276
Vistas
Regexp affecting performance of nodejs app. How to replace improve Regexp in javascript?

I am developing an electron/nodejs app that uses some regexps, two of them are the following :

str=  str.replace(/\((.*?)\)/, "");
str= str.match(/\d+/g);

I am using these regexps inside a function that blocks my electron UI. I then tested the function and I found out that regexps are taking much time.

I researched this issue through SO but alas! JavaScript regexp performance. This did not help me.

Edit: I have thousands of strings to be tested by regexp. which create a very bad impact even blocks the UI of my electron app!

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

I have done a similar task on log files with hundreds of thousands of entries. Unfortunately Node & Electron are not the best choices for this type of task.

While maybe not ideal, the overall solution I was able to use was to create a small application in golang (albeit it could be any other more efficient language) which accepts a simple command line argument and then returns piped data.

After this I was able to use Node/Electron to spawn the child process and call the golang program and grab the response. I was able to reduce minutes of processing to seconds and still enjoy my wonderful Electron interface.

Sometimes a little creativity goes a long way. There is not a single language which is stellar in everything, sometimes it is best to pull strengths from each.

about 4 years ago · Juan Pablo Isaza Denunciar

0

Unfortunately doing that kind of processing on thousands of strings is probably not likely to be too efficient regardless of what you do.

I don't have any experience with electron, but you might see if it's possible to use web workers to split up the work among multiple threads and get the heavy processing done faster. See Using Web Workers from MDN and the top answer to this SO post for some good info on web workers.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda