Menu

bench test result for arduino uno

2026-02-10
2026-03-07
  • Erol Iscioglu

    Erol Iscioglu - 2026-02-10

    Hello Mikael,

    You make a great job, firstly. You may know the answer possibly for my following question. There is a blog page written 10 years ago, and author says he measured 4 seconds for "200 bench" test (atmega328). But I measured 1.7 seconds with FF5.0. What may be the reason ? It's speed increased twice in 10 years ?

    https://weblambdazero.blogspot.com/2016/10/go-forth-with-arduino.html

    Regards,

    Erol

     
    • Mikael Nordman

      Mikael Nordman - 2026-03-07

      Sorry for the late answer. I did not notice your message in the moderation queue until now.
      What code did you run ?

      With for..next and u/mod the test runs in 1.7 seconds.
      With for..next and mod the test runs in 3.8 seconds
      With do..loop and mod the test runs in 8 seconds. Same as Amforth.

      The word MOD is slow. It is defined using /MOD and SM/REM that then uses UM/MOD that is the basic division routine.

      In addition the original for..next code on that website only runs half as many iterations as the do..loop code. That's why FlashForth seems faster. This was pointed out down in the comment section.

       

      Last edit: Mikael Nordman 2026-03-07
      • Erol Iscioglu

        Erol Iscioglu - 2026-03-07

        Here, you wrote 1.7 secs. which is correct if I remember correctly :)

         
        • Erol Iscioglu

          Erol Iscioglu - 2026-03-07

          : bench ( n -- )
          dup for
          r@
          dup for
          dup r@ gcd drop
          next
          drop
          next
          drop ;

          ok this is 1.7 secs the original test in that article

           
  • Mikael Nordman

    Mikael Nordman - 2026-03-07

    This code runs in 3898 milliseconds.
    Replacing u/mod drop with mod runs in 8440 milliseconds.

    : gcd ( a b -- gcd )
      begin 
       dup 
       while 
         swap over u/mod drop 
      repeat 
      drop ;
    
    : bench ( n -- ) 
      ticks swap 
      dup for 
        r@ over for 
          dup r@ gcd drop 
        next 
        drop 
      next 
      drop  
      ticks swap - cr . ;
    200 bench
    3898  ok<#,ram> 
    
     
    • Erol Iscioglu

      Erol Iscioglu - 2026-03-07

      I think here, you used 8 Mhz. Because I see 1.7 secs with 16 Mhz with this code.And mod word is not in dictionary of FF5, there is u/mod. Regards,
      my blog : erolcum.blogspot.com

       
      • Mikael Nordman

        Mikael Nordman - 2026-03-07

        I am using a 16 Mhz Arduino Uno. Note that the bench word has been modified to run gcd 40000 times during the test.

         

        Last edit: Mikael Nordman 2026-03-07
        • Erol Iscioglu

          Erol Iscioglu - 2026-03-07

          I see now. But why you try to show FF slower by changing the bench code. If you look to comments in that article, the guy (who promotes his STM8EF or stm8 eforth) says that his eforth for stm8 is faster than FF but not in reality.

           
          • Mikael Nordman

            Mikael Nordman - 2026-03-07

            Well, I did just want to run the comparable benchmark. I mean to compare with the original benchmark code.

            The STM8 benchmark code, seems to be comparable to the first FF code.

             

            Last edit: Mikael Nordman 2026-03-07
  • Erol Iscioglu

    Erol Iscioglu - 2026-03-07

    With for..next and u/mod the test runs in 1.7 seconds. Yes the same code above. And with 16 Mhz. There is no mod word in dictionary in FF5. correction : it is not same code. 1.7 secs for the code in that article with u/mod drop.

     

    Last edit: Erol Iscioglu 2026-03-07

Log in to post a comment.

MongoDB Logo MongoDB