Keeping in mind Knuth's axiom: "Premature optimization is the root of all evil" https://wiki.c2.com/?PrematureOptimization
On Mon, Oct 16, 2023 at 12:40 PM Levi Elias Nystad-Johansen via beginners < beginners@perl.org> wrote: > Before optimizing, it is recommended to run a profiler to see where the > code is spending the most time. > Here is a good perl profiler: https://metacpan.org/pod/Devel::NYTProf > > There are many tricks to make code faster, here are some that I often use: > > - caching results of slow calculations > - keeping track of states with bit manipulation (like enums) > - using alias/references to avoid copying variables when not needed > > > Here is a video of various small tricks in perl to make code run faster: > https://www.youtube.com/watch?v=jV5Zv3zc3o8 > > It is difficult to advise without seeing the code, you could post the code > to https://perlmonks.org/ to get some good feedback :) > > -L > > ------- Original Message ------- > On Monday, October 16th, 2023 at 4:41 PM, William Torrez Corea < > willitc9...@gmail.com> wrote: > > How can I make a program faster? > > Perl is the fastest, taking 1.9s. Ruby is the second fast, taking 3.0s. > Scala script is the slowest, taking 4.0s. > > Maybe I can use a algorithm but what? > > -- > > With kindest regards, William. > > ⢀⣴⠾⠻⢶⣦⠀ > ⣾⠁⢠⠒⠀⣿⡁ Debian - The universal operating system > ⢿⡄⠘⠷⠚⠋⠀ https://www.debian.org > ⠈⠳⣄⠀⠀⠀⠀ > > > > -- a Andy Bach, afb...@gmail.com 608 658-1890 cell 608 261-5738 wk