Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

118
Views
rendimiento de matrices con tipo frente a matrices sin tipo en Javascript

Aprendiendo sobre las matrices tipeadas, leo que las matrices tipificadas normalmente deberían ser más eficientes/rendientes que las no tipificadas.

Ejecuto esta prueba simple (reemplace a por b para ejecutar cada prueba):

 const a = [1, 2, 3, 4] const b = new Uint8Array([1, 2, 3, 4]) const compare1 = (arr) => { for (let i = 0; i < 4; i++) arr[i] } let run = 0 const init1 = performance.now() while (run < 10e7) { compare1(a) run++ } const finish1 = performance.now() console.log("for a ", finish1 - init1) const compare2 = (arr) => { for (let i = 0; i < 4; i++) arr[i] } run = 0 const init2 = performance.now() while (run < 10e7) { compare2(b) run++ } const finish2 = performance.now() console.log("for b ", finish2 - init2)

matriz contiene tipos mixtos de cadenas y números.

Pero tal vez no me estoy haciendo una idea aquí...

¿Debería esperarse que difieran más? ¿Ejemplo?


Editar : Se agregaron 2 funciones diferentes de compareX.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!