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

185
Views
¿Cuánto afecta agregar funciones al tiempo de ejecución?

Se escriben dos códigos para lograr el mismo objetivo. El que tenía más funciones ejecutaba lentamente en comparación con el otro. Quiero saber por qué sucede esto y si es una buena práctica o no.

Ejecute este código en este sitio web y compruébelo. - https://stanford.edu/~cpiech/karel/ide.html

Código 1 (menos funciones):

 function main(){ beepers3Right(); move(); beepers2Left(); beepers3Right(); move(); beepers2Left(); beepers3Right(); } function beepers3Right() { putBeeper(); move(); move(); putBeeper(); move(); move(); putBeeper(); turnLeft(); } function beepers2Left() { turnLeft(); move(); putBeeper(); move(); move(); putBeeper(); move(); turnRight(); move(); turnRight(); }

Código 2 (más funciones)

 function main(){ outer(); moveDiagonal(); inner(); moveDiagonal(); } function move2x(){ move(); move(); } function moveStraightBeeper(){ putBeeper(); move2x(); } function innerMove(){ move2x(); putBeeper(); turnLeft(); } function moveDiagonal(){ move(); turnLeft(); move(); turnRight(); putBeeper(); } function outerMove(){ moveStraightBeeper(); moveStraightBeeper(); turnLeft(); } function outer(){ outerMove(); outerMove(); outerMove(); outerMove(); } function inner(){ innerMove(); innerMove(); innerMove(); }
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!