- 
                Notifications
    You must be signed in to change notification settings 
- Fork 145
Property access benchmarking: timeit-based shell script #732
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Open
      
      
            WasabiFan
  wants to merge
  3
  commits into
  ev3dev-stretch
  
    
      
        
          
  
    
      Choose a base branch
      
     
    
      
        
      
      
        
          
          
        
        
          
            
              
              
              
  
           
        
        
          
            
              
              
           
        
       
     
  
        
          
            
          
            
          
        
       
    
      
from
benchmarking
  
      
      
   
  
    
  
  
  
 
  
      
    base: ev3dev-stretch
Could not load branches
            
              
  
    Branch not found: {{ refName }}
  
            
                
      Loading
              
            Could not load tags
            
            
              Nothing to show
            
              
  
            
                
      Loading
              
            Are you sure you want to change the base?
            Some commits from the old base branch may be removed from the timeline,
            and old review comments may become outdated.
          
          
  
     Open
                    Changes from all commits
      Commits
    
    
            Show all changes
          
          
            3 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      
    File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| # Historical I/O benchmark results | ||
|  | ||
| Procedure: Use an EV3. Disconnect all peripherals, including Wi-Fi. Connect one large EV3 motor. Cold-boot the EV3 and | ||
| leave it for around five minutes to make sure all services have loaded. Execute `io-benchmark.sh` from the Brickman | ||
| interface. Then grab the `benchmark.txt` file from the same directory. | ||
|  | ||
| TODO: instructions for installing from sources with Makefile? | ||
|  | ||
| ## `2.1.0` release | ||
| System info: | ||
| ``` | ||
| Image file: ev3dev-stretch-ev3-generic-2019-05-29 | ||
| Kernel version: 4.14.117-ev3dev-2.3.4-ev3 | ||
| Brickman: 0.10.1 | ||
| BogoMIPS: 148.88 | ||
| Bluetooth: | ||
| Board: board0 | ||
| BOARD_INFO_HW_REV=7 | ||
| BOARD_INFO_MODEL=LEGO MINDSTORMS EV3 | ||
| BOARD_INFO_ROM_REV=6 | ||
| BOARD_INFO_SERIAL_NUM=00165340720B | ||
| BOARD_INFO_TYPE=main | ||
| ``` | ||
|  | ||
| Benchmark results: | ||
| ``` | ||
| Using interpreter python3; found ev3dev2 version 2.1.0 from /usr/lib/python3/dist-packages/ev3dev2 | ||
| Motor read address: | ||
| 1000 loops, best of 3: 970 usec per loop | ||
| Motor read speed_sp: | ||
| 1000 loops, best of 3: 1.1 msec per loop | ||
| Motor read count_per_rot (cached): | ||
| 1000 loops, best of 3: 215 usec per loop | ||
| Motor write speed_sp: | ||
| 1000 loops, best of 3: 1.12 msec per loop | ||
| Using interpreter micropython; found ev3dev2 version 2.1.0 from /usr/lib/micropython/ev3dev2 | ||
| Motor read address: | ||
| 1000 loops, best of 3: 1.21 msec per loop | ||
| Motor read speed_sp: | ||
| 1000 loops, best of 3: 1.17 msec per loop | ||
| Motor read count_per_rot (cached): | ||
| 10000 loops, best of 3: 144 usec per loop | ||
| Motor write speed_sp: | ||
| 1000 loops, best of 3: 1.08 msec per loop | ||
| ``` | ||
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| #!/bin/bash | ||
|  | ||
| exec &> >(tee benchmark.txt) | ||
|  | ||
| do_benchmark() { | ||
| PYTHON=$1 | ||
|  | ||
| VERSION=$($PYTHON -c "import ev3dev2; print(ev3dev2.__version__)") | ||
| MODULE_PATH=$($PYTHON -c "import ev3dev2; print(ev3dev2.__path__[0] if isinstance(ev3dev2.__path__, list) else ev3dev2.__path__)") | ||
|  | ||
| echo "Using interpreter $PYTHON; found ev3dev2 version $VERSION from $MODULE_PATH" | ||
|  | ||
| echo "Motor read address:" | ||
| $PYTHON -m timeit -s "from ev3dev2.motor import Motor; m = Motor()" "m.address" | ||
|  | ||
| echo "Motor read speed_sp:" | ||
| $PYTHON -m timeit -s "from ev3dev2.motor import Motor; m = Motor()" "m.speed_sp" | ||
|  | ||
| echo "Motor read count_per_rot (cached):" | ||
| $PYTHON -m timeit -s "from ev3dev2.motor import Motor; m = Motor()" "m.count_per_rot" | ||
|  | ||
| echo "Motor write speed_sp:" | ||
| $PYTHON -m timeit -s "from ev3dev2.motor import Motor; m = Motor()" "m.speed_sp = 5" | ||
| } | ||
|  | ||
| do_benchmark python3 | ||
| do_benchmark micropython | 
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks pretty cool. I think some newlines in the output would help make it a little more readable but that is minor.
LGTM